Commit 860705ff authored by Cédric Le Ninivin's avatar Cédric Le Ninivin Committed by Cédric Le Ninivin

psa_real_time_inventory_accounting: Update PSA patch to include different price in case of sale

parent 22449c93
...@@ -54,6 +54,14 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM ...@@ -54,6 +54,14 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
'stock/preparation/sortie', 'stock/preparation/sortie',
'stock/transit/entree'): 'stock/transit/entree'):
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStartDate() update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStartDate()
if input_movement.getRootAppliedRule().getCausalityValue().getPortalType().startswith('Sale'):
sign = lambda x: (1, -1)[x < 0]
update_dict['quantity'] = input_movement.getResourceValue().Resource_getPriceCalculationOperandDict(
movement=input_movement,
use_internal_supply=True,
)['price'] * sign(movement.getQuantity())
movement._edit(**update_dict) movement._edit(**update_dict)
input_movement.log("%r (input_movement=%r): ledger=%r, start_date=%r, stop_date=%r" % input_movement.log("%r (input_movement=%r): ledger=%r, start_date=%r, stop_date=%r" %
......
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