Merge lp:~unifield-team/unifield-server/us-1181 into lp:unifield-server

Proposed by Quentin THEURET @Amaris
Status: Merged
Merged at revision: 4007
Proposed branch: lp:~unifield-team/unifield-server/us-1181
Merge into: lp:unifield-server
Diff against target: 46 lines (+7/-4)
2 files modified
bin/addons/sync_so/purchase.py (+2/-2)
bin/workflow/wkf_service.py (+5/-2)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1181
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+291902@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/sync_so/purchase.py'
2--- bin/addons/sync_so/purchase.py 2016-03-03 11:05:52 +0000
3+++ bin/addons/sync_so/purchase.py 2016-04-14 14:48:55 +0000
4@@ -438,7 +438,7 @@
5
6 if proc_ids:
7 self.pool.get('procurement.order').write(cr, uid, proc_ids, {'purchase_id': res_id}, context=context)
8- netsvc.LocalService("workflow").trg_change_subflow(uid, 'procurement.order', proc_ids, 'purchase.order', order_ids, res_id, cr)
9+ netsvc.LocalService("workflow").trg_change_subflow(uid, 'procurement.order', proc_ids, 'purchase.order', order_ids, res_id, cr, force=True)
10
11 # for orig_line, split_lines in to_split.iteritems():
12 # pol_ids = line_obj.search(cr, uid, [('order_id', '=', res_id), ('original_purchase_line_id', '=', orig_line)], context=context)
13@@ -548,7 +548,7 @@
14 if sol.procurement_id and sol.procurement_id.purchase_id:
15 self.pool.get('procurement.order').write(cr, uid, [sol.procurement_id.id], {'purchase_id': po_id}, context=context)
16 line_obj.write(cr, uid, [line.id], {'procurement_id': sol.procurement_id.id}, context=context)
17- netsvc.LocalService("workflow").trg_change_subflow(uid, 'procurement.order', [sol.procurement_id.id], 'purchase.order', [po_id], po_id, cr)
18+ netsvc.LocalService("workflow").trg_change_subflow(uid, 'procurement.order', [sol.procurement_id.id], 'purchase.order', [po_id], po_id, cr, force=True)
19 if sol.order_id and (not sol.order_id.procurement_request or sol.order_id.location_requestor_id.usage == 'customer'):
20 self.write(cr, uid, [po_id], {'cross_docking_ok': True}, context=context)
21
22
23=== modified file 'bin/workflow/wkf_service.py'
24--- bin/workflow/wkf_service.py 2014-02-21 13:22:34 +0000
25+++ bin/workflow/wkf_service.py 2016-04-14 14:48:55 +0000
26@@ -87,7 +87,7 @@
27
28 # change the subflow of workitems attached to the 'main_ids' of 'main_type' object
29 # by the subflow of the new resource defined by the 'res_type' object and the 'res_ids' ids
30- def trg_change_subflow(self, uid, main_type, main_ids, res_type, res_ids, new_rid, cr):
31+ def trg_change_subflow(self, uid, main_type, main_ids, res_type, res_ids, new_rid, cr, force=False):
32 # get ids of wkf instances for the old resource (res_id)
33 #CHECKME: shouldn't we get only active instances?
34 if not res_ids or not main_ids:
35@@ -106,7 +106,10 @@
36 cr.execute('select id from wkf_instance where res_type=%s and res_id in %s', (main_type, tuple(main_ids)))
37 for (inst_id,) in cr.fetchall():
38 # select all workitems which "wait" for the old instance
39- cr.execute('select id from wkf_workitem where subflow_id=%s and inst_id = %s', (old_inst_id, inst_id))
40+ if force:
41+ cr.execute('select id from wkf_workitem where inst_id = %s', (inst_id,))
42+ else:
43+ cr.execute('select id from wkf_workitem where subflow_id=%s and inst_id = %s', (old_inst_id, inst_id))
44 for (item_id,) in cr.fetchall():
45 # redirect all those workitems to the wkf instance of the new resource
46 cr.execute('update wkf_workitem set subflow_id=%s where id=%s', (new_id[0], item_id))

Subscribers

People subscribed via source and target branches

to all changes: