Commit 9b9e07fa authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_real_time_inventory_accounting: price document can be purchase

parent 7813bf6e
...@@ -41,12 +41,18 @@ class InventoryAssetPriceAccountingRuleMovementGenerator( ...@@ -41,12 +41,18 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(
# No expand if SourceAssetPrice is not defined (already checked in 'Test Method ID' on the Rule). # 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 #let's trace which internal supply line is used for ME, Production, Sale
delivery_value = simulation_movement.getDeliveryValue() delivery_value = simulation_movement.getDeliveryValue()
if delivery_value and ('Purchase' not in delivery_value.getPortalType() and 'Internal' not in delivery_value.getPortalType()): if delivery_value \
and (('Manufacturing' in delivery_value.getPortalType()) \
or ('Production' in delivery_value.getPortalType()) \
or ('Internal' in delivery_value.getPortalType() and delivery_value.getSpecialise(portal_type='Internal Trade Condition') == 'internal_trade_condition_module/skd_movement_internal_trade_condition')):
supply = simulation_movement.Movement_getSourceAssetPrice(return_internal_supply_line=True, return_price_document=True) supply = simulation_movement.Movement_getSourceAssetPrice(return_internal_supply_line=True, return_price_document=True)
if supply is None: if supply is None:
return [] return []
if supply.getPortalType().startswith('Internal Supply'):
base_price = supply.getBasePrice() base_price = supply.getBasePrice()
else:
base_price = supply.getDestinationAssetPrice()
simulation_movement = simulation_movement.asContext() simulation_movement = simulation_movement.asContext()
simulation_movement.setAggregateValue(supply, portal_type=supply.getPortalType()) simulation_movement.setAggregateValue(supply, portal_type=supply.getPortalType())
else: else:
......
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