Merge lp:~jfb-tempo-consulting/unifield-server/US-5037 into lp:unifield-server
- US-5037
- Merge into trunk
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 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email:
|
Commit message
Description of the change
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 | 71409 | msgid "No catalogue found !" | 71409 | msgid "No catalogue found !" |
6 | 71410 | msgstr "Catalogue pas trouvé !" | 71410 | msgstr "Catalogue pas trouvé !" |
7 | 71411 | 71411 | ||
9 | 71412 | #. module: purchase, purchase_override, msf_doc_import | 71412 | #. modules: purchase, purchase_override, msf_doc_import, sale |
10 | 71413 | #: field:purchase.order.merged.line,instance_sync_order_ref:0 | 71413 | #: field:purchase.order.merged.line,instance_sync_order_ref:0 |
11 | 71414 | #: field:purchase.order.line,instance_sync_order_ref:0 | 71414 | #: field:purchase.order.line,instance_sync_order_ref:0 |
12 | 71415 | #: field:wizard.import.po.simulation.screen.line,imp_sync_order_ref:0 | 71415 | #: field:wizard.import.po.simulation.screen.line,imp_sync_order_ref:0 |
13 | 71416 | #: field:sale.order.line,instance_sync_order_ref:0 | ||
14 | 71417 | #: view:sync.order.label:0 | ||
15 | 71416 | msgid "Order in sync. instance" | 71418 | msgid "Order in sync. instance" |
16 | 71417 | msgstr "Commande en instance sync." | 71419 | msgstr "Commande en instance sync." |
17 | 71418 | 71420 | ||
18 | 71419 | 71421 | ||
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 | 81 | <field name="product_uom_qty" on_change="onchange_uom(product_id, product_uom, product_uom_qty)" /> | 81 | <field name="product_uom_qty" on_change="onchange_uom(product_id, product_uom, product_uom_qty)" /> |
24 | 82 | <field name="original_changed" readonly="1"/> | 82 | <field name="original_changed" readonly="1"/> |
25 | 83 | <button name="button_view_changed" string="View Current/Original" type="object" icon="terp-stock_zoom" | 83 | <button name="button_view_changed" string="View Current/Original" type="object" icon="terp-stock_zoom" |
27 | 84 | attrs="{'invisible': [('original_qty', '=', False), ('modification_comment', '=', False)]}"/> | 84 | attrs="{'invisible': [('original_qty', '=', False), ('modification_comment', '=', False), ('original_changed', '=', False)]}"/> |
28 | 85 | <field name="price_unit"/> | 85 | <field name="price_unit"/> |
29 | 86 | <field name="notes" /> | 86 | <field name="notes" /> |
30 | 87 | <field name="display_resourced_orig_line" /> | 87 | <field name="display_resourced_orig_line" /> |
31 | 88 | 88 | ||
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 | 347 | 'date_planned': pol.date_planned or (datetime.now() + relativedelta(days=+2)).strftime('%Y-%m-%d'), | 347 | 'date_planned': pol.date_planned or (datetime.now() + relativedelta(days=+2)).strftime('%Y-%m-%d'), |
37 | 348 | 'sync_sourced_origin': pol.instance_sync_order_ref and pol.instance_sync_order_ref.name or False, | 348 | 'sync_sourced_origin': pol.instance_sync_order_ref and pol.instance_sync_order_ref.name or False, |
38 | 349 | 'set_as_sourced_n': True, | 349 | 'set_as_sourced_n': True, |
39 | 350 | 'created_by_sync': True, | ||
40 | 350 | } | 351 | } |
41 | 351 | 352 | ||
42 | 352 | if pol.resourced_original_line: | 353 | if pol.resourced_original_line: |
43 | 353 | 354 | ||
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 | 2133 | 'ir_name_from_sync': fields.char(size=64, string='IR name to put on PO line after sync', invisible=True), | 2133 | 'ir_name_from_sync': fields.char(size=64, string='IR name to put on PO line after sync', invisible=True), |
49 | 2134 | 'counterpart_po_line_id': fields.many2one('purchase.order.line', 'PO line counterpart'), | 2134 | 'counterpart_po_line_id': fields.many2one('purchase.order.line', 'PO line counterpart'), |
50 | 2135 | 'pol_external_ref': fields.function(_get_pol_external_ref, method=True, type='char', size=256, string="Linked PO line's External Ref.", store=False), | 2135 | '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 | 2136 | 'instance_sync_order_ref': fields.many2one('sync.order.label', string='Order in sync. instance'), | ||
52 | 2136 | } | 2137 | } |
53 | 2137 | _order = 'sequence, id desc' | 2138 | _order = 'sequence, id desc' |
54 | 2138 | _defaults = { | 2139 | _defaults = { |
55 | @@ -2284,13 +2285,10 @@ | |||
56 | 2284 | 'cancelled_by_sync': False, | 2285 | 'cancelled_by_sync': False, |
57 | 2285 | }) | 2286 | }) |
58 | 2286 | 2287 | ||
66 | 2287 | if 'ir_name_from_sync' not in default: | 2288 | reset_if_not_set = ['ir_name_from_sync', 'in_name_goods_return', 'counterpart_po_line_id', 'instance_sync_order_ref'] |
67 | 2288 | default['ir_name_from_sync'] = False | 2289 | for to_reset in reset_if_not_set: |
68 | 2289 | if 'in_name_goods_return' not in default: | 2290 | if to_reset not in default: |
69 | 2290 | default['in_name_goods_return'] = False | 2291 | default[to_reset] = False |
63 | 2291 | |||
64 | 2292 | if 'counterpart_po_line_id' not in default: | ||
65 | 2293 | default['counterpart_po_line_id'] = False | ||
70 | 2294 | 2292 | ||
71 | 2295 | return super(sale_order_line, self).copy(cr, uid, id, default, context) | 2293 | return super(sale_order_line, self).copy(cr, uid, id, default, context) |
72 | 2296 | 2294 | ||
73 | @@ -2331,7 +2329,12 @@ | |||
74 | 2331 | if context.get('from_button') and 'is_line_split' not in default: | 2329 | if context.get('from_button') and 'is_line_split' not in default: |
75 | 2332 | default['is_line_split'] = False | 2330 | default['is_line_split'] = False |
76 | 2333 | 2331 | ||
78 | 2334 | 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']: | 2332 | for x in [ |
79 | 2333 | 'modification_comment', 'original_product', 'original_qty', 'original_price', | ||
80 | 2334 | 'original_uom', 'sync_linked_pol', 'resourced_original_line', 'ir_name_from_sync', | ||
81 | 2335 | 'in_name_goods_return', 'counterpart_po_line_id', 'from_cancel_out', | ||
82 | 2336 | 'instance_sync_order_ref', 'sync_sourced_origin' | ||
83 | 2337 | ]: | ||
84 | 2335 | if x not in default: | 2338 | if x not in default: |
85 | 2336 | default[x] = False | 2339 | default[x] = False |
86 | 2337 | 2340 | ||
87 | @@ -3044,6 +3047,9 @@ | |||
88 | 3044 | ''' | 3047 | ''' |
89 | 3045 | Add the database ID of the SO line to the value sync_order_line_db_id | 3048 | Add the database ID of the SO line to the value sync_order_line_db_id |
90 | 3046 | ''' | 3049 | ''' |
91 | 3050 | if vals.get('instance_sync_order_ref'): | ||
92 | 3051 | vals['sync_sourced_origin'] = self.pool.get('sync.order.label').read(cr, uid, vals['instance_sync_order_ref'], ['name'])['name'] | ||
93 | 3052 | |||
94 | 3047 | so_line_ids = super(sale_order_line, self).create(cr, uid, vals, context=context) | 3053 | so_line_ids = super(sale_order_line, self).create(cr, uid, vals, context=context) |
95 | 3048 | if not vals.get('sync_order_line_db_id', False): # 'sync_order_line_db_id' not in vals or vals: | 3054 | if not vals.get('sync_order_line_db_id', False): # 'sync_order_line_db_id' not in vals or vals: |
96 | 3049 | if vals.get('order_id', False): | 3055 | if vals.get('order_id', False): |
97 | @@ -3071,6 +3077,9 @@ | |||
98 | 3071 | if context is None: | 3077 | if context is None: |
99 | 3072 | context = {} | 3078 | context = {} |
100 | 3073 | 3079 | ||
101 | 3080 | if isinstance(ids, (int, long)): | ||
102 | 3081 | ids = [ids] | ||
103 | 3082 | |||
104 | 3074 | # UTP-392: fixed from the previous code: check if the sale order line contains the product, and not only from vals! | 3083 | # UTP-392: fixed from the previous code: check if the sale order line contains the product, and not only from vals! |
105 | 3075 | product_id = vals.get('product_id') | 3084 | product_id = vals.get('product_id') |
106 | 3076 | if context.get('sale_id', False): | 3085 | if context.get('sale_id', False): |
107 | @@ -3090,6 +3099,10 @@ | |||
108 | 3090 | if not 'soq_updated' in vals: | 3099 | if not 'soq_updated' in vals: |
109 | 3091 | vals['soq_updated'] = False | 3100 | vals['soq_updated'] = False |
110 | 3092 | 3101 | ||
111 | 3102 | if vals.get('instance_sync_order_ref'): | ||
112 | 3103 | if self.search_exists(cr, uid, [('id', 'in', ids), ('state', '=', 'draft'), ('sync_sourced_origin', '=', False)], context=context): | ||
113 | 3104 | vals['sync_sourced_origin'] = self.pool.get('sync.order.label').read(cr, uid, vals['instance_sync_order_ref'], ['name'])['name'] | ||
114 | 3105 | |||
115 | 3093 | res = super(sale_order_line, self).write(cr, uid, ids, vals, context=context) | 3106 | res = super(sale_order_line, self).write(cr, uid, ids, vals, context=context) |
116 | 3094 | 3107 | ||
117 | 3095 | if vals.get('stock_take_date'): | 3108 | if vals.get('stock_take_date'): |
118 | @@ -3097,6 +3110,16 @@ | |||
119 | 3097 | 3110 | ||
120 | 3098 | return res | 3111 | return res |
121 | 3099 | 3112 | ||
122 | 3113 | def on_change_instance_sync_order_ref(self, cr, uid, ids, instance_sync_order_ref, context=None): | ||
123 | 3114 | if instance_sync_order_ref: | ||
124 | 3115 | return {'warning': | ||
125 | 3116 | { | ||
126 | 3117 | 'title': _('Warning'), | ||
127 | 3118 | '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 | 3119 | } | ||
129 | 3120 | } | ||
130 | 3121 | return {} | ||
131 | 3122 | |||
132 | 3100 | sale_order_line() | 3123 | sale_order_line() |
133 | 3101 | 3124 | ||
134 | 3102 | 3125 | ||
135 | 3103 | 3126 | ||
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 | 9 | <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/> | 9 | <menuitem id="base.menu_product" name="Products" parent="base.menu_base_partner" sequence="9"/> |
141 | 10 | <menuitem action="product.product_normal_action" id="product.menu_products" parent="base.menu_product" sequence="1"/> | 10 | <menuitem action="product.product_normal_action" id="product.menu_products" parent="base.menu_product" sequence="1"/> |
142 | 11 | 11 | ||
143 | 12 | |||
144 | 13 | <record id="sync_order_label_tree" model="ir.ui.view"> | ||
145 | 14 | <field name="name">sync.order.label.tree</field> | ||
146 | 15 | <field name="model">sync.order.label</field> | ||
147 | 16 | <field name="type">tree</field> | ||
148 | 17 | <field name="arch" type="xml"> | ||
149 | 18 | <tree string="Order in sync. instance" hide_new_button="True" hide_delete_button="True"> | ||
150 | 19 | <field name="name"/> | ||
151 | 20 | </tree> | ||
152 | 21 | </field> | ||
153 | 22 | </record> | ||
154 | 23 | |||
155 | 24 | <record id="sync_order_label_search" model="ir.ui.view"> | ||
156 | 25 | <field name="name">sync.order.label.search</field> | ||
157 | 26 | <field name="model">sync.order.label</field> | ||
158 | 27 | <field name="type">search</field> | ||
159 | 28 | <field name="arch" type="xml"> | ||
160 | 29 | <search> | ||
161 | 30 | <field name="name"/> | ||
162 | 31 | </search> | ||
163 | 32 | </field> | ||
164 | 33 | </record> | ||
165 | 34 | |||
166 | 12 | <record id="view_shop_form" model="ir.ui.view"> | 35 | <record id="view_shop_form" model="ir.ui.view"> |
167 | 13 | <field name="name">sale.shop</field> | 36 | <field name="name">sale.shop</field> |
168 | 14 | <field name="model">sale.shop</field> | 37 | <field name="model">sale.shop</field> |
169 | @@ -189,7 +212,7 @@ | |||
170 | 189 | <button name="add_multiple_lines" string="Add multiple lines" icon="gtk-add" colspan="4" type="object"/> | 212 | <button name="add_multiple_lines" string="Add multiple lines" icon="gtk-add" colspan="4" type="object"/> |
171 | 190 | </group> | 213 | </group> |
172 | 191 | <field name="order_line" colspan="4" mode="tree,form,graph" nolabel="1" widget="one2many_list" | 214 | <field name="order_line" colspan="4" mode="tree,form,graph" nolabel="1" widget="one2many_list" |
174 | 192 | context="{'sale_id': active_id, 'pricelist_id': pricelist_id, 'categ': categ, 'partner_id': partner_id}" | 215 | 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 | 193 | on_change="order_line_change(order_line)" | 216 | on_change="order_line_change(order_line)" |
176 | 194 | 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'])])]" | 217 | 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 | 195 | default_selector="'3'" o2m_selectable="2" | 218 | default_selector="'3'" o2m_selectable="2" |
178 | @@ -218,6 +241,11 @@ | |||
179 | 218 | <field name="confirmed_delivery_date" attrs="{'readonly': [('so_state_stored', 'in', ('cancel','done'))]}"/> | 241 | <field name="confirmed_delivery_date" attrs="{'readonly': [('so_state_stored', 'in', ('cancel','done'))]}"/> |
180 | 219 | <field name="stock_take_date"/> | 242 | <field name="stock_take_date"/> |
181 | 220 | <field name="display_resourced_orig_line"/> | 243 | <field name="display_resourced_orig_line"/> |
182 | 244 | <field name="sync_linked_pol" invisible="True"/> | ||
183 | 245 | <field name="sync_sourced_origin" invisible="True"/> | ||
184 | 246 | <group invisible="not context.get('fo_created_by_po_sync')" colspan="2"> | ||
185 | 247 | <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 | 248 | </group> | ||
187 | 221 | <separator colspan="4" string="Changes"/> | 249 | <separator colspan="4" string="Changes"/> |
188 | 222 | <group colspan="4"> | 250 | <group colspan="4"> |
189 | 223 | <group colspan="2"> | 251 | <group colspan="2"> |
190 | 224 | 252 | ||
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 | 188 | 'is_line_split': False, | 188 | 'is_line_split': False, |
196 | 189 | 'analytic_distribution_id': sol.analytic_distribution_id.id or False, | 189 | 'analytic_distribution_id': sol.analytic_distribution_id.id or False, |
197 | 190 | 'ir_name_from_sync': sol.ir_name_from_sync or False, | 190 | 'ir_name_from_sync': sol.ir_name_from_sync or False, |
198 | 191 | 'sync_sourced_origin': sol.sync_sourced_origin, | ||
199 | 191 | } | 192 | } |
200 | 192 | new_sol_id = self.copy(cr, uid, sol.id, sol_vals, context=context) | 193 | new_sol_id = self.copy(cr, uid, sol.id, sol_vals, context=context) |
201 | 193 | wf_service.trg_validate(uid, 'sale.order.line', new_sol_id, 'validated', cr) | 194 | wf_service.trg_validate(uid, 'sale.order.line', new_sol_id, 'validated', cr) |