Commit 5d4fe66b 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 4cabff2c
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() 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 [ return context.getSpecialiseUid() in [
i.uid for i in portal.ERP5Site_searchRelatedInheritedSpecialiseList( i.uid for i in portal.ERP5Site_searchRelatedInheritedSpecialiseList(
portal_type="Sale Trade Condition", portal_type="Sale Trade Condition",
specialise_uid=specialise_uid, specialise_uid=specialise_uid_list,
validation_state="validated")] validation_state="validated")]
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