Commit 0d79c69e authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Titouan Soulard

erp5_real_time_inventory_accounting: Update Inventory Rule

* Use getSourceAssetPriceCurrency
* Do not expand if no SourceAssetPrice
parent 1a5d8425
...@@ -68,11 +68,10 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM ...@@ -68,11 +68,10 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
def _getInputMovementList(self, movement_list=None, rounding=False): def _getInputMovementList(self, movement_list=None, rounding=False):
simulation_movement = self._applied_rule.getParentValue() simulation_movement = self._applied_rule.getParentValue()
# No expand if price is not set (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).
# Price is automatically acquired from Supply if not set directly on PL Movement.
base_price = simulation_movement.getSourceAssetPrice() base_price = simulation_movement.getSourceAssetPrice()
if not base_price: if base_price is None:
base_price = simulation_movement.getPrice(0.0) return []
quantity = simulation_movement.getCorrectedQuantity() * base_price quantity = simulation_movement.getCorrectedQuantity() * base_price
if quantity is None: if quantity is None:
return [] return []
...@@ -87,6 +86,9 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM ...@@ -87,6 +86,9 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
if input_movement.getRootAppliedRule().getCausalityValue().getPortalType().startswith('Purchase'): if input_movement.getRootAppliedRule().getCausalityValue().getPortalType().startswith('Purchase'):
update_property_dict['source_section'] = input_movement.getDestinationSection() update_property_dict['source_section'] = input_movement.getDestinationSection()
resource = input_movement.getSourceAssetPriceCurrency()
if resource:
update_property_dict['resource'] = resource
return update_property_dict return update_property_dict
......
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