Commit 790a951d authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Fixup post builder script for SlapOS Aggregated Delivey Builder

In general we should only setGroupReference when the generation matches, as the builder can generate multiples SPLs at once.
parent 21e4ba67
from DateTime import DateTime
restrictedTraverse = context.getPortalObject().restrictedTraverse
portal = context.getPortalObject()
restrictedTraverse = portal.restrictedTraverse
person = context.getDestination()
reference = context.getReference()
business_process_uid_list = [
portal.business_process_module.slapos_reservation_refound_business_process.getUid(),
portal.business_process_module.slapos_subscription_business_process.getUid()]
specialise_list = [q.getRelativeUrl() for q in portal.portal_catalog(
specialise_uid=business_process_uid_list, portal_type='Sale Trade Condition')]
consumption_specialise_list = [q.getRelativeUrl() for q in portal.portal_catalog(
specialise_uid=portal.business_process_module.slapos_consumption_business_process.getUid(),
portal_type='Sale Trade Condition')]
subscription_request_specialise = portal.portal_preferences.getPreferredAggregatedSubscriptionSaleTradeCondition()
consumption_specialise = portal.portal_preferences.getPreferredAggregatedConsumptionSaleTradeCondition()
trade_condition = context.getSpecialise()
specialise_filter_list = consumption_specialise_list + specialise_list
if trade_condition == consumption_specialise:
specialise_filter_list = consumption_specialise_list
elif trade_condition == subscription_request_specialise:
specialise_filter_list = specialise_list
input_movement_list = [restrictedTraverse(q) for q in
related_simulation_movement_path_list
if restrictedTraverse(q).getDestination() == person]
if restrictedTraverse(q).getDestination() == person and \
restrictedTraverse(q).getSpecialise() in specialise_filter_list]
for delivery_line in input_movement_list:
delivery_line.setGroupingReference(reference)
if context.getCausalityState() == 'draft':
context.startBuilding()
......
......@@ -6,6 +6,7 @@
##############################################################################
import transaction
import time
from functools import wraps
from Products.ERP5Type.tests.utils import createZODBPythonScript
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, withAbort
......@@ -1375,6 +1376,8 @@ portal_workflow.doActionFor(open_order, action='edit_action', comment='Visited b
def test_alarm(self):
open_order = self.createOpenOrder()
self.tic()
# Jut wait a bit so the line has a different timestamp > 1 sec.
time.sleep(1)
open_order.newContent(portal_type="Open Sale Order Line")
self.tic()
self._simulateOpenSaleOrder_reindexIfIndexedBeforeLine()
......
......@@ -46,17 +46,17 @@
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W: 30, 10: Use of eval (eval-used)</string>
<string>W:758, 20: Use of eval (eval-used)</string>
<string>W:759, 23: Use of eval (eval-used)</string>
<string>W:780, 20: Use of eval (eval-used)</string>
<string>W:781, 23: Use of eval (eval-used)</string>
<string>W:846, 20: Use of eval (eval-used)</string>
<string>W:847, 23: Use of eval (eval-used)</string>
<string>W:856, 20: Use of eval (eval-used)</string>
<string>W:857, 23: Use of eval (eval-used)</string>
<string>W:920, 35: Use of eval (eval-used)</string>
<string>W:921, 31: Use of eval (eval-used)</string>
<string>W: 31, 10: Use of eval (eval-used)</string>
<string>W:759, 20: Use of eval (eval-used)</string>
<string>W:760, 23: Use of eval (eval-used)</string>
<string>W:781, 20: Use of eval (eval-used)</string>
<string>W:782, 23: Use of eval (eval-used)</string>
<string>W:847, 20: Use of eval (eval-used)</string>
<string>W:848, 23: Use of eval (eval-used)</string>
<string>W:857, 20: Use of eval (eval-used)</string>
<string>W:858, 23: Use of eval (eval-used)</string>
<string>W:921, 35: Use of eval (eval-used)</string>
<string>W:922, 31: Use of eval (eval-used)</string>
</tuple>
</value>
</item>
......@@ -129,6 +129,7 @@
</item>
</dictionary>
</list>
<none/>
</tuple>
</pickle>
</record>
......
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