Finish migration to 6.0

This commit is contained in:
Sergio Morillo 2021-06-10 17:12:36 +02:00
parent 51e6f0b090
commit c795bec81c
2 changed files with 18 additions and 13 deletions

View file

@ -231,9 +231,8 @@ class ShipmentOutReturn(ShipmentWithTimeMixin, metaclass=PoolMeta):
def _get_move_planned_date(self):
return self.end_date.date(), self.planned_date
@classmethod
def _get_inventory_moves(cls, incoming_move):
res = super()._get_inventory_moves(incoming_move)
def _get_inventory_move(self, incoming_move):
res = super()._get_inventory_move(incoming_move)
res.start_date = incoming_move.end_date
res.end_date = incoming_move.end_date
return res
@ -245,14 +244,20 @@ class ShipmentOutReturn(ShipmentWithTimeMixin, metaclass=PoolMeta):
super()._set_move_planned_date(shipments)
for shipment in shipments:
outgoing_time, inventory_time = shipment._move_time()
Move.write([x for x in shipment.incoming_moves
if (x.state not in ('assigned', 'done', 'cancelled') and
x.time_ != outgoing_time)],
{'time_': outgoing_time})
Move.write([x for x in shipment.inventory_moves
if (x.state not in ('assigned', 'done', 'cancelled') and
x.time_ != inventory_time)], {
inventory_time, incoming_time = shipment._move_time()
incoming_moves = [x for x in shipment.incoming_moves
if x.state not in ('assigned', 'done', 'cancelled')
and x.time_ != incoming_time]
if incoming_moves:
Move.write(incoming_moves, {
'time_': incoming_time,
'end_date': shipment.end_date
})
inventory_moves = [x for x in shipment.inventory_moves
if x.state not in ('assigned', 'done', 'cancelled')
and x.time_ != inventory_time]
if inventory_moves:
Move.write(inventory_moves, {
'time_': inventory_time,
})

View file

@ -160,13 +160,13 @@ Check date fields::
2
>>> len(shipment_out_return.inventory_moves)
2
>>> shipment_out_return.incoming_moves[0].start_date == shipment_out_return.end_date
>>> shipment_out_return.incoming_moves[0].start_date == shipment_out_return.start_date
True
>>> shipment_out_return.incoming_moves[0].end_date == shipment_out_return.end_date
True
>>> inventory_move = shipment_out_return.inventory_moves[0]
>>> inventory_move = StockMove(inventory_move.id)
>>> inventory_move.start_date == shipment_out_return.start_date
>>> inventory_move.start_date == shipment_out_return.end_date
True
>>> inventory_move.end_date == shipment_out_return.end_date
True