Merge lp:~jfb-tempo-consulting/unifield-server/US-8436 into lp:unifield-server

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-8436
Merge into: lp:unifield-server
Diff against target: 135 lines (+35/-4)
7 files modified
bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv (+1/-1)
bin/addons/purchase/purchase_order.py (+3/-1)
bin/addons/purchase/purchase_order_line.py (+1/-0)
bin/addons/purchase/purchase_workflow.py (+3/-2)
bin/addons/sale/sale_order.py (+25/-0)
bin/addons/stock_override/stock.py (+1/-0)
bin/addons/sync_so/purchase.py (+1/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-8436
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+401168@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_sync_data_server/data/sync_server.message_rule.csv'
2--- bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv 2021-01-27 17:04:50 +0000
3+++ bin/addons/msf_sync_data_server/data/sync_server.message_rule.csv 2021-04-15 08:08:14 +0000
4@@ -6,7 +6,7 @@
5 msf_sync_data_server.fo_updates_po_ref,TRUE,TRUE,"['name','state','client_order_ref']","['&', '&','&','&', ('claim_name_goods_return', '=', False), ('partner_type','!=','external'),('client_order_ref','!=',False),('split_type_sale_order','=','original_sale_order'),'!',('client_order_ref', 'like', 'invalid_by_recovery')]",partner_id,MISSION,purchase.order.update_fo_ref,sale.order,FO updates PO ref,9,,Valid
6 msf_sync_data_server.update_in_ref,TRUE,TRUE,"['name','shipment_ref']","['&','&', ('partner_type_stock_picking', 'not in', ['esc', 'external']),('shipment_ref','!=',False),'!',('shipment_ref', 'like', 'invalid_by_recovery')]",partner_id,MISSION,stock.picking.update_in_ref,stock.picking,IN updates ref to OUT SHIP,10,,Valid
7 msf_sync_data_server.pol_create_sol,TRUE,TRUE,"['sync_local_id', 'order_id/name','product_id/id', 'product_id/name', 'name', 'state', 'product_qty', 'product_uom', 'price_unit', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','is_line_split','date_planned', 'stock_take_date', 'ir_name_for_sync']","[('sync_linked_sol', '=', False), ('order_id.partner_type', 'not in',['external','esc']), ('state', 'in', ['validated', 'confirmed', 'done']), ('order_id.state', 'not in', ['draft', 'draft_p', 'cancel'])]",partner_id,MISSION,sale.order.line.create_so_line,purchase.order.line,PO line creates FO line,11,,Valid
8-msf_sync_data_server.sol_updates_pol,TRUE,TRUE,"['resourced_original_line/id', 'resourced_original_remote_line','sync_sourced_origin', 'sync_local_id', 'sync_linked_pol', 'order_id/name', 'product_id/id', 'product_id/name', 'name', 'state','product_uom_qty', 'product_uom', 'price_unit', 'in_name_goods_return', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','date_planned','is_line_split', 'original_line_id/id', 'confirmed_delivery_date', 'stock_take_date', 'cancel_split_ok', 'modification_comment', 'from_cancel_out', 'pol_external_ref', 'dpo_line_id/.id', 'sync_pushed_from_po']","[('order_id.partner_type', '!=', 'external'), ('state', '!=', 'draft'), ('product_uom_qty', '!=', 0.0), '!', '&', ('order_id.fo_created_by_po_sync', '=', False), ('order_id.state', '=', 'draft'), '|', ('dpo_line_id', '=', False), ('state', '=', 'confirmed')]",partner_id,MISSION,purchase.order.line.sol_update_original_pol,sale.order.line,FO line updates PO line,12,"[('order_id.state', 'in', ['draft', 'draft_p']), ('order_id.partner_type', 'not in', ['external', 'esc']), ('order_id.client_order_ref', '=', False)]",Valid
9+msf_sync_data_server.sol_updates_pol,TRUE,TRUE,"['resourced_original_line/id', 'resourced_original_remote_line','sync_sourced_origin', 'sync_local_id', 'sync_linked_pol', 'order_id/name', 'product_id/id', 'product_id/name', 'name', 'state','product_uom_qty', 'product_uom', 'price_unit', 'in_name_goods_return', 'analytic_distribution_id/id','comment','have_analytic_distribution_from_header','line_number', 'nomen_manda_0/id','nomen_manda_1/id','nomen_manda_2/id','nomen_manda_3/id', 'nomenclature_description','notes','default_name','default_code','date_planned','is_line_split', 'original_line_id/id', 'confirmed_delivery_date', 'stock_take_date', 'cancel_split_ok', 'modification_comment', 'from_cancel_out', 'pol_external_ref', 'dpo_line_id/.id', 'dpo_id/.id', 'sync_pushed_from_po']","[('order_id.partner_type', '!=', 'external'), ('state', '!=', 'draft'), ('product_uom_qty', '!=', 0.0), '!', '&', ('order_id.fo_created_by_po_sync', '=', False), ('order_id.state', '=', 'draft'), '|', ('dpo_line_id', '=', False), ('state', '=', 'confirmed')]",partner_id,MISSION,purchase.order.line.sol_update_original_pol,sale.order.line,FO line updates PO line,12,"[('order_id.state', 'in', ['draft', 'draft_p']), ('order_id.partner_type', 'not in', ['external', 'esc']), ('order_id.client_order_ref', '=', False)]",Valid
10 msf_sync_data_server.pol_update_date_expected,TRUE,TRUE,"['sync_local_id', 'sync_linked_pol']","[('id', '=', 0)]",partner_id,MISSION,purchase.order.line.update_date_expected,sale.order.line,Update IN expected date,55,,Valid
11 msf_sync_data_server.partial_shipped_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'previous_step_id/name', 'state', 'origin', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'claim', 'packing_list', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_id/default_code', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/prodlot_id/type', 'move_lines/prodlot_id/comment', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/location_dest_id/usage', 'move_lines/comment', 'move_lines/sale_line_id/id', 'move_lines/sale_line_id/in_name_goods_return', 'move_lines/from_pack', 'move_lines/to_pack', 'move_lines/weight', 'move_lines/height', 'move_lines/length', 'move_lines/width', 'sale_id/claim_name_goods_return', 'sale_id/client_order_ref']","['&','&','&','&','&',('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['standard', 'packing']), ('state', 'in', ['done', 'delivered']), ('already_shipped', '=', True), ('do_not_sync', '=', False)]",partner_id,MISSION,stock.picking.partial_shipped_fo_updates_in_po,stock.picking,Partial shipped at Coordo updates IN at Project,19,,Valid
12 msf_sync_data_server.moves_from_dpo_closed_coordo_updates_in_at_project,TRUE,TRUE,"['name', 'state', 'origin', 'subtype', 'partner_type_stock_picking', 'shipment_id/name', 'min_date', 'note', 'move_lines/processed_stock_move', 'move_lines/id', 'move_lines/state','move_lines/original_qty_partial', 'move_lines/line_number', 'move_lines/name', 'move_lines/change_reason', 'move_lines/product_id/id', 'move_lines/product_id/name', 'move_lines/product_id/default_code', 'move_lines/product_qty', 'move_lines/prodlot_id/id','move_lines/prodlot_id/name','move_lines/prodlot_id/life_date', 'move_lines/prodlot_id/type', 'move_lines/prodlot_id/comment', 'move_lines/expired_date', 'move_lines/asset_id/id','move_lines/product_uom/id', 'move_lines/product_uom/name', 'move_lines/date', 'move_lines/date_expected', 'move_lines/note', 'move_lines/dpo_line_id', 'move_lines/comment']","['&', '&', '&', '&', ('partner_type_stock_picking', '!=', 'external'), ('type', '=', 'out'), ('subtype', 'in', ['picking', 'standard']), ('dpo_out', '=', True), ('new_dpo_out', '=', False)]",partner_id,MISSION,stock.picking.partial_shippped_dpo_updates_in_po,stock.picking,Moves from DPO closed at Coordo updates IN at Project,20,,Valid
13
14=== modified file 'bin/addons/purchase/purchase_order.py'
15--- bin/addons/purchase/purchase_order.py 2021-02-11 16:46:52 +0000
16+++ bin/addons/purchase/purchase_order.py 2021-04-15 08:08:14 +0000
17@@ -2311,7 +2311,7 @@
18 reason_type_id = get_reference('reason_type_in_kind_donation')
19 return reason_type_id
20
21- def create_picking(self, cr, uid, order, context=None, sourced_on_dpo=False):
22+ def create_picking(self, cr, uid, order, context=None, sourced_on_dpo=False, sourced_dpo_id=False):
23 if context is None:
24 context = {}
25
26@@ -2331,6 +2331,8 @@
27
28 if sourced_on_dpo:
29 values['dpo_incoming'] = True
30+ if sourced_dpo_id:
31+ values['dpo_id_incoming'] = sourced_dpo_id
32 reason_type_id = self.get_reason_type_id(cr, uid, order, context)
33 if reason_type_id:
34 values.update({'reason_type_id': reason_type_id})
35
36=== modified file 'bin/addons/purchase/purchase_order_line.py'
37--- bin/addons/purchase/purchase_order_line.py 2021-02-02 10:20:51 +0000
38+++ bin/addons/purchase/purchase_order_line.py 2021-04-15 08:08:14 +0000
39@@ -586,6 +586,7 @@
40 'ir_name_for_sync': fields.function(_get_customer_ref, type='char', size=64, string='IR/FO name to put on PO line after sync', multi='custo_ref_ir_name', method=1),
41 'in_qty_remaining': fields.function(_in_qty_remaining, type='float', string='Qty remaining on IN', method=1),
42 'from_dpo_line_id': fields.integer('DPO line id on the remote', internal=1),
43+ 'from_dpo_id': fields.integer('DPO id on the remote', internal=1),
44 }
45
46 _defaults = {
47
48=== modified file 'bin/addons/purchase/purchase_workflow.py'
49--- bin/addons/purchase/purchase_workflow.py 2021-02-24 09:28:37 +0000
50+++ bin/addons/purchase/purchase_workflow.py 2021-04-15 08:08:14 +0000
51@@ -759,7 +759,8 @@
52 ('purchase_id', '=', pol.order_id.id),
53 ('state', '=', 'shipped'),
54 ('type', '=', 'in'),
55- ('dpo_incoming', '=', True)
56+ ('dpo_incoming', '=', True),
57+ ('dpo_id_incoming', '=', pol.from_dpo_id),
58 ]
59 else:
60 in_domain = [
61@@ -770,7 +771,7 @@
62 in_id = self.pool.get('stock.picking').search(cr, uid, in_domain)
63 created = False
64 if not in_id:
65- in_id = self.pool.get('purchase.order').create_picking(cr, uid, pol.order_id, context, sourced_on_dpo)
66+ in_id = self.pool.get('purchase.order').create_picking(cr, uid, pol.order_id, context, sourced_on_dpo, pol.from_dpo_id)
67 in_id = [in_id]
68 created = True
69 incoming_move_id = self.pool.get('purchase.order').create_new_incoming_line(cr, uid, in_id[0], pol, context)
70
71=== modified file 'bin/addons/sale/sale_order.py'
72--- bin/addons/sale/sale_order.py 2021-01-27 17:04:50 +0000
73+++ bin/addons/sale/sale_order.py 2021-04-15 08:08:14 +0000
74@@ -2048,6 +2048,30 @@
75
76 return res
77
78+ def _get_dpo_id(self, cr, uid, ids, name, arg, context=None):
79+ if context is None:
80+ context = {}
81+ if not ids:
82+ return []
83+
84+ ret = {}
85+ for _id in ids:
86+ ret[_id] = False
87+
88+ cr.execute('''
89+ select sol.id, pol.order_id
90+ from
91+ sale_order_line sol
92+ left join
93+ purchase_order_line pol on pol.linked_sol_id = sol.id
94+ where
95+ sol.id in %s
96+ ''', (tuple(ids),))
97+ for x in cr.fetchall():
98+ ret[x[0]] = x[1]
99+ return ret
100+
101+
102 _max_value = 10**10
103 _max_msg = _('The Total amount of the line is more than 10 digits. Please check that the Qty and Unit price are correct to avoid loss of exact information')
104 _name = 'sale.order.line'
105@@ -2110,6 +2134,7 @@
106 'created_by_rfq': fields.many2one('purchase.order', string='Created by RfQ'),
107 'created_by_rfq_line': fields.many2one('purchase.order.line', string='Created by RfQ line'),
108 'dpo_line_id': fields.many2one('purchase.order.line', string='DPO line'),
109+ 'dpo_id': fields.function(_get_dpo_id, method=True, type='many2one', relation='purchase.order', string='DPO'),
110 'sync_sourced_origin': fields.char(string='Sync. Origin', size=256),
111 'cancel_split_ok': fields.float(
112 digits=(16,2),
113
114=== modified file 'bin/addons/stock_override/stock.py'
115--- bin/addons/stock_override/stock.py 2021-02-16 11:25:47 +0000
116+++ bin/addons/stock_override/stock.py 2021-04-15 08:08:14 +0000
117@@ -216,6 +216,7 @@
118 'state_before_import': fields.char(size=64, string='State before import', readonly=True),
119 'is_esc': fields.function(_get_is_esc, method=True, string='ESC Partner ?', type='boolean', store=False),
120 'dpo_incoming': fields.boolean(string='DPO Incoming'),
121+ 'dpo_id_incoming': fields.integer(string='Id of remote DPO', internal=1, select=1),
122 'dpo_out': fields.boolean('DPO Out'),
123 'new_dpo_out': fields.boolean('DPO Out (new flow)'),
124 'previous_chained_pick_id': fields.many2one('stock.picking', string='Previous chained picking', ondelete='set null', readonly=True),
125
126=== modified file 'bin/addons/sync_so/purchase.py'
127--- bin/addons/sync_so/purchase.py 2021-01-27 17:04:50 +0000
128+++ bin/addons/sync_so/purchase.py 2021-04-15 08:08:14 +0000
129@@ -124,6 +124,7 @@
130 pol_values['sync_linked_sol'] = sol_dict['sync_local_id']
131 pol_values['modification_comment'] = sol_dict.get('modification_comment', False)
132 pol_values['from_dpo_line_id'] = sol_dict.get('dpo_line_id') and sol_dict.get('dpo_line_id', {}).get('.id', False) or False
133+ pol_values['from_dpo_id'] = sol_dict.get('dpo_id') and sol_dict.get('dpo_id', {}).get('.id', False) or False
134 if 'line_number' in pol_values:
135 del(pol_values['line_number'])
136

Subscribers

People subscribed via source and target branches