Merge lp:~mallorymarcot/unifield-server/us-3893 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 4718
Proposed branch: lp:~mallorymarcot/unifield-server/us-3893
Merge into: lp:unifield-server
Diff against target: 83 lines (+24/-20)
3 files modified
bin/addons/delivery_mechanism/wizard/enter_reason.py (+2/-0)
bin/addons/msf_outgoing/msf_outgoing.py (+20/-20)
bin/addons/sale/sale_workflow.py (+2/-0)
To merge this branch: bzr merge lp:~mallorymarcot/unifield-server/us-3893
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+336233@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/delivery_mechanism/wizard/enter_reason.py'
2--- bin/addons/delivery_mechanism/wizard/enter_reason.py 2017-11-03 10:59:21 +0000
3+++ bin/addons/delivery_mechanism/wizard/enter_reason.py 2018-01-17 15:53:13 +0000
4@@ -66,6 +66,8 @@
5 # set the reason
6 obj.write({'change_reason': change_reason}, context=context)
7
8+ if context.get('do_resource', False):
9+ self.pool.get('stock.move').write(cr, uid, [move.id for move in obj.move_lines], {'has_to_be_resourced': True}, context=context)
10 self.pool.get('stock.move').action_cancel(cr, uid, [move.id for move in obj.move_lines], context=context)
11
12 # cancel the IN
13
14=== modified file 'bin/addons/msf_outgoing/msf_outgoing.py'
15--- bin/addons/msf_outgoing/msf_outgoing.py 2017-12-14 17:30:55 +0000
16+++ bin/addons/msf_outgoing/msf_outgoing.py 2018-01-17 15:53:13 +0000
17@@ -5090,26 +5090,6 @@
18 signal = 'cancel_r' if resource else 'cancel'
19 wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.id, signal, cr)
20
21- not_done_moves = self.pool.get('stock.move').search(cr, uid, [
22- ('purchase_line_id', '=', move.purchase_line_id.id),
23- ('state', 'not in', ['cancel', 'cancel_r', 'done']),
24- ('picking_id.type', '=', 'in'),
25- ], context=context)
26- if (not not_done_moves) or all([x in ids for x in not_done_moves]):
27- # all in lines processed or will be processed for this po line
28- wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.id, 'done', cr)
29-
30- if move.purchase_line_id.is_line_split and move.purchase_line_id.original_line_id:
31- # check if the original PO line can be set to done
32- not_done_moves = self.pool.get('stock.move').search(cr, uid, [
33- ('purchase_line_id', '=', move.purchase_line_id.original_line_id.id),
34- ('state', 'not in', ['cancel', 'cancel_r', 'done']),
35- ('picking_id.type', '=', 'in'),
36- ], context=context)
37- if (not not_done_moves) or all([x in ids for x in not_done_moves]):
38- # all in lines processed or will be processed for this po line
39- wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.original_line_id.id, 'done', cr)
40-
41 sol_ids = pol_obj.get_sol_ids_from_pol_ids(cr, uid, [move.purchase_line_id.id], context=context)
42 for sol in sol_obj.browse(cr, uid, sol_ids, context=context):
43 # If the line will be sourced in another way, do not cancel the OUT move
44@@ -5133,6 +5113,26 @@
45 if out_move_id:
46 context.setdefault('not_resource_move', []).append(out_move_id)
47 self.action_cancel(cr, uid, [out_move_id], context=context)
48+
49+ not_done_moves = self.pool.get('stock.move').search(cr, uid, [
50+ ('purchase_line_id', '=', move.purchase_line_id.id),
51+ ('state', 'not in', ['cancel', 'cancel_r', 'done']),
52+ ('picking_id.type', '=', 'in'),
53+ ], context=context)
54+ if (not not_done_moves) or all([x in ids for x in not_done_moves]):
55+ # all in lines processed or will be processed for this po line
56+ wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.id, 'done', cr)
57+
58+ if move.purchase_line_id.is_line_split and move.purchase_line_id.original_line_id:
59+ # check if the original PO line can be set to done
60+ not_done_moves = self.pool.get('stock.move').search(cr, uid, [
61+ ('purchase_line_id', '=', move.purchase_line_id.original_line_id.id),
62+ ('state', 'not in', ['cancel', 'cancel_r', 'done']),
63+ ('picking_id.type', '=', 'in'),
64+ ], context=context)
65+ if (not not_done_moves) or all([x in ids for x in not_done_moves]):
66+ # all in lines processed or will be processed for this po line
67+ wf_service.trg_validate(uid, 'purchase.order.line', move.purchase_line_id.original_line_id.id, 'done', cr)
68
69 self.pool.get('purchase.order.line').update_fo_lines(cr, uid, [move.purchase_line_id.id], context=context)
70
71
72=== modified file 'bin/addons/sale/sale_workflow.py'
73--- bin/addons/sale/sale_workflow.py 2018-01-08 13:50:26 +0000
74+++ bin/addons/sale/sale_workflow.py 2018-01-17 15:53:13 +0000
75@@ -374,7 +374,9 @@
76 ], context=context)
77
78 if out_moves_to_cancel:
79+ context.update({'not_resource_move': out_moves_to_cancel})
80 self.pool.get('stock.move').action_cancel(cr, uid, out_moves_to_cancel, context=context)
81+ context.pop('not_resource_move')
82
83 return True
84

Subscribers

People subscribed via source and target branches