Improvements in loads.

This commit is contained in:
Sergio Morillo 2016-01-24 21:05:16 +01:00
parent 80ec4ce720
commit 45d723c0f6
2 changed files with 15 additions and 1 deletions

12
load.py
View File

@ -68,7 +68,8 @@ class LoadOrder:
'ul_warehouse': 'UL "%s" must be in warehouse "%s" to be loaded in order "%s".',
'ul_origin': 'UL "%s" does not belong to any origin of this load order.',
'ul_overload': 'All valid lines of load order "%s" are complete. Cannot load more ULs.',
'ul_data': 'Product data of UL "%s" does not match with any line of load order "%s".'})
'ul_data': 'Product data of UL "%s" does not match with any line of load order "%s".',
'draft_ul': 'Cannot change state to Draft for load order "%s" because it has loaded ULs.'})
@classmethod
def default_ul_origin_restrict(cls):
@ -162,6 +163,15 @@ class LoadOrder:
Move.save(moves)
Move.do([m for r in records for l in r.lines for m in l.moves])
@classmethod
def draft(cls, records):
for record in records:
if record.state != 'waiting':
continue
if record.unit_loads:
cls.raise_user_error('draft_ul', record.rec_name)
super(LoadOrder, cls).draft(records)
def _get_inventory_move(self, move):
pool = Pool()
Move = pool.get('stock.move')

View File

@ -38,6 +38,10 @@ msgid "UL \"%s\" must be in warehouse \"%s\" to be loaded in order \"%s\"."
msgstr ""
"La UdC \"%s\" debe encontrarse en el almacén \"%s\" para ser cargada en la orden \"%s\"."
msgctxt "error:carrier.load.order:"
msgid "Cannot change state to Draft for load order \"%s\" because it has loaded ULs."
msgstr "No puede establecerse el estado Borrador para la orden \"%s\" porque tiene UdCs cargadas."
msgctxt "error:carrier.load_uls:"
msgid "Cannot find Unit load \"%s\"."
msgstr "No se ha podido encontrar la UdC \"%s\"."