[FIX] stock : return serial number
When an operation has the check for create new lots/serial numbers activated and it exists a return that use this operation. The return with serial number is not possible since it will display the view for creating new serial number while we are returning some of them. Trying to add the serial number name will fail due to the constraint that ensure maximum one specific serial number by product. This commit change the context before calling the view in order to always display the many2one lot_id if the move is a return.
This commit is contained in:
@@ -431,8 +431,8 @@ class StockMove(models.Model):
|
||||
'res_id': self.id,
|
||||
'context': dict(
|
||||
self.env.context,
|
||||
show_lots_m2o=self.has_tracking != 'none' and (self.picking_type_id.use_existing_lots or self.state == 'done'), # able to create lots, whatever the value of ` use_create_lots`.
|
||||
show_lots_text=self.has_tracking != 'none' and self.picking_type_id.use_create_lots and not self.picking_type_id.use_existing_lots and self.state != 'done',
|
||||
show_lots_m2o=self.has_tracking != 'none' and (self.picking_type_id.use_existing_lots or self.state == 'done' or self.origin_returned_move_id.id), # able to create lots, whatever the value of ` use_create_lots`.
|
||||
show_lots_text=self.has_tracking != 'none' and self.picking_type_id.use_create_lots and not self.picking_type_id.use_existing_lots and self.state != 'done' and not self.origin_returned_move_id.id,
|
||||
show_source_location=self.location_id.child_ids,
|
||||
show_destination_location=self.location_dest_id.child_ids,
|
||||
show_package=not self.location_id.usage == 'supplier',
|
||||
|
||||
Reference in New Issue
Block a user