Commit 1e3f897f authored by Jérome Perrin's avatar Jérome Perrin

fixup! accounting: reset grouping reference in a "context free" script

parent 4bd5cbe7
...@@ -15,23 +15,25 @@ portal = context.getPortalObject() ...@@ -15,23 +15,25 @@ portal = context.getPortalObject()
resetGroupingReference = portal.ERP5Site_resetAccountingTransactionLineGroupingReference resetGroupingReference = portal.ERP5Site_resetAccountingTransactionLineGroupingReference
if async: if async:
resetGroupingReference = portal.portal_simulation.activate( resetGroupingReference = portal.portal_simulation.activate(
activity='SQLQueue',
after_tag='accounting_grouping_reference' after_tag='accounting_grouping_reference'
).ERP5Site_resetAccountingTransactionLineGroupingReference ).ERP5Site_resetAccountingTransactionLineGroupingReference
ungrouped_line_list = [] ungrouped_line_set = set()
grouping_reference = context.getGroupingReference()
for (section_value, node_uid, mirror_section_uid) in ( for (section_value, node_uid, mirror_section_uid) in (
(context.getSourceSectionValue(), context.getSourceUid(), context.getDestinationSectionUid(),), (context.getSourceSectionValue(), context.getSourceUid(), context.getDestinationSectionUid(),),
(context.getDestinationSectionValue(), context.getDestinationUid(), context.getSourceSectionUid(),), (context.getDestinationSectionValue(), context.getDestinationUid(), context.getSourceSectionUid(),),
): ):
if section_value is not None: if node_uid is not None and section_value is not None:
section_value = section_value.Organisation_getMappingRelatedOrganisation() section_value = section_value.Organisation_getMappingRelatedOrganisation()
section_category = section_value.getGroup(base=True) section_category = section_value.getGroup(base=True)
if section_category: if section_category:
ungrouped_line_list.extend(resetGroupingReference( ungrouped_line_set.update(resetGroupingReference(
section_category=section_category, section_category=section_category,
node_uid=node_uid, node_uid=node_uid,
mirror_section_uid=mirror_section_uid, mirror_section_uid=mirror_section_uid,
grouping_reference=context.getGroupingReference() grouping_reference=grouping_reference
) or []) ) or [])
return list(ungrouped_line_set)
return ungrouped_line_list
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