Commit 184e7f8b authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by Cédric Le Ninivin

erp5_real_time_inventory_accounting: set price from document as aggregate in...

erp5_real_time_inventory_accounting: set price from document as aggregate in order to be able to debug
parent 0c468667
......@@ -39,12 +39,26 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(
simulation_movement = self._applied_rule.getParentValue()
# No expand if SourceAssetPrice is not defined (already checked in 'Test Method ID' on the Rule).
#let's trace which internal supply line is used for ME, Production, Sale
delivery_value = simulation_movement.getDeliveryValue()
if delivery_value and ('Purchase' not in delivery_value.getPortalType() and 'Internal' not in delivery_value.getPortalType()):
supply = simulation_movement.Movement_getSourceAssetPrice(return_internal_supply_line=True, return_price_document=True)
if supply is None:
return []
base_price = supply.getBasePrice()
simulation_movement = simulation_movement.asContext()
simulation_movement.setAggregateValue(supply, portal_type=supply.getPortalType())
else:
base_price = simulation_movement.getSourceAssetPrice()
simulation_movement = simulation_movement.asContext()
if base_price is None:
return []
quantity = simulation_movement.getCorrectedQuantity() * base_price
return [simulation_movement.asContext(quantity=quantity)]
simulation_movement.edit(quantity = quantity)
return [simulation_movement]
def _getUpdatePropertyDict(self, input_movement):
update_property_dict = InvoiceTransactionRuleMovementGenerator._getUpdatePropertyDict(
......
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