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

Proposed by Quentin THEURET @Amaris
Status: Merged
Merged at revision: 3636
Proposed branch: lp:~unifield-team/unifield-server/us-928
Merge into: lp:unifield-server
Diff against target: 126 lines (+35/-5)
4 files modified
bin/addons/msf_outgoing/msf_outgoing.py (+2/-0)
bin/addons/purchase_override/purchase.py (+9/-0)
bin/addons/sync_so/purchase.py (+8/-4)
bin/addons/sync_so/sale.py (+16/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-928
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+287663@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/msf_outgoing/msf_outgoing.py'
2--- bin/addons/msf_outgoing/msf_outgoing.py 2016-03-02 15:57:47 +0000
3+++ bin/addons/msf_outgoing/msf_outgoing.py 2016-03-03 11:06:15 +0000
4@@ -4232,6 +4232,8 @@
5
6 def _create_sync_message_for_field_order(self, cr, uid, picking, context=None):
7 fo_obj = self.pool.get('sale.order')
8+ rule_obj = self.pool.get('sync.client.message_rule')
9+ msg_to_send_obj = self.pool.get('sync.client.message_to_send')
10 if picking.sale_id:
11 return_info = {}
12 if picking.sale_id.original_so_id_sale_order:
13
14=== modified file 'bin/addons/purchase_override/purchase.py'
15--- bin/addons/purchase_override/purchase.py 2016-01-25 10:53:51 +0000
16+++ bin/addons/purchase_override/purchase.py 2016-03-03 11:06:15 +0000
17@@ -1373,6 +1373,7 @@
18 pol_obj = self.pool.get('purchase.order.line')
19 so_obj = self.pool.get('sale.order')
20 sol_obj = self.pool.get('sale.order.line')
21+ socl_obj = self.pool.get('sale.order.line.cancel')
22 move_obj = self.pool.get('stock.move')
23 proc_obj = self.pool.get('procurement.order')
24 pick_obj = self.pool.get('stock.picking')
25@@ -1401,6 +1402,7 @@
26 if sol_ids:
27 store_to_call += sol_ids
28
29+
30 sol = sol_obj.browse(cr, uid, sol_ids[0], context=context)
31 so = sol.order_id
32 # do not update Internal Requests with internal requestor location
33@@ -1435,6 +1437,13 @@
34 '|', ('order_id.id', '=', line.order_id.id), ('order_id.state', 'in', ['sourced', 'approved']),
35 ], context=context)
36 for opl in pol_obj.browse(cr, uid, other_po_lines, context=context):
37+ # Check if the other PO line will not be canceled
38+ socl_ids = socl_obj.search(cr, uid, [
39+ ('sync_order_line_db_id', '=', opl.sync_order_line_db_id),
40+ ], limit=1, order='NO_ORDER', context=context)
41+ if socl_ids:
42+ continue
43+
44 if opl.product_uom.id != line.product_uom.id:
45 line_qty += uom_obj._compute_qty(cr, uid, opl.product_uom.id, opl.product_qty, line.product_uom.id)
46 else:
47
48=== modified file 'bin/addons/sync_so/purchase.py'
49--- bin/addons/sync_so/purchase.py 2016-01-25 10:53:13 +0000
50+++ bin/addons/sync_so/purchase.py 2016-03-03 11:06:15 +0000
51@@ -548,7 +548,7 @@
52 if sol.procurement_id and sol.procurement_id.purchase_id:
53 self.pool.get('procurement.order').write(cr, uid, [sol.procurement_id.id], {'purchase_id': po_id}, context=context)
54 line_obj.write(cr, uid, [line.id], {'procurement_id': sol.procurement_id.id}, context=context)
55- netsvc.LocalService("workflow").trg_change_subflow(uid, 'procurement.order', [sol.procurement_id.id], 'purchase.order', [sol.procurement_id.purchase_id.id], po_id, cr)
56+ netsvc.LocalService("workflow").trg_change_subflow(uid, 'procurement.order', [sol.procurement_id.id], 'purchase.order', [po_id], po_id, cr)
57 if sol.order_id and (not sol.order_id.procurement_request or sol.order_id.location_requestor_id.usage == 'customer'):
58 self.write(cr, uid, [po_id], {'cross_docking_ok': True}, context=context)
59
60@@ -646,9 +646,13 @@
61 if partner_type in ['section', 'intermission'] and 'analytic_distribution_id' in header_result:
62 del header_result['analytic_distribution_id']
63
64- # UTP-661: Get the 'Cross Docking' value of the original PO, and add it into the split PO
65- header_result['cross_docking_ok'] = original_po['cross_docking_ok']
66- header_result['location_id'] = original_po.location_id.id
67+ if all(l.move_dest_id and l.move_dest_id.location_id.cross_docking_location_ok for l in original_po.order_line):
68+ header_result['cross_docking_ok'] = True
69+ header_result['location_id'] = self.pool.get('stock.location').get_cross_docking_location(cr, uid, context=context)
70+ else:
71+ # UTP-661: Get the 'Cross Docking' value of the original PO, and add it into the split PO
72+ header_result['cross_docking_ok'] = original_po['cross_docking_ok']
73+ header_result['location_id'] = original_po.location_id.id
74
75 default = {}
76 default.update(header_result)
77
78=== modified file 'bin/addons/sync_so/sale.py'
79--- bin/addons/sync_so/sale.py 2016-01-15 12:59:17 +0000
80+++ bin/addons/sync_so/sale.py 2016-03-03 11:06:15 +0000
81@@ -335,6 +335,8 @@
82 """
83 Generate sync. messages manually for the FOs in ids
84 """
85+ sol_obj = self.pool.get('sale.order.line')
86+ solc_obj = self.pool.get('sale.order.line.cancel')
87 rule_obj = self.pool.get('sync.client.message_rule')
88 msg_to_send_obj = self.pool.get('sync.client.message_to_send')
89
90@@ -368,16 +370,30 @@
91 }
92 return msg_to_send_obj.create(cr, uid, data, context=context)
93
94+ solccl_rule = rule_obj.get_rule_by_remote_call(cr, uid, 'sale.order.line.cancel.create_line', context=context)
95 nfo_rule = rule_obj.get_rule_by_remote_call(cr, uid, 'purchase.order.normal_fo_create_po', context=context)
96 vfo_rule = rule_obj.get_rule_by_remote_call(cr, uid, 'purchase.order.validated_fo_update_original_po', context=context)
97 csp_rule = rule_obj.get_rule_by_remote_call(cr, uid, 'purchase.order.create_split_po', context=context)
98
99+ solccl_model_obj = solccl_rule and self.pool.get(solccl_rule.model) or None
100 nfo_model_obj = nfo_rule and self.pool.get(nfo_rule.model) or None
101 vfo_model_obj = vfo_rule and self.pool.get(vfo_rule.model) or None
102 csp_model_obj = csp_rule and self.pool.get(csp_rule.model) or None
103
104 if original_id:
105 orig_partner_name = self.browse(cr, uid, original_id, context=context).partner_id.name
106+
107+ # Generate messages for cancel lines
108+ available_solc_ids = solc_obj.search(cr, uid, eval(solccl_rule.domain),
109+ order='NO_ORDER', context=context)
110+ for asolc in solc_obj.browse(cr, uid, available_solc_ids, context=context):
111+ sol_ids = sol_obj.search(cr, uid, [
112+ ('order_id', '=', original_id),
113+ ('sync_order_line_db_id', '=', asolc.resource_sync_line_db_id),
114+ ], context=context)
115+ if sol_ids:
116+ generate_msg_to_send(solccl_rule, solccl_model_obj, asolc.id, orig_partner_name)
117+
118 available_nfo_ids = self.search(cr, uid, eval(nfo_rule.domain),
119 order='NO_ORDER', context=context)
120 if nfo_model_obj and nfo_rule and original_id in available_nfo_ids:
121@@ -393,5 +409,4 @@
122
123 return
124
125-
126 sale_order_sync()

Subscribers

People subscribed via source and target branches

to all changes: