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

Proposed by jftempo
Status: Merged
Merged at revision: 5909
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/US-5037
Merge into: lp:unifield-server
Diff against target: 201 lines (+66/-11)
6 files modified
bin/addons/msf_profile/i18n/fr_MF.po (+3/-1)
bin/addons/procurement_request/procurement_request_view.xml (+1/-1)
bin/addons/purchase/purchase_workflow.py (+1/-0)
bin/addons/sale/sale_order.py (+31/-8)
bin/addons/sale/sale_view.xml (+29/-1)
bin/addons/sale/sale_workflow.py (+1/-0)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/US-5037
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+395322@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_profile/i18n/fr_MF.po'
2--- bin/addons/msf_profile/i18n/fr_MF.po 2020-11-12 16:19:32 +0000
3+++ bin/addons/msf_profile/i18n/fr_MF.po 2020-12-14 17:29:06 +0000
4@@ -71409,10 +71409,12 @@
5 msgid "No catalogue found !"
6 msgstr "Catalogue pas trouvé !"
7
8-#. module: purchase, purchase_override, msf_doc_import
9+#. modules: purchase, purchase_override, msf_doc_import, sale
10 #: field:purchase.order.merged.line,instance_sync_order_ref:0
11 #: field:purchase.order.line,instance_sync_order_ref:0
12 #: field:wizard.import.po.simulation.screen.line,imp_sync_order_ref:0
13+#: field:sale.order.line,instance_sync_order_ref:0
14+#: view:sync.order.label:0
15 msgid "Order in sync. instance"
16 msgstr "Commande en instance sync."
17
18
19=== modified file 'bin/addons/procurement_request/procurement_request_view.xml'
20--- bin/addons/procurement_request/procurement_request_view.xml 2020-11-02 08:28:49 +0000
21+++ bin/addons/procurement_request/procurement_request_view.xml 2020-12-14 17:29:06 +0000
22@@ -81,7 +81,7 @@
23 <field name="product_uom_qty" on_change="onchange_uom(product_id, product_uom, product_uom_qty)" />
24 <field name="original_changed" readonly="1"/>
25 <button name="button_view_changed" string="View Current/Original" type="object" icon="terp-stock_zoom"
26- attrs="{'invisible': [('original_qty', '=', False), ('modification_comment', '=', False)]}"/>
27+ attrs="{'invisible': [('original_qty', '=', False), ('modification_comment', '=', False), ('original_changed', '=', False)]}"/>
28 <field name="price_unit"/>
29 <field name="notes" />
30 <field name="display_resourced_orig_line" />
31
32=== modified file 'bin/addons/purchase/purchase_workflow.py'
33--- bin/addons/purchase/purchase_workflow.py 2020-10-13 16:37:22 +0000
34+++ bin/addons/purchase/purchase_workflow.py 2020-12-14 17:29:06 +0000
35@@ -347,6 +347,7 @@
36 'date_planned': pol.date_planned or (datetime.now() + relativedelta(days=+2)).strftime('%Y-%m-%d'),
37 'sync_sourced_origin': pol.instance_sync_order_ref and pol.instance_sync_order_ref.name or False,
38 'set_as_sourced_n': True,
39+ 'created_by_sync': True,
40 }
41
42 if pol.resourced_original_line:
43
44=== modified file 'bin/addons/sale/sale_order.py'
45--- bin/addons/sale/sale_order.py 2020-11-02 09:31:38 +0000
46+++ bin/addons/sale/sale_order.py 2020-12-14 17:29:06 +0000
47@@ -2133,6 +2133,7 @@
48 'ir_name_from_sync': fields.char(size=64, string='IR name to put on PO line after sync', invisible=True),
49 'counterpart_po_line_id': fields.many2one('purchase.order.line', 'PO line counterpart'),
50 'pol_external_ref': fields.function(_get_pol_external_ref, method=True, type='char', size=256, string="Linked PO line's External Ref.", store=False),
51+ 'instance_sync_order_ref': fields.many2one('sync.order.label', string='Order in sync. instance'),
52 }
53 _order = 'sequence, id desc'
54 _defaults = {
55@@ -2284,13 +2285,10 @@
56 'cancelled_by_sync': False,
57 })
58
59- if 'ir_name_from_sync' not in default:
60- default['ir_name_from_sync'] = False
61- if 'in_name_goods_return' not in default:
62- default['in_name_goods_return'] = False
63-
64- if 'counterpart_po_line_id' not in default:
65- default['counterpart_po_line_id'] = False
66+ reset_if_not_set = ['ir_name_from_sync', 'in_name_goods_return', 'counterpart_po_line_id', 'instance_sync_order_ref']
67+ for to_reset in reset_if_not_set:
68+ if to_reset not in default:
69+ default[to_reset] = False
70
71 return super(sale_order_line, self).copy(cr, uid, id, default, context)
72
73@@ -2331,7 +2329,12 @@
74 if context.get('from_button') and 'is_line_split' not in default:
75 default['is_line_split'] = False
76
77- for x in ['modification_comment', 'original_product', 'original_qty', 'original_price', 'original_uom', 'sync_linked_pol', 'resourced_original_line', 'ir_name_from_sync', 'in_name_goods_return', 'counterpart_po_line_id', 'from_cancel_out']:
78+ for x in [
79+ 'modification_comment', 'original_product', 'original_qty', 'original_price',
80+ 'original_uom', 'sync_linked_pol', 'resourced_original_line', 'ir_name_from_sync',
81+ 'in_name_goods_return', 'counterpart_po_line_id', 'from_cancel_out',
82+ 'instance_sync_order_ref', 'sync_sourced_origin'
83+ ]:
84 if x not in default:
85 default[x] = False
86
87@@ -3044,6 +3047,9 @@
88 '''
89 Add the database ID of the SO line to the value sync_order_line_db_id
90 '''
91+ if vals.get('instance_sync_order_ref'):
92+ vals['sync_sourced_origin'] = self.pool.get('sync.order.label').read(cr, uid, vals['instance_sync_order_ref'], ['name'])['name']
93+
94 so_line_ids = super(sale_order_line, self).create(cr, uid, vals, context=context)
95 if not vals.get('sync_order_line_db_id', False): # 'sync_order_line_db_id' not in vals or vals:
96 if vals.get('order_id', False):
97@@ -3071,6 +3077,9 @@
98 if context is None:
99 context = {}
100
101+ if isinstance(ids, (int, long)):
102+ ids = [ids]
103+
104 # UTP-392: fixed from the previous code: check if the sale order line contains the product, and not only from vals!
105 product_id = vals.get('product_id')
106 if context.get('sale_id', False):
107@@ -3090,6 +3099,10 @@
108 if not 'soq_updated' in vals:
109 vals['soq_updated'] = False
110
111+ if vals.get('instance_sync_order_ref'):
112+ if self.search_exists(cr, uid, [('id', 'in', ids), ('state', '=', 'draft'), ('sync_sourced_origin', '=', False)], context=context):
113+ vals['sync_sourced_origin'] = self.pool.get('sync.order.label').read(cr, uid, vals['instance_sync_order_ref'], ['name'])['name']
114+
115 res = super(sale_order_line, self).write(cr, uid, ids, vals, context=context)
116
117 if vals.get('stock_take_date'):
118@@ -3097,6 +3110,16 @@
119
120 return res
121
122+ def on_change_instance_sync_order_ref(self, cr, uid, ids, instance_sync_order_ref, context=None):
123+ if instance_sync_order_ref:
124+ return {'warning':
125+ {
126+ 'title': _('Warning'),
127+ 'message': _("Please ensure that you selected the correct Source document because once the line is saved you will not be able to edit this field anymore. In case of mistake, the only option will be to Cancel the line and Create a new one with the correct Source document."),
128+ }
129+ }
130+ return {}
131+
132 sale_order_line()
133
134
135
136=== modified file 'bin/addons/sale/sale_view.xml'
137--- bin/addons/sale/sale_view.xml 2020-11-02 08:28:49 +0000
138+++ bin/addons/sale/sale_view.xml 2020-12-14 17:29:06 +0000
139@@ -9,6 +9,29 @@
140 <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/>
141 <menuitem action="product.product_normal_action" id="product.menu_products" parent="base.menu_product" sequence="1"/>
142
143+
144+ <record id="sync_order_label_tree" model="ir.ui.view">
145+ <field name="name">sync.order.label.tree</field>
146+ <field name="model">sync.order.label</field>
147+ <field name="type">tree</field>
148+ <field name="arch" type="xml">
149+ <tree string="Order in sync. instance" hide_new_button="True" hide_delete_button="True">
150+ <field name="name"/>
151+ </tree>
152+ </field>
153+ </record>
154+
155+ <record id="sync_order_label_search" model="ir.ui.view">
156+ <field name="name">sync.order.label.search</field>
157+ <field name="model">sync.order.label</field>
158+ <field name="type">search</field>
159+ <field name="arch" type="xml">
160+ <search>
161+ <field name="name"/>
162+ </search>
163+ </field>
164+ </record>
165+
166 <record id="view_shop_form" model="ir.ui.view">
167 <field name="name">sale.shop</field>
168 <field name="model">sale.shop</field>
169@@ -189,7 +212,7 @@
170 <button name="add_multiple_lines" string="Add multiple lines" icon="gtk-add" colspan="4" type="object"/>
171 </group>
172 <field name="order_line" colspan="4" mode="tree,form,graph" nolabel="1" widget="one2many_list"
173- context="{'sale_id': active_id, 'pricelist_id': pricelist_id, 'categ': categ, 'partner_id': partner_id}"
174+ context="{'sale_id': active_id, 'pricelist_id': pricelist_id, 'categ': categ, 'partner_id': partner_id, 'fo_created_by_po_sync': fo_created_by_po_sync}"
175 on_change="order_line_change(order_line)"
176 filter_selector="[('Show all', []), ('Hide closed', [('state', 'not in', ['done', 'cancel', 'cancel_r'])]), ('Show closed only', [('state', '=', 'done')]), ('Hide cancelled', [('state', 'not in', ['cancel', 'cancel_r'])]), ('Show cancelled only', [('state', 'in', ['cancel', 'cancel_r'])])]"
177 default_selector="'3'" o2m_selectable="2"
178@@ -218,6 +241,11 @@
179 <field name="confirmed_delivery_date" attrs="{'readonly': [('so_state_stored', 'in', ('cancel','done'))]}"/>
180 <field name="stock_take_date"/>
181 <field name="display_resourced_orig_line"/>
182+ <field name="sync_linked_pol" invisible="True"/>
183+ <field name="sync_sourced_origin" invisible="True"/>
184+ <group invisible="not context.get('fo_created_by_po_sync')" colspan="2">
185+ <field name="instance_sync_order_ref" domain="[('order_id', '=', context.get('sale_id', 0))]" attrs="{'invisible': [('sync_linked_pol', '!=', False)], 'readonly': ['|', ('state', '!=', 'draft'), ('sync_sourced_origin', '!=', False)]}" on_change="on_change_instance_sync_order_ref(instance_sync_order_ref)"/>
186+ </group>
187 <separator colspan="4" string="Changes"/>
188 <group colspan="4">
189 <group colspan="2">
190
191=== modified file 'bin/addons/sale/sale_workflow.py'
192--- bin/addons/sale/sale_workflow.py 2020-09-24 14:14:45 +0000
193+++ bin/addons/sale/sale_workflow.py 2020-12-14 17:29:06 +0000
194@@ -188,6 +188,7 @@
195 'is_line_split': False,
196 'analytic_distribution_id': sol.analytic_distribution_id.id or False,
197 'ir_name_from_sync': sol.ir_name_from_sync or False,
198+ 'sync_sourced_origin': sol.sync_sourced_origin,
199 }
200 new_sol_id = self.copy(cr, uid, sol.id, sol_vals, context=context)
201 wf_service.trg_validate(uid, 'sale.order.line', new_sol_id, 'validated', cr)

Subscribers

People subscribed via source and target branches