Commit 658d4224 authored by Romain Courteaud's avatar Romain Courteaud

slapos_accounting: use the trade condition reference instead of the id

sale trade condition are versionned.
parent 64fd2439
root_trade_condition_list = ["sale_trade_condition_module/slapos_aggregated_trade_condition",
"sale_trade_condition_module/slapos_aggregated_subscription_trade_condition",
# Valid trade condition for payments
"sale_trade_condition_module/slapos_manual_accounting_trade_condition"]
if context.getSpecialise() in root_trade_condition_list:
return True
portal = context.getPortalObject()
specialise_uid = [
portal.restrictedTraverse(i).getUid() for i in root_trade_condition_list
root_trade_condition_reference_list = [
"slapos_aggregated_trade_condition",
"slapos_aggregated_subscription_trade_condition",
# Valid trade condition for payments
"slapos_manual_accounting_trade_condition"
]
root_trade_condition_list = portal.portal_catalog(
portal_type="Sale Trade Condition",
reference=root_trade_condition_reference_list,
validation_state="validated",
)
specialise_uid_list = [x.getUid() for x in root_trade_condition_list]
if context.getSpecialiseUid() in specialise_uid_list:
return True
return context.getSpecialiseUid() in [
i.uid for i in portal.ERP5Site_searchRelatedInheritedSpecialiseList(
portal_type="Sale Trade Condition",
specialise_uid=specialise_uid,
specialise_uid=specialise_uid_list,
validation_state="validated")]
......@@ -10,8 +10,8 @@ assert context.getPortalType() == 'Sale Invoice Transaction'
assert context.getPaymentMode() == 'payzen'
assert context.getSimulationState() == 'stopped'
assert context.getTotalPrice() != 0
assert context.getSpecialise() in ("sale_trade_condition_module/slapos_aggregated_trade_condition",
"sale_trade_condition_module/slapos_aggregated_subscription_trade_condition")
assert context.getSpecialiseReference() in ("slapos_aggregated_trade_condition",
"slapos_aggregated_subscription_trade_condition")
paid = True
for line in context.getMovementList(portal.getPortalAccountingMovementTypeList()):
......
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