Merge lp:~dorian-kemps/unifield-server/US-11792 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 6566
Proposed branch: lp:~dorian-kemps/unifield-server/US-11792
Merge into: lp:unifield-server
Diff against target: 471 lines (+71/-215)
3 files modified
bin/addons/msf_profile/i18n/fr_MF.po (+22/-30)
bin/addons/stock_override/stock.py (+25/-132)
bin/addons/stock_override/stock_view.xml (+24/-53)
To merge this branch: bzr merge lp:~dorian-kemps/unifield-server/US-11792
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+454244@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 2023-08-16 09:21:58 +0000
3+++ bin/addons/msf_profile/i18n/fr_MF.po 2023-10-23 07:51:07 +0000
4@@ -4859,8 +4859,6 @@
5
6 #. module: stock_override
7 #: view:stock.move.cancel.wizard:0
8-#: view:stock.move.cancel.more.wizard:0
9-#: view:stock.picking.cancel.more.wizard:0
10 #: view:stock.picking.cancel.wizard:0
11 msgid "Cancel Only"
12 msgstr "Annuler Seulement"
13@@ -9752,10 +9750,16 @@
14
15 #. module: stock_override
16 #: view:stock.picking.cancel.wizard:0
17-#: view:stock.picking.cancel.more.wizard:0
18+#: code:addons/stock_override/stock.py:723
19 msgid "Cancel Picking"
20 msgstr "Annuler Picking"
21
22+#. module: stock_override
23+#: code:addons/stock_override/stock.py:725
24+#, python-format
25+msgid "Cancel OUT"
26+msgstr "Annuler Livraison OUT"
27+
28 #. module: analytic_distribution
29 #: selection:account.commitment,type:0
30 #: selection:account.commitment.line,commit_type:0
31@@ -69554,7 +69558,6 @@
32 #: field:allocation.stock.setup,error_sm_central_ids:0
33 #: field:allocation.stock.setup,error_sm_cross_ids:0
34 #: view:stock.move:0
35-#: field:stock.picking.cancel.more.wizard,picking_id:0
36 #: view:change.dest.location:0
37 msgid "Picking"
38 msgstr "Picking"
39@@ -80191,7 +80194,6 @@
40
41 #. module: stock_override
42 #: view:stock.move.cancel.wizard:0
43-#: view:stock.move.cancel.more.wizard:0
44 msgid "Cancel move"
45 msgstr "Annuler le mouvement"
46
47@@ -84193,7 +84195,6 @@
48 #: field:stock.certificate.valuation,move_id:0
49 #: field:purchase.order.followup.line,move_id:0
50 #: field:report.stock.move,move:0
51-#: field:stock.move.cancel.more.wizard,move_id:0
52 #: field:change.dest.location,picking_id:0
53 #: field:return.ppl.move.processor,move_id:0
54 msgid "Move"
55@@ -91628,8 +91629,6 @@
56 #: view:reserved.products.wizard:0
57 #: view:stock.expired.damaged.report:0
58 #: view:stock.reception.wizard:0
59-#: view:stock.move.cancel.more.wizard:0
60-#: view:stock.picking.cancel.more.wizard:0
61 #: view:product.ask.activate.wizard:0
62 #: view:wizard.cancel.lines:0
63 #: view:shipment.add.pack.processor:0
64@@ -102646,14 +102645,14 @@
65 msgstr "Le %s id:%s (%s) a été annulé."
66
67 #. module: stock_override
68-#: view:stock.move.cancel.more.wizard:0
69-#: view:stock.picking.cancel.more.wizard:0
70+#: view:stock.move.cancel.wizard:0
71+#: view:stock.picking.cancel.wizard:0
72 msgid "Do not cancel"
73 msgstr "Ne pas annuler"
74
75 #. module: stock_override
76-#: view:stock.move.cancel.more.wizard:0
77-#: view:stock.picking.cancel.more.wizard:0
78+#: view:stock.move.cancel.wizard:0
79+#: view:stock.picking.cancel.wizard:0
80 msgid "Cancel & create Internal Move"
81 msgstr "Annuler & créer un Mouvement Interne"
82
83@@ -102679,26 +102678,14 @@
84 msgstr "RAPPORT DU STOCK NON ALLOUÉ"
85
86 #. module: stock_override
87-#: view:stock.picking.cancel.more.wizard:0
88-msgid "\n"
89-" Cancelling these moves might result in unreserved stock.<br/>\n"
90-" Do you want to create an Internal Move or update the existing one to reallocate the quantities ?\n"
91-" "
92-msgstr "\n"
93-" Annuler ces mouvements peut générer du stock non alloué.<br/>\n"
94-" Voulez-vous créer un Mouvement Interne ou mettre à jour l'existant pour réattribuer les quantités ?\n"
95-" "
96+#: view:stock.picking.cancel.wizard:0
97+msgid "Cancelling these moves might result in unreserved stock. Do you want to create an Internal Move or update the existing one to reallocate the quantities ?"
98+msgstr "Annuler ces mouvements peut générer du stock non alloué. Voulez-vous créer un Mouvement Interne ou mettre à jour l'existant pour réattribuer les quantités ?"
99
100 #. module: stock_override
101-#: view:stock.move.cancel.more.wizard:0
102-msgid "\n"
103-" Cancelling this move might result in unreserved stock.<br/>\n"
104-" Do you want to create an Internal Move or update the existing one to reallocate the quantities ?\n"
105-" "
106-msgstr "\n"
107-" Annuler ce mouvement peut générer du stock non alloué.<br/>\n"
108-" Voulez-vous créer un Mouvement Interne ou mettre à jour l'existant pour réattribuer les quantités ?\n"
109-" "
110+#: view:stock.move.cancel.wizard:0
111+msgid "Cancelling this move might result in unreserved stock. Do you want to create an Internal Move or update the existing one to reallocate the quantities ?"
112+msgstr "Annuler ce mouvement peut générer du stock non alloué. Voulez-vous créer un Mouvement Interne ou mettre à jour l'existant pour réattribuer les quantités ?"
113
114 #. module: stock
115 #: report:addons/stock/report/unreserved_stock_report_xls.mako:84
116@@ -103346,6 +103333,11 @@
117
118 #. module: stock_override
119 #: view:stock.picking.cancel.wizard:0
120+msgid "If you click on 'Cancel & Resource' button, all lines of this Picking attached to a Field order or an Internal Request will be re-sourced. All lines or quantities already processed wouldn't be re-sourced."
121+msgstr "Si vous cliquez sur 'Annuler & Réallouer', toutes les lignes du Bon de Picking attachées à une CdT ou à une Demande Interne seront re-sourcées. Les quantités et les lignes déjà traitées ne seront pas impactées."
122+
123+#. module: stock_override
124+#: view:stock.picking.cancel.wizard:0
125 msgid "If you click on 'Cancel & Resource' button, all lines of this delivery OUT attached to a Field order or an Internal Request will be re-sourced. All lines or quantities already processed wouldn't be re-sourced."
126 msgstr "Si vous cliquez sur 'Annuler & Réallouer', toutes les lignes du Bon de Livraison attachées à une CdT ou à une Demande Interne seront re-sourcées. Les quantités et les lignes déjà traitées ne seront pas impactées."
127
128
129=== modified file 'bin/addons/stock_override/stock.py'
130--- bin/addons/stock_override/stock.py 2023-07-24 15:36:24 +0000
131+++ bin/addons/stock_override/stock.py 2023-10-23 07:51:07 +0000
132@@ -710,7 +710,7 @@
133 '''
134 if isinstance(ids, (int, long)):
135 ids = [ids]
136- for pick_data in self.read(cr, uid, ids, ['sale_id', 'purchase_id', 'subtype', 'state'], context=context):
137+ for pick_data in self.read(cr, uid, ids, ['sale_id', 'purchase_id', 'type', 'subtype', 'state'], context=context):
138 # if draft and shipment is in progress, we cannot cancel
139 if pick_data['subtype'] == 'picking' and pick_data['state'] in ('draft',):
140 if self.has_picking_ticket_in_progress(cr, uid, [pick_data['id']], context=context)[pick_data['id']]:
141@@ -720,8 +720,12 @@
142 raise osv.except_osv(_('Warning !'), _('The shipment process is completed and cannot be canceled!'))
143
144 if pick_data['sale_id'] or pick_data['purchase_id']:
145+ wiz_title = _('Cancel Picking')
146+ if pick_data['type'] == 'out' and pick_data['subtype'] == 'standard':
147+ wiz_title = _('Cancel OUT')
148 return {'type': 'ir.actions.act_window',
149 'res_model': 'stock.picking.cancel.wizard',
150+ 'name': wiz_title,
151 'view_type': 'form',
152 'view_mode': 'form',
153 'target': 'new',
154@@ -2058,20 +2062,8 @@
155 'display_warning': False,
156 }
157
158- def ask_cancel(self, cr, uid, ids, context=None, *args, **kw):
159- if context is None:
160- context = {}
161-
162- move_id = self.pool.get('stock.move.cancel.wizard').read(cr, uid, ids[0], ['move_id'], context=context)['move_id']
163- wiz_id = self.pool.get('stock.move.cancel.more.wizard').create(cr, uid, {'move_id': move_id}, context=context)
164-
165- return {'type': 'ir.actions.act_window',
166- 'res_model': 'stock.move.cancel.more.wizard',
167- 'view_type': 'form',
168- 'view_mode': 'form',
169- 'target': 'new',
170- 'res_id': wiz_id,
171- 'context': context}
172+ def no_cancel(self, uid, ids, context=None, *args, **kw):
173+ return {'type': 'ir.actions.act_window_close'}
174
175 def is_in_forced(self, cr, uid, picking_browse, context=None):
176 return picking_browse.state == 'assigned' and \
177@@ -2079,7 +2071,6 @@
178 picking_browse.purchase_id.partner_type in ('internal', 'section', 'intermission') and \
179 picking_browse.purchase_id.order_type != 'direct'
180
181-
182 def just_cancel(self, cr, uid, ids, context=None):
183 '''
184 Just call the cancel of stock.move (re-sourcing flag not set)
185@@ -2136,62 +2127,6 @@
186
187 return self.just_cancel(cr, uid, ids, context=context)
188
189-
190-stock_move_cancel_wizard()
191-
192-
193-class stock_move_cancel_more_wizard(osv.osv_memory):
194- _name = 'stock.move.cancel.more.wizard'
195-
196- _columns = {
197- 'move_id': fields.many2one('stock.move', string='Move', required=True),
198- }
199-
200- _defaults = {
201- 'move_id': lambda self, cr, uid, c: c.get('active_id'),
202- }
203-
204- def no_cancel(self, uid, ids, context=None, *args, **kw):
205- return {'type': 'ir.actions.act_window_close'}
206-
207- def just_cancel(self, cr, uid, ids, context=None):
208- '''
209- Just call the cancel of stock.move (re-sourcing flag not set)
210- '''
211- # Objects
212- move_obj = self.pool.get('stock.move')
213- pick_obj = self.pool.get('stock.picking')
214-
215- wf_service = netsvc.LocalService("workflow")
216- if isinstance(ids, (int, long)):
217- ids = [ids]
218-
219- for wiz in self.browse(cr, uid, ids, context=context):
220- move_id = wiz.move_id.id
221- picking_id = wiz.move_id.picking_id.id
222- move_obj.action_cancel(cr, uid, [wiz.move_id.id], context=context)
223- move_ids = move_obj.search(cr, uid, [('id', '=', wiz.move_id.id)],
224- limit=1, order='NO_ORDER', context=context)
225- if move_ids and wiz.move_id.has_to_be_resourced:
226- self.infolog(cr, uid, "The stock.move id:%s of the picking id:%s (%s) has been canceled and resourced" % (
227- move_id,
228- picking_id,
229- pick_obj.read(cr, uid, picking_id, ['name'], context=context)['name'],
230- ))
231- else:
232- self.infolog(cr, uid, "The stock.move id:%s of the picking id:%s (%s) has been canceled" % (
233- move_id,
234- picking_id,
235- pick_obj.read(cr, uid, picking_id, ['name'], context=context)['name'],
236- ))
237-
238- if move_ids and wiz.move_id.picking_id:
239- lines = wiz.move_id.picking_id.move_lines
240- if all(l.state == 'cancel' for l in lines):
241- wf_service.trg_validate(uid, 'stock.picking', wiz.move_id.picking_id.id, 'button_cancel', cr)
242-
243- return {'type': 'ir.actions.act_window_close'}
244-
245 def cancel_and_create_int(self, cr, uid, ids, context=None):
246 """
247 Create/Update INT with stock in Cross Docking while cancelling Picking
248@@ -2285,7 +2220,7 @@
249 return {'type': 'ir.actions.act_window_close'}
250
251
252-stock_move_cancel_more_wizard()
253+stock_move_cancel_wizard()
254
255
256 class stock_picking_cancel_wizard(osv.osv_memory):
257@@ -2321,32 +2256,34 @@
258
259 return False
260
261+ def _get_doc_type(self, cr, uid, context=None):
262+ """
263+ Is the document an OUT, a Pick or something else ?
264+ """
265+ if context is None:
266+ context = {}
267+
268+ picking_id = context.get('active_id')
269+ pick = self.pool.get('stock.picking').read(cr, uid, picking_id, ['type', 'subtype'], context=context)
270+
271+ return pick['type'] == 'out' and (pick['subtype'] == 'standard' and 'out' or pick['subtype'] == 'picking' and 'pick') or 'other'
272+
273 _columns = {
274 'picking_id': fields.many2one('stock.picking', string='Picking', required=True),
275 'allow_cr': fields.boolean(string='Allow Cancel and resource'),
276 'has_moves_from_cross_docking': fields.boolean(string='Is one of the moves from the Cross docking Location ?'),
277+ 'doc_type': fields.selection(string="Document Type", selection=[('out', 'OUT'), ('pick', 'Picking'), ('other', 'Other')]),
278 }
279
280 _defaults = {
281 'picking_id': lambda self, cr, uid, c: c.get('active_id'),
282 'allow_cr': _get_allow_cr,
283 'has_moves_from_cross_docking': _check_from_cross_docking,
284+ 'doc_type': _get_doc_type,
285 }
286
287- def ask_cancel(self, cr, uid, ids, context=None, *args, **kw):
288- if context is None:
289- context = {}
290-
291- picking_id = self.pool.get('stock.picking.cancel.wizard').read(cr, uid, ids[0], ['picking_id'], context=context)['picking_id']
292- wiz_id = self.pool.get('stock.picking.cancel.more.wizard').create(cr, uid, {'picking_id': picking_id}, context=context)
293-
294- return {'type': 'ir.actions.act_window',
295- 'res_model': 'stock.picking.cancel.more.wizard',
296- 'view_type': 'form',
297- 'view_mode': 'form',
298- 'target': 'new',
299- 'res_id': wiz_id,
300- 'context': context}
301+ def no_cancel(self, uid, ids, context=None, *args, **kw):
302+ return {'type': 'ir.actions.act_window_close'}
303
304 def just_cancel(self, cr, uid, ids, context=None):
305 '''
306@@ -2396,50 +2333,6 @@
307
308 return self.just_cancel(cr, uid, ids, context=context)
309
310-
311-stock_picking_cancel_wizard()
312-
313-
314-class stock_picking_cancel_more_wizard(osv.osv_memory):
315- _name = 'stock.picking.cancel.more.wizard'
316-
317- _columns = {
318- 'picking_id': fields.many2one('stock.picking', string='Picking', required=True),
319- }
320-
321- _defaults = {
322- 'picking_id': lambda self, cr, uid, c: c.get('active_id'),
323- }
324-
325- def no_cancel(self, uid, ids, context=None, *args, **kw):
326- return {'type': 'ir.actions.act_window_close'}
327-
328- def just_cancel(self, cr, uid, ids, context=None):
329- '''
330- Just call the cancel of the stock.picking
331- '''
332- if isinstance(ids, (int, long)):
333- ids = [ids]
334- msg_type = {
335- 'in': 'Incoming Shipment',
336- 'internal': 'Internal Picking',
337- 'out': {
338- 'standard': 'Delivery Order',
339- 'picking': 'Picking Ticket',
340- }
341- }
342-
343- wf_service = netsvc.LocalService("workflow")
344- for wiz in self.browse(cr, uid, ids, context=context):
345- wf_service.trg_validate(uid, 'stock.picking', wiz.picking_id.id, 'button_cancel', cr)
346- self.infolog(cr, uid, "The %s id:%s (%s) has been canceled." % (
347- wiz.picking_id.type == 'out' and msg_type.get('out', {}).get(wiz.picking_id.subtype, '') or msg_type.get(wiz.picking_id.type),
348- wiz.picking_id.id,
349- wiz.picking_id.name,
350- ))
351-
352- return {'type': 'ir.actions.act_window_close'}
353-
354 def cancel_and_create_int(self, cr, uid, ids, context=None):
355 """
356 Create/Update INT with stock in Cross Docking while cancelling Picking
357@@ -2541,4 +2434,4 @@
358 return {'type': 'ir.actions.act_window_close'}
359
360
361-stock_picking_cancel_more_wizard()
362+stock_picking_cancel_wizard()
363
364=== modified file 'bin/addons/stock_override/stock_view.xml'
365--- bin/addons/stock_override/stock_view.xml 2023-08-08 09:24:25 +0000
366+++ bin/addons/stock_override/stock_view.xml 2023-10-23 07:51:07 +0000
367@@ -1118,40 +1118,29 @@
368 <field name="arch" type="xml">
369 <form string="Cancel Picking">
370 <field name="allow_cr" invisible="1" />
371- <group colspan="4" col="1" attrs="{'invisible': [('allow_cr', '=', False)]}">
372+ <field name="has_moves_from_cross_docking" invisible="1" />
373+ <field name="doc_type" invisible="1" />
374+ <group colspan="4" col="1" attrs="{'invisible': ['|', ('allow_cr', '=', False), ('doc_type', '!=', 'pick')]}">
375+ <html>
376+ <h4 style="text-align: center; margin: 10px"><translate>If you click on 'Cancel &amp; Resource' button, all lines of this Picking attached to a Field order or an Internal Request will be re-sourced. All lines or quantities already processed wouldn't be re-sourced.</translate></h4>
377+ </html>
378+ </group>
379+ <group colspan="4" col="1" attrs="{'invisible': ['|', ('allow_cr', '=', False), ('doc_type', '=', 'pick')]}">
380 <html>
381 <h4 style="text-align: center; margin: 10px"><translate>If you click on 'Cancel &amp; Resource' button, all lines of this delivery OUT attached to a Field order or an Internal Request will be re-sourced. All lines or quantities already processed wouldn't be re-sourced.</translate></h4>
382 </html>
383 </group>
384+ <group colspan="4" col="1" attrs="{'invisible': [('has_moves_from_cross_docking', '=', False)]}">
385+ <html>
386+ <h4 style="text-align: center; margin: 10px"><translate>Cancelling these moves might result in unreserved stock. Do you want to create an Internal Move or update the existing one to reallocate the quantities ?</translate></h4>
387+ </html>
388+ </group>
389 <newline />
390 <separator string="Actions" />
391- <field name="has_moves_from_cross_docking" invisible="1" />
392- <button name="ask_cancel" string="Cancel" type="object" icon="gtk-cancel" colspan="1" attrs="{'invisible': [('has_moves_from_cross_docking', '=', False)]}" />
393- <button name="just_cancel" string="Cancel Only" type="object" icon="gtk-cancel" colspan="1" attrs="{'invisible': [('has_moves_from_cross_docking', '=', True)]}" />
394+ <button name="no_cancel" string="Do not cancel" type="object" icon="gtk-undo" colspan="1" />
395+ <button name="just_cancel" string="Cancel Only" type="object" icon="gtk-cancel" colspan="1" />
396 <button name="cancel_and_resource" string="Cancel &amp; Resource" type="object" icon="gtk-cancel" colspan="1" attrs="{'invisible': [('allow_cr', '=', False)]}" />
397- </form>
398- </field>
399- </record>
400-
401- <record id="stock_picking_cancel_more_wizard" model="ir.ui.view">
402- <field name="name">stock.picking.cancel.more.wizard</field>
403- <field name="model">stock.picking.cancel.more.wizard</field>
404- <field name="type">form</field>
405- <field name="arch" type="xml">
406- <form string="Cancel Picking">
407- <group colspan="4" col="1">
408- <html>
409- <h4 style="text-align: center; margin: 10px"><translate>
410- Cancelling these moves might result in unreserved stock.<br/>
411- Do you want to create an Internal Move or update the existing one to reallocate the quantities ?
412- </translate></h4>
413- </html>
414- </group>
415- <newline />
416- <separator string="Actions" />
417- <button name="no_cancel" string="Do not cancel" type="object" icon="gtk-undo" colspan="1" />
418- <button name="just_cancel" string="Cancel Only" type="object" icon="gtk-cancel" colspan="1" />
419- <button name="cancel_and_create_int" string="Cancel &amp; create Internal Move" type="object" icon="terp-document-new" colspan="1" />
420+ <button name="cancel_and_create_int" string="Cancel &amp; create Internal Move" type="object" icon="terp-document-new" colspan="1" attrs="{'invisible': [('has_moves_from_cross_docking', '=', False)]}" />
421 </form>
422 </field>
423 </record>
424@@ -1177,39 +1166,21 @@
425 <h2 style="text-align: center; margin: 10px"><translate>Warning! There is a risk of producing inconsistent data if you cancel this line before it receives the delivery details and is changed into status "Available Shipped" after synchronization.</translate></h2>
426 </html>
427 </group>
428+ <group colspan="4" col="1" attrs="{'invisible': [('is_move_from_cross_docking', '=', False)]}">
429+ <html>
430+ <h4 style="text-align: center; margin: 10px"><translate>Cancelling this move might result in unreserved stock. Do you want to create an Internal Move or update the existing one to reallocate the quantities ?</translate></h4>
431+ </html>
432+ </group>
433 <newline />
434 <field name="cancel_only" invisible="1" />
435 <field name="from_dpo" invisible="1" />
436 <field name="display_warning" invisible="1" />
437 <field name="is_move_from_cross_docking" invisible="1" />
438 <separator string="Actions" colspan="4" />
439- <button name="ask_cancel" string="Cancel" type="object" icon="gtk-execute" colspan="1" attrs="{'invisible': [('is_move_from_cross_docking', '=', False)]}" />
440- <button name="just_cancel" string="Cancel Only" type="object" icon="gtk-execute" colspan="1" attrs="{'invisible': [('is_move_from_cross_docking', '=', True)]}" />
441- <button name="cancel_and_resource" string="Cancel and Resource" type="object" icon="gtk-execute" colspan="1"
442- attrs="{'invisible': [('cancel_only', '=', True)]}" />
443- </form>
444- </field>
445- </record>
446-
447- <record id="stock_move_cancel_more_wizard_form_view" model="ir.ui.view">
448- <field name="name">stock.move.cancel.more.wizard.form.view</field>
449- <field name="model">stock.move.cancel.more.wizard</field>
450- <field name="type">form</field>
451- <field name="arch" type="xml">
452- <form string="Cancel move">
453- <group colspan="4" col="1">
454- <html>
455- <h4 style="text-align: center; margin: 10px"><translate>
456- Cancelling this move might result in unreserved stock.<br/>
457- Do you want to create an Internal Move or update the existing one to reallocate the quantities ?
458- </translate></h4>
459- </html>
460- </group>
461- <newline />
462- <separator string="Actions" colspan="4" />
463 <button name="no_cancel" string="Do not cancel" type="object" icon="gtk-undo" colspan="1" />
464- <button name="just_cancel" string="Cancel Only" type="object" icon="gtk-execute" colspan="1" />
465- <button name="cancel_and_create_int" string="Cancel &amp; create Internal Move" type="object" icon="terp-document-new" colspan="1" />
466+ <button name="just_cancel" string="Cancel Only" type="object" icon="gtk-cancel" colspan="1" />
467+ <button name="cancel_and_resource" string="Cancel and Resource" type="object" icon="gtk-execute" colspan="1" attrs="{'invisible': [('cancel_only', '=', True)]}" />
468+ <button name="cancel_and_create_int" string="Cancel &amp; create Internal Move" type="object" icon="terp-document-new" colspan="1" attrs="{'invisible': [('is_move_from_cross_docking', '=', False)]}" />
469 </form>
470 </field>
471 </record>

Subscribers

People subscribed via source and target branches