Asegura el depósito correcto de venta del cliente cuando quita stock del warehous Depósitos.

Antes podía quitar stock de otros almacenes si se queda en negativo.
This commit is contained in:
santiky 2021-09-15 19:40:01 +02:00
parent 739250c64f
commit 5fa23f8d26
Signed by: snt
GPG key ID: A9FD34930EADBE71

View file

@ -25,6 +25,10 @@ class Picking(models.Model):
super(Picking, self).onchange_picking_type()
if self.picking_type_id.is_deposit and self.partner_id:
self.change_dest_location()
if self.partner_id and self.location_id == self.env.ref("stock_picking_deposito.stock_location_deposits_stock"):
self.update({
'location_id': self.partner_id.deposit_sale_location_id.id,
})
def change_dest_location(self):
if self.picking_type_id.code == 'internal':