mirror of
https://gitlab.com/datalifeit/trytond-carrier_load_done2running
synced 2023-12-14 04:42:57 +01:00
parent
f3cb35c159
commit
4ad56f981e
18
load.py
18
load.py
|
@ -16,9 +16,13 @@ class LoadOrder:
|
|||
super(LoadOrder, cls).__setup__()
|
||||
cls._transitions.add(('done', 'running'))
|
||||
cls._buttons.update({
|
||||
'run': {'icon': 'tryton-go-previous',
|
||||
'invisible': Or(Eval('state') != 'done', ~Eval('groups', []).contains(
|
||||
Id('carrier_load_done2running', 'group_force_undo_load')))},
|
||||
'run': {
|
||||
'icon': 'tryton-go-previous',
|
||||
'invisible': Or(Eval('state') != 'done', ~Eval('groups',
|
||||
[]).contains(Id('carrier_load_done2running',
|
||||
'group_force_undo_load')
|
||||
))
|
||||
},
|
||||
})
|
||||
cls._error_messages.update({
|
||||
'sale_state': 'Cannot cancel Sale "%s" due to it is confirmed.'})
|
||||
|
@ -34,15 +38,17 @@ class LoadOrder:
|
|||
to_run = [r for r in records if r.state == 'done']
|
||||
if to_run:
|
||||
for item in to_run:
|
||||
if item.sale and item.sale.state not in ('draft', 'quotation'):
|
||||
if (item.sale and item.sale.origin == item and
|
||||
item.sale.state not in ('draft', 'quotation')):
|
||||
cls.raise_user_error('sale_state', item.sale.rec_name)
|
||||
|
||||
sales = [r.sale for r in to_run if r.sale]
|
||||
sales = [r.sale for r in to_run if r.sale and r.sale.origin != r]
|
||||
shipments_out = [r.shipment for r in to_run
|
||||
if r.type == 'out' and r.shipment]
|
||||
shipments_internal = [r.shipment for r in to_run
|
||||
if r.type == 'internal' and r.shipment]
|
||||
moves = [m for s in shipments_out + shipments_internal for m in s.moves]
|
||||
moves = [m for s in shipments_out + shipments_internal
|
||||
for m in s.moves]
|
||||
order_moves = [m for r in to_run for m in r.outgoing_moves]
|
||||
order_moves.extend([m for r in to_run for m in r.inventory_moves])
|
||||
with Transaction().set_context(check_origin=False):
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#
|
||||
#
|
||||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
|
@ -11,8 +11,8 @@ msgid "Force undo load"
|
|||
msgstr "Forzar reapertura de carga"
|
||||
|
||||
msgctxt "view:carrier.load.order:"
|
||||
msgid "Sale and Shipment out will be deleted."
|
||||
msgstr "Venta y Albarán de cliente van a eliminarse."
|
||||
msgid "Shipment and Sale (if proceed) will be deleted."
|
||||
msgstr "Albarán y Venta (si procede) van a eliminarse."
|
||||
|
||||
msgctxt "view:carrier.load.order:"
|
||||
msgid "Back to run"
|
||||
|
|
|
@ -333,8 +333,6 @@ Finish loading::
|
|||
|
||||
Check sale::
|
||||
|
||||
>>> len(order.sales)
|
||||
1
|
||||
>>> order.sale != None
|
||||
True
|
||||
>>> order.sale.state
|
||||
|
|
|
@ -4,6 +4,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<data>
|
||||
<xpath expr="/form/group[@id='state_buttons']/group[@id='buttons']" position="inside">
|
||||
<button name="run" string="Back to run"
|
||||
confirm="Sale and Shipment out will be deleted."/>
|
||||
confirm="Shipment and Sale (if proceed) will be deleted."/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
Loading…
Reference in a new issue