Commit fa03611a authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

erp5_real_time_inventory_accounting: Update Rule

* Code clean up
* Remove hardcoded ledger to pick date
* Add code to defined source section when none is defined
parent a25ca379
......@@ -26,10 +26,11 @@
#
##############################################################################
from Products.ERP5.Document.InvoiceTransactionSimulationRule import (InvoiceTransactionSimulationRule,
InvoiceTransactionRuleMovementGenerator)
from Products.ERP5.Document.InvoiceTransactionSimulationRule import \
InvoiceTransactionSimulationRule, InvoiceTransactionRuleMovementGenerator
class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleMovementGenerator):
class InventoryAssetPriceAccountingRuleMovementGenerator(
InvoiceTransactionRuleMovementGenerator):
"""
"""
# CMF Type Definition
......@@ -72,12 +73,10 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
# PATCH-BEGIN
update_dict = {}
if movement.getLedger() in ('stock/stock/entree',
'stock/preparation/entree',
'stock/transit/sortie',
'stock/customs/entree'):
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStopDate()
elif movement.getLedger() in ('stock/stock/sortie',
'stock/preparation/sortie',
elif movement.getLedger() in ('stock/preparation/sortie',
'stock/transit/entree'):
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStartDate()
......@@ -116,6 +115,9 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
if input_movement.getRootAppliedRule().getCausalityValue().getPortalType().startswith('Purchase'):
update_property_dict['source_section'] = input_movement.getDestinationSection()
if not input_movement.getSourceSection():
update_property_dict['source_section'] = input_movement.getDestinationSection()
resource = input_movement.getSourceAssetPriceCurrency()
if resource:
update_property_dict['resource'] = resource
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment