Merge lp:~mallorymarcot/unifield-server/us-4201 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5141
Proposed branch: lp:~mallorymarcot/unifield-server/us-4201
Merge into: lp:unifield-server
Diff against target: 659 lines (+385/-26) (has conflicts)
13 files modified
bin/addons/msf_config_locations/stock_configuration.py (+82/-20)
bin/addons/msf_config_locations/stock_configuration_view.xml (+7/-3)
bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py (+30/-0)
bin/addons/msf_outgoing/wizard/incoming_shipment_processor_view.xml (+4/-1)
bin/addons/msf_outgoing/wizard/internal_move_processor.py (+16/-0)
bin/addons/msf_profile/i18n/fr_MF.po (+138/-0)
bin/addons/stock/__openerp__.py (+1/-0)
bin/addons/stock/stock.py (+24/-0)
bin/addons/stock/stock_view.xml (+1/-1)
bin/addons/stock/wizard/__init__.py (+1/-0)
bin/addons/stock/wizard/stock_location_confirm_deactivation.py (+55/-0)
bin/addons/stock/wizard/stock_location_confirm_deactivation.xml (+25/-0)
bin/addons/stock_override/stock_view.xml (+1/-1)
Text conflict in bin/addons/msf_profile/i18n/fr_MF.po
To merge this branch: bzr merge lp:~mallorymarcot/unifield-server/us-4201
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+355438@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_config_locations/stock_configuration.py'
2--- bin/addons/msf_config_locations/stock_configuration.py 2018-06-12 13:34:28 +0000
3+++ bin/addons/msf_config_locations/stock_configuration.py 2018-11-06 16:35:55 +0000
4@@ -603,9 +603,12 @@
5 string='Location type'),
6 'error_message': fields.text(string='Information Message', readonly=True),
7 'error': fields.boolean(string='Error'),
8- 'move_from_to': fields.boolean(string='Has a move from/to the location'),
9+ 'can_force': fields.boolean(string='Can force'),
10+ 'move_from': fields.boolean(string='Has a move from the location'),
11+ 'move_to': fields.boolean(string='Has a move to the location'),
12 'not_empty': fields.boolean(string='Location not empty'),
13 'has_child': fields.boolean(string='Location has children locations'),
14+ 'related_ir': fields.boolean(string='Location has related IR open'),
15 }
16
17 def location_id_on_change(self, cr, uid, ids, location_id, context=None):
18@@ -614,44 +617,73 @@
19 Check if there is no stock in this location
20 '''
21 res = {'error_message': '',
22- 'move_from_to': False,
23+ 'move_from': False,
24+ 'move_to': False,
25 'not_empty': False,
26- 'has_child': False}
27+ 'has_child': False,
28+ 'related_ir': False}
29 warning = {}
30 error = False
31+ can_force = False
32
33 if location_id:
34 location = self.pool.get('stock.location').browse(cr, uid, location_id, context=context)
35- # Check if no moves to this location aren't done
36- move_from_to = self.pool.get('stock.move').search(cr, uid, [('state', 'not in', ('done', 'cancel')), '|', ('location_id', '=', location.id), ('location_dest_id', '=', location.id)])
37- if move_from_to:
38- error = True
39- res['move_from_to'] = True
40- res['error_message'] += '''* You have at least one move from or to the location '%s' which is not 'Done'.
41-Please click on the 'See moves' button to see which moves are still in progress from/to this location.''' %location.name
42- res['error_message'] += '\n' + '\n'
43+
44+ move_to = self.pool.get('stock.move').search(cr, uid, [
45+ ('state', 'not in', ('done', 'cancel')),
46+ ('location_dest_id', '=', location.id),
47+ ('type', 'in', ['in', 'internal']),
48+ ])
49+ if move_to:
50+ error = True
51+ can_force = True
52+ res['move_to'] = True
53+ res['error_message'] += _("* You have at least one move to the location '%s' which is not 'Done'.\nPlease click on the 'See moves' button to see which moves are still in progress to this location.") % location.name
54+ res['error_message'] += '\n' + '\n'
55+
56+ move_from = self.pool.get('stock.move').search(cr, uid, [
57+ ('state', 'not in', ('done', 'cancel')),
58+ ('id', 'not in', move_to),
59+ '|', ('location_id', '=', location.id), ('location_dest_id', '=', location.id),
60+ ])
61+ if move_from:
62+ error = True
63+ res['move_from'] = True
64+ res['error_message'] += _("* You have at least one move from or to the location '%s' which is not 'Done'.\nPlease click on the 'See moves' button to see which moves are still in progress from/to this location.") % location.name
65+ res['error_message'] += '\n' + '\n'
66+
67+
68 # Check if no stock in the location
69 if location.stock_real and location.usage == 'internal':
70 error = True
71 res['not_empty'] = True
72- res['error_message'] += '''* The location '%s' is not empty of products.
73-Please click on the 'Products in location' button to see which products are still in the location.''' %location.name
74+ res['error_message'] += _("* The location '%s' is not empty of products.\nPlease click on the 'Products in location' button to see which products are still in the location.") % location.name
75 res['error_message'] += '\n' + '\n'
76
77 # Check if the location has children locations
78 if location.child_ids:
79 error = True
80 res['has_child'] = True
81- res['error_message'] += '''* The location '%s' has children locations.
82-Please remove all children locations before remove it.
83-Please click on the 'Children locations' button to see all children locations.''' %location.name
84+ res['error_message'] += _("* The location '%s' has children locations.\nPlease remove all children locations before remove it.\nPlease click on the 'Children locations' button to see all children locations.") % location.name
85 res['error_message'] += '\n' + '\n'
86
87+ related_ir = self.pool.get('sale.order').search(cr, uid, [
88+ ('procurement_request', '=', True),
89+ ('state', 'in', ('draft', 'draft_p', 'validated', 'validated_p', 'sourced', 'sourced_p')),
90+ ('location_requestor_id', '=', location_id),
91+ ], context=context)
92+ if related_ir:
93+ error = True
94+ can_force = True
95+ res['related_ir'] = True
96+ res['error_message'] += _("* Warning there are open IR with location '%s'.\n Please click on the 'See documents' button to see all children locations.\n\n") % location.name
97+
98 if error:
99- warning.update({'title': 'Be careful !',
100- 'message': 'You have a problem with this location − Please see the message in the form for more information.'})
101+ warning.update({'title': _('Be careful !'),
102+ 'message': _('You have a problem with this location − Please see the message in the form for more information.')})
103
104 res['error'] = error
105+ res['can_force'] = error and not (res['not_empty'] or res['has_child'] or res['move_from']) and can_force or False
106
107 return {'value': res,
108 'warning': warning}
109@@ -696,9 +728,8 @@
110 internal_cu_loc_id = data_obj.get_object_reference(cr, uid, 'msf_config_locations', 'stock_location_consumption_units_view')[1]
111
112 for wizard in self.browse(cr, uid, ids, context=context):
113- if wizard.error or wizard.has_child or wizard.not_empty or wizard.move_from_to:
114+ if (wizard.error and not wizard.can_force) or wizard.has_child or wizard.not_empty or wizard.move_from:
115 raise osv.except_osv(_('Error'), _('You cannot remove this location because some errors are still here !'))
116-
117 location = wizard.location_id
118
119 # De-activate the location
120@@ -762,6 +793,37 @@
121 'target': 'current',
122 }
123
124+
125+ def related_ir(self, cr, uid, ids, context=None):
126+ if context is None:
127+ context = {}
128+ if isinstance(ids, (int,long)):
129+ ids = [ids]
130+
131+ wizard = self.browse(cr, uid, ids[0], context=context)
132+ location = wizard.location_id
133+ context.update({'procurement_request': True})
134+
135+ related_ir = self.pool.get('sale.order').search(cr, uid, [
136+ ('procurement_request', '=', True),
137+ ('state', 'in', ('draft', 'draft_p', 'validated', 'validated_p', 'sourced', 'sourced_p')),
138+ ('location_requestor_id', '=', location.id),
139+ ], context=context)
140+
141+ view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'procurement_request', 'procurement_request_tree_view')[1]
142+
143+ return {
144+ 'type': 'ir.actions.act_window',
145+ 'res_model': 'sale.order',
146+ 'domain': [('id', 'in', related_ir)],
147+ 'view_id': [view_id],
148+ 'view_type': 'form',
149+ 'view_mode': 'tree,form',
150+ 'target': 'current',
151+ 'context': context,
152+ }
153+
154+
155 def products_in_location(self, cr, uid, ids, context=None):
156 '''
157 Returns a list of products in the location
158
159=== modified file 'bin/addons/msf_config_locations/stock_configuration_view.xml'
160--- bin/addons/msf_config_locations/stock_configuration_view.xml 2018-08-10 15:54:25 +0000
161+++ bin/addons/msf_config_locations/stock_configuration_view.xml 2018-11-06 16:35:55 +0000
162@@ -50,9 +50,12 @@
163 <field name="arch" type="xml">
164 <form string="Remove an optional location">
165 <field name="error" invisible="1" />
166- <field name="move_from_to" invisible="1" />
167+ <field name="move_from" invisible="1" />
168+ <field name="move_to" invisible="1" />
169 <field name="not_empty" invisible="1" />
170 <field name="has_child" invisible="1" />
171+ <field name="related_ir" invisible="1" />
172+ <field name="can_force" invisible="1" />
173 <separator string="Parameters" colspan="4" />
174 <!--<field name="location_usage" string="Which is the usage of the location to remove ?" colspan="4"
175 on_change="location_usage_change(location_usage)" />
176@@ -65,15 +68,16 @@
177 <group colspan="4" col="3" attrs="{'invisible': [('error', '=', False)]}">
178 <separator string="Message" colspan="4" />
179 <field name="error_message" nolabel="1" colspan="4" />
180- <button type="object" name="see_moves" string="See moves" attrs="{'invisible': [('move_from_to', '=', False)]}" />
181+ <button type="object" name="see_moves" string="See moves" attrs="{'invisible': [('move_from', '=', False),('move_to', '=', False)]}" />
182 <button type="object" name="products_in_location" string="Products in location" attrs="{'invisible': [('not_empty', '=', False)]}" />
183 <button type="object" name="children_location" string="Children locations" attrs="{'invisible': [('has_child', '=', False)]}" />
184+ <button type="object" name="related_ir" string="See documents" attrs="{'invisible': [('related_ir', '=', False)]}" />
185 </group>
186 <separator colspan="4" string="Actions" />
187 <button special="cancel" icon="gtk-cancel" string="Cancel" />
188 <group colspan="3" col="2">
189 <button type="object" name="deactivate_location" icon="terp-camera_test" string="Inactivate the location"
190- attrs="{'invisible': [('error', '=', True)]}" colspan="2" />
191+ attrs="{'invisible': [('error', '=', True), ('can_force', '=', False)]}" colspan="2" />
192 <button type="object" name="check_error" icon="gtk-execute" string="Check errors"
193 attrs="{'invisible': [('error', '=', False)]}" colspan="2" />
194 </group>
195
196=== modified file 'bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py'
197--- bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py 2018-08-14 12:57:02 +0000
198+++ bin/addons/msf_outgoing/wizard/incoming_shipment_processor.py 2018-11-06 16:35:55 +0000
199@@ -138,6 +138,32 @@
200 return res
201
202
203+ def _get_location_dest_active_ok(self, cr, uid, ids, field_name, args, context=None):
204+ '''
205+ Returns True if there is draft moves on Picking Ticket
206+ '''
207+ if context is None:
208+ context = {}
209+ if isinstance(ids, (int,long)):
210+ ids = [ids]
211+
212+ res = {}
213+ for wiz in self.browse(cr, uid, ids, context=context):
214+ res[wiz.id] = True
215+ if not wiz.picking_id:
216+ break
217+ sys_int_moves = self.pool.get('stock.move').search(cr, uid, [
218+ ('linked_incoming_move', 'in', [x.id for x in wiz.picking_id.move_lines]),
219+ ('type', '=', 'internal'),
220+ ], context=context)
221+ for sys_move in self.pool.get('stock.move').browse(cr, uid, sys_int_moves, context=context):
222+ if not sys_move.location_dest_id.active:
223+ res[wiz.id] = False
224+ break
225+
226+ return res
227+
228+
229 _columns = {
230 'move_ids': fields.one2many(
231 'stock.move.in.processor',
232@@ -198,6 +224,7 @@
233 string='Claim Description',
234 ),
235 'display_process_to_ship_button': fields.function(_get_display_process_to_ship_button, method=True, type='boolean', string='Process to ship'),
236+ 'location_dest_active_ok': fields.function(_get_location_dest_active_ok, method=True, type='boolean', string='Dest location is inactive ?', store=False),
237 }
238
239 _defaults = {
240@@ -359,6 +386,9 @@
241 _("You have to enter the quantities you want to process before processing the move")
242 )
243
244+ if proc.direct_incoming and not proc.location_dest_active_ok:
245+ self.write(cr, uid, [proc.id], {'direct_incoming': False}, context=context)
246+
247 if to_unlink:
248 in_proc_obj.unlink(cr, uid, to_unlink, context=context)
249
250
251=== modified file 'bin/addons/msf_outgoing/wizard/incoming_shipment_processor_view.xml'
252--- bin/addons/msf_outgoing/wizard/incoming_shipment_processor_view.xml 2018-05-29 13:24:45 +0000
253+++ bin/addons/msf_outgoing/wizard/incoming_shipment_processor_view.xml 2018-11-06 16:35:55 +0000
254@@ -20,6 +20,7 @@
255 </group>
256 <field name="contains_dg" invisible="1" />
257 <field name="contains_kc" invisible="1" />
258+ <field name="location_dest_active_ok" invisible="1"/>
259 <field name="draft" invisible="1" />
260 <group colspan="4" attrs="{'invisible': ['|', ('contains_dg', '=', True), ('contains_kc', '=', False)]}">
261 <html>
262@@ -84,7 +85,9 @@
263 <button name="do_reset" type="object" string="Reset" attrs="{'invisible':[('draft','!=',True)]}" icon="gtk-go-forward" />
264 <button name="do_save_draft" type="object" string="Save as draft" icon="gtk-go-forward" />
265 <button special="cancel" string="Cancel" icon="gtk-cancel" />
266- <button name="do_incoming_shipment" type="object" string="Process" icon="gtk-go-forward" />
267+ <button name="do_incoming_shipment" type="object" string="Process" icon="gtk-go-forward" attrs="{'invisible': [('location_dest_active_ok', '!=', True)]}" />
268+ <button name="do_incoming_shipment" type="object" string="Process" icon="gtk-go-forward" attrs="{'invisible': [('location_dest_active_ok', '!=', False)]}"
269+ confirm="Warning the final destination location of these goods is no longer active, IN will be processed as normal but please check and process the Internal move created after manually. Continue ?" />
270 <button name="process_to_ship" attrs="{'invisible': [('display_process_to_ship_button', '!=', True)]}" type="object" string="Process to ship" icon="gtk-goto-last" />
271 </group>
272 </form>
273
274=== modified file 'bin/addons/msf_outgoing/wizard/internal_move_processor.py'
275--- bin/addons/msf_outgoing/wizard/internal_move_processor.py 2018-08-10 12:46:33 +0000
276+++ bin/addons/msf_outgoing/wizard/internal_move_processor.py 2018-11-06 16:35:55 +0000
277@@ -131,6 +131,21 @@
278
279 return super(internal_picking_processor, self).create(cr, uid, vals, context=context)
280
281+
282+ def check_destination_location(self, cr, uid, ids, context=None):
283+ if context is None:
284+ context = {}
285+ if isinstance(ids, (int,long)):
286+ ids = [ids]
287+
288+ for wizard in self.browse(cr, uid, ids, context=context):
289+ for line in wizard.move_ids:
290+ if line.move_id and not line.move_id.location_dest_id.active:
291+ raise osv.except_osv(_('Error'), _('Warning, destination location is no longer active, please select an active location'))
292+
293+ return True
294+
295+
296 def do_partial(self, cr, uid, ids, context=None):
297 """
298 Made some integrity check on lines and run the do_incoming_shipment of stock.picking
299@@ -163,6 +178,7 @@
300
301 self.integrity_check_quantity(cr, uid, wizard_brw_list, context)
302 self.integrity_check_prodlot(cr, uid, wizard_brw_list, context=context)
303+ self.check_destination_location(cr, uid, ids, context=context)
304 # call stock_picking method which returns action call
305 res = picking_obj.do_partial(cr, uid, ids, context=context)
306 return self.return_hook_do_partial(cr, uid, ids, context=context, res=res)
307
308=== modified file 'bin/addons/msf_profile/i18n/fr_MF.po'
309--- bin/addons/msf_profile/i18n/fr_MF.po 2018-10-30 10:56:14 +0000
310+++ bin/addons/msf_profile/i18n/fr_MF.po 2018-11-06 16:35:55 +0000
311@@ -101868,11 +101868,59 @@
312 msgid " goods products, please refer to the appropriate procedures"
313 msgstr " veuillez vous référer aux procédures adéquates."
314
315+<<<<<<< TREE
316 #. module: specific_rules
317 #: view:export.report.stock.inventory:0
318 msgid "Generate report (product list)"
319 msgstr "Générer le rapport (liste de produits)"
320
321+=======
322+#. module: msf_outgoing
323+#: view:stock.incoming.processor:0
324+msgid "Warning the final destination location of these goods is no longer active, IN will be processed as normal but please check and process the Internal move created after manually."
325+msgstr "Attention la location de stock finale pour ces biens n'est plus active, le IN va être executé normalement mais merci de vérifier et d'executer les mouvements internes résultants manuellement."
326+
327+#. module: msf_outgoing
328+#: code:addons/msf_outgoing/wizard/internal_move_processor.py:144
329+#, python-format
330+msgid "Warning, destination location is no longer active, please select an active location"
331+msgstr "Attention, la location de stock finale n'est plus active, merci de selectionner une location active"
332+
333+#. module: stock
334+#: code:addons/stock/stock.py:493
335+#, python-format
336+msgid "You cannot deactivate location %s because of the following products currently in stock:\n"
337+" %s %s"
338+msgstr "Vous ne pouvez pas desactiver la location %s car elle contient les produits suivants en stock:\n"
339+" %s %s"
340+
341+#. module: stock
342+#: code:addons/stock/stock.py:496
343+#, python-format
344+msgid "\n"
345+"... and %s more"
346+msgstr "\n"
347+"... et %s en plus"
348+
349+#. module: stock
350+#: code:addons/stock/stock.py:525
351+#, python-format
352+msgid "The location %s has open OUT stock moves:\n"
353+""
354+msgstr "La location %s a des mouvements de stock sortant ouverts:\n"
355+""
356+
357+#. module: stock
358+#: view:stock.location.confirm.deactivation:0
359+msgid "There are open documents relating to this location or stock movements into this location, would you like to deactivation it anyway ?"
360+msgstr "Des documents sont ouverts pour cette location ou il y a des mouvements de stock vers cette location, êtes-vous sûr de vouloir la désactiver ?"
361+
362+#. module: stock
363+#: view:stock.location.confirm.deactivation:0
364+msgid "Deactivate location"
365+msgstr "Désactiver la location"
366+
367+>>>>>>> MERGE-SOURCE
368 #. module: account_override
369 #: code:addons/account_override/account.py:517
370 #, python-format
371@@ -101958,6 +102006,7 @@
372 #: field:account.commitment.line,commit_number:0
373 msgid "Commitment Voucher Number"
374 msgstr "Numéro du Bon d'Engagement"
375+<<<<<<< TREE
376
377 #. module: account_mcdb
378 #: code:addons/account_mcdb/account_mcdb.py:1494
379@@ -102085,3 +102134,92 @@
380 #, python-format
381 msgid "%s months"
382 msgstr "%s mois"
383+=======
384+
385+#. module: msf_config_locations
386+#: code:addons/msf_config_locations/stock_configuration.py:641
387+#, python-format
388+msgid "* You have at least one move to the location '%s' which is not 'Done'.\n"
389+"Please click on the 'See moves' button to see which moves are still in progress to this location."
390+msgstr "* Il y a au moins un mouvement de stock dans l'emplacement '%s' qui n'est pas clos.\n"
391+"Merci de cliquer sur le bouton 'Voir les mouvements' pour voir les mouvements non clos."
392+
393+#. module: msf_config_locations
394+#: code:addons/msf_config_locations/stock_configuration.py:652
395+#, python-format
396+msgid "* You have at least one move from or to the location '%s' which is not 'Done'.\n"
397+"Please click on the 'See moves' button to see which moves are still in progress from/to this location."
398+msgstr "* Il y a au moins un mouvement de stock dans l'emplacement '%s' qui n'est pas clos.\n"
399+"Merci de cliquer sur le bouton 'Voir les mouvements' pour voir les mouvements non clos."
400+
401+#. module: msf_config_locations
402+#: code:addons/msf_config_locations/stock_configuration.py:660
403+#, python-format
404+msgid "* The location '%s' is not empty of products.\n"
405+"Please click on the 'Products in location' button to see which products are still in the location."
406+msgstr "* L'emplacement '%s' n'est pas vide.\n"
407+"Merci de cliquer sur le bouton 'Produits dans l'emplacement' pour voir les produits contenus dans cet emplacement."
408+
409+#. module: msf_config_locations
410+#: code:addons/msf_config_locations/stock_configuration.py:667
411+#, python-format
412+msgid "* The location '%s' has children locations.\n"
413+"Please remove all children locations before remove it.\n"
414+"Please click on the 'Children locations' button to see all children locations."
415+msgstr "* L'emplacement '%s' a des emplacements enfants\n"
416+"Merci de d'abord supprimer ces emplacements enfants.\n"
417+"Merci de cliquer sur le bouton 'Emplacements enfants' pour voir les emplacements enfants."
418+
419+#. module: msf_config_locations
420+#: code:addons/msf_config_locations/stock_configuration.py:679
421+#, python-format
422+msgid "* Warning there are open IR with location '%s'.\n"
423+" Please click on the 'See documents' button to see all children locations.\n"
424+"\n"
425+""
426+msgstr "* Attention, il y a des demandes internes en cours pour l'emplacement '%s'.\n"
427+"Merci de cliquer sur le bouton 'Voir les doucements' pour voir les emplacements enfants.\n"
428+"\n"
429+""
430+
431+#. module: msf_config_locations
432+#: code:addons/msf_config_locations/stock_configuration.py:683
433+#, python-format
434+msgid "You have a problem with this location − Please see the message in the form for more information."
435+msgstr "Il y a un problème avec cet emplacement de stock - Merci de lire le message dans le formulaire pour plus d'informations"
436+
437+#. module: msf_config_locations
438+#: code:addons/msf_config_locations/stock_configuration.py:682
439+#, python-format
440+msgid "Be careful !"
441+msgstr "Attention !"
442+
443+#. module: msf_config_locations
444+#: view:stock.remove.location.wizard:0
445+msgid "See moves"
446+msgstr "Voir les mouvements"
447+
448+#. module: msf_config_locations
449+#: view:stock.remove.location.wizard:0
450+msgid "Products in location"
451+msgstr "Produits dans l'emplacement"
452+
453+#. module: msf_config_locations
454+#: view:stock.remove.location.wizard:0
455+msgid "Children locations"
456+msgstr "Emplacements enfants"
457+
458+#. module: msf_config_locations
459+#: view:stock.remove.location.wizard:0
460+msgid "See documents"
461+msgstr "Voir les documents"
462+
463+#. module: msf_config_locations
464+#: view:stock.remove.location.wizard:0
465+msgid "Inactivate the location"
466+msgstr "Desactiver l'emplacement"
467+
468+#. module: msf_config_locations
469+#: view:stock.remove.location.wizard:0
470+msgid "Check errors"
471+msgstr "Tester les erreurs">>>>>>> MERGE-SOURCE
472
473=== modified file 'bin/addons/stock/__openerp__.py'
474--- bin/addons/stock/__openerp__.py 2018-06-28 11:55:57 +0000
475+++ bin/addons/stock/__openerp__.py 2018-11-06 16:35:55 +0000
476@@ -60,6 +60,7 @@
477 "wizard/stock_inventory_line_split_view.xml",
478 "wizard/stock_change_standard_price_view.xml",
479 'wizard/stock_return_picking_view.xml',
480+ 'wizard/stock_location_confirm_deactivation.xml',
481 "stock_workflow.xml",
482 "stock_incoterms.xml",
483 "stock_view.xml",
484
485=== modified file 'bin/addons/stock/stock.py'
486--- bin/addons/stock/stock.py 2018-09-17 16:16:37 +0000
487+++ bin/addons/stock/stock.py 2018-11-06 16:35:55 +0000
488@@ -455,6 +455,8 @@
489
490 return False
491
492+
493+
494 stock_location()
495
496
497@@ -612,6 +614,27 @@
498 new_id = super(stock_picking, self).create(cr, user, vals, context)
499 return new_id
500
501+
502+ def _get_location_dest_active_ok(self, cr, uid, ids, field_name, args, context=None):
503+ '''
504+ Returns True if there is draft moves on Picking Ticket
505+ '''
506+ if context is None:
507+ context = {}
508+ if isinstance(ids, (int,long)):
509+ ids = [ids]
510+
511+ res = {}
512+ for pick in self.browse(cr, uid, ids, fields_to_fetch=['move_lines'], context=context):
513+ res[pick.id] = True
514+ for int_move in self.pool.get('stock.move').browse(cr, uid, [x.id for x in pick.move_lines], fields_to_fetch=['location_dest_id'], context=context):
515+ if not int_move.location_dest_id.active:
516+ res[pick.id] = False
517+ break
518+
519+ return res
520+
521+
522 _columns = {
523 'name': fields.char('Reference', size=64, select=True),
524 'origin': fields.char('Origin', size=512, help="Reference of the document that produced this picking.", select=True),
525@@ -657,6 +680,7 @@
526 'claim': fields.boolean('Claim'),
527 'claim_name': fields.char(string='Claim name', size=512),
528 'physical_reception_date': fields.datetime('Physical Reception Date', states={'done': [('readonly', True)], 'cancel': [('readonly', True)]}),
529+ 'location_dest_active_ok': fields.function(_get_location_dest_active_ok, method=True, type='boolean', string='Dest location is inactive ?', store=False),
530 }
531 _defaults = {
532 'name': lambda self, cr, uid, context: '/',
533
534=== modified file 'bin/addons/stock/stock_view.xml'
535--- bin/addons/stock/stock_view.xml 2018-09-17 16:16:37 +0000
536+++ bin/addons/stock/stock_view.xml 2018-11-06 16:35:55 +0000
537@@ -510,7 +510,7 @@
538 <field name="company_id" groups="base.group_multi_company" widget="selection" colspan="4"/>
539 <field name="icon" groups="base.group_extended" colspan="4"/>
540 <field name="scrap_location" groups="base.group_extended"/>
541- <field name="active" groups="base.group_extended"/>
542+ <field name="active" groups="base.group_extended" readonly="1" />
543 </group>
544 <group col="2" colspan="2" groups="base.group_extended">
545 <separator string="Chained Locations" colspan="2"/>
546
547=== modified file 'bin/addons/stock/wizard/__init__.py'
548--- bin/addons/stock/wizard/__init__.py 2018-06-28 11:55:57 +0000
549+++ bin/addons/stock/wizard/__init__.py 2018-11-06 16:35:55 +0000
550@@ -38,5 +38,6 @@
551 import physical_inventory_generate_counting_sheet
552 import physical_inventory_import
553 import manage_expired_stock
554+import stock_location_confirm_deactivation
555 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
556
557
558=== added file 'bin/addons/stock/wizard/stock_location_confirm_deactivation.py'
559--- bin/addons/stock/wizard/stock_location_confirm_deactivation.py 1970-01-01 00:00:00 +0000
560+++ bin/addons/stock/wizard/stock_location_confirm_deactivation.py 2018-11-06 16:35:55 +0000
561@@ -0,0 +1,55 @@
562+# -*- coding: utf-8 -*-
563+##############################################################################
564+#
565+# OpenERP, Open Source Management Solution
566+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
567+#
568+# This program is free software: you can redistribute it and/or modify
569+# it under the terms of the GNU Affero General Public License as
570+# published by the Free Software Foundation, either version 3 of the
571+# License, or (at your option) any later version.
572+#
573+# This program is distributed in the hope that it will be useful,
574+# but WITHOUT ANY WARRANTY; without even the implied warranty of
575+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
576+# GNU Affero General Public License for more details.
577+#
578+# You should have received a copy of the GNU Affero General Public License
579+# along with this program. If not, see <http://www.gnu.org/licenses/>.
580+#
581+##############################################################################
582+
583+from osv import osv, fields
584+
585+class stock_location_confirm_deactivation(osv.osv_memory):
586+ _name = 'stock.location.confirm.deactivation'
587+
588+ _columns = {
589+ 'location_id': fields.many2one('stock.location', string='Stock location to deactive'),
590+ 'message': fields.text('Message'),
591+ }
592+
593+ def confirm_deactivation(self, cr, uid, ids, context=None):
594+ if context is None:
595+ context = {}
596+ if isinstance(ids, (int, long)):
597+ ids = [ids]
598+
599+ for wiz in self.browse(cr, uid, ids, context=context):
600+ self.pool.get('stock.location').write(cr, uid, [wiz.location_id.id], {'active': False}, context=context)
601+
602+ return {'type': 'ir.actions.act_window_close'}
603+
604+
605+ def close_wizard(self, cr, uid, ids, context=None):
606+ '''
607+ Just close the wizard
608+ '''
609+ if context is None:
610+ context = {}
611+ if isinstance(ids, (int,long)):
612+ ids = [ids]
613+ return {'type': 'ir.actions.act_window_close'}
614+
615+
616+stock_location_confirm_deactivation()
617
618=== added file 'bin/addons/stock/wizard/stock_location_confirm_deactivation.xml'
619--- bin/addons/stock/wizard/stock_location_confirm_deactivation.xml 1970-01-01 00:00:00 +0000
620+++ bin/addons/stock/wizard/stock_location_confirm_deactivation.xml 2018-11-06 16:35:55 +0000
621@@ -0,0 +1,25 @@
622+<?xml version="1.0" encoding="utf-8"?>
623+<openerp>
624+ <data>
625+ <record id="stock_location_confirm_deactivation_form_view" model="ir.ui.view">
626+ <field name="name">Confirm location deactivation</field>
627+ <field name="model">stock.location.confirm.deactivation</field>
628+ <field name="type">form</field>
629+ <field name="arch" type="xml">
630+ <form string="Confirm location deactivation">
631+ <group colspan="4" col="1">
632+ <html>
633+ <h3 style="text-align: center; margin: 13px"><translate>There are open documents relating to this location or stock movements into this location, would you like to deactivation it anyway ?</translate></h3>
634+ </html>
635+ <field name="message" nolabel="1" readonly="1" />
636+ </group>
637+ <newline />
638+ <separator string="Actions" />
639+ <button name="confirm_deactivation" string="Deactivate location" type="object" icon="terp-camera_test" colspan="2" />
640+ <button name="close_wizard" string="Close the wizard" type="object" icon="gtk-close" colspan="2" />
641+ </form>
642+ </field>
643+ </record>
644+ </data>
645+</openerp>
646+
647
648=== modified file 'bin/addons/stock_override/stock_view.xml'
649--- bin/addons/stock_override/stock_view.xml 2018-10-25 14:44:55 +0000
650+++ bin/addons/stock_override/stock_view.xml 2018-11-06 16:35:55 +0000
651@@ -342,7 +342,7 @@
652 on_change="onchange_move()"
653 attrs="{'readonly': [('from_manage_expired', '=', True)]}"
654 >
655- <tree colors="grey:scrapped == True; red: inactive_product or to_correct_ok or expired_lot" string="Stock Moves" noteditable="fake_state=='assigned' or linked_incoming_move != False" hide_new_button="context.get('from_wkf')" hide_delete_button="context.get('from_wkf')">
656+ <tree colors="grey:scrapped == True; red: inactive_product or to_correct_ok or expired_lot" string="Stock Moves" noteditable="linked_incoming_move != False" hide_new_button="context.get('from_wkf')" hide_delete_button="context.get('from_wkf')">
657 <field name="line_number"/>
658 <field name="product_id" />
659 <field name="comment" />

Subscribers

People subscribed via source and target branches