Do outgoing_moves if shipment done.

This commit refs #17055
This commit is contained in:
Sergio Morillo 2021-01-20 19:40:44 +01:00
parent 651097e659
commit c44f29fb33
2 changed files with 36 additions and 0 deletions

View File

@ -322,6 +322,8 @@ class LoadOrder(metaclass=PoolMeta):
Move.assign(outgoing_moves)
if self.type == 'out':
Move.do(inventory_moves)
if shipment.state == 'done':
Move.do(outgoing_moves)
else:
shipment_moves = [m for m in shipment.moves
if m.unit_load in _groupitems]

View File

@ -433,6 +433,40 @@ Force load another UL::
>>> sum(m.quantity for m in order.outgoing_moves)
4.0
Add a third UL with done shipment::
>>> order.lines[0].ul_quantity += 1
>>> order.save()
>>> ul = create_unit_load(config=config, do_state=False,
... default_values={'start_date': datetime.datetime.now() + relativedelta(days=-1)})
>>> ul.product = main_product
>>> ul.save()
>>> move = ul.moves.new()
>>> move.planned_date = today
>>> move.product = product
>>> move.quantity = Decimal(2)
>>> move.from_location = ul.moves[0].from_location
>>> move.to_location = ul.moves[0].to_location
>>> move.currency = move.company.currency
>>> ul.save()
>>> ul.click('assign')
>>> ul.click('do')
>>> Model.get('res.user.warning')(user=config.user,
... name='loading_ul_origin_4', always=True).save()
>>> start_load = Wizard('carrier.load_uls', [order])
>>> shipment.click('done')
>>> shipment.state
'done'
>>> start_load.form.ul_code = ul.code
>>> start_load.execute('load_')
>>> shipment.reload()
>>> len(shipment.unit_loads)
3
>>> list(set(m.state for m in shipment.outgoing_moves))
['done']
>>> list(set(m.state for m in shipment.inventory_moves))
['done']
Confirm load::
>>> load.click('confirm')