fix create and write methods
This commit is contained in:
parent
1f832980b3
commit
a4c09d597e
1 changed files with 3 additions and 3 deletions
|
@ -41,7 +41,7 @@ class Picking(models.Model):
|
|||
for picking in self:
|
||||
if not picking.partner_id:
|
||||
return
|
||||
_logger.debug("onchange %s %s", picking.location_dest_id.name, picking.location_id.name) # web cliebt does not update without this, wtf?
|
||||
_logger.debug("onchange %s %s", picking.location_dest_id.name, picking.location_id.name) # web client does not update without this, wtf?
|
||||
if picking.picking_type_id.is_deposit:
|
||||
if picking.picking_type_id.code in ["internal","outgoing"]:
|
||||
if not picking.partner_id.deposit_sale_accept:
|
||||
|
@ -63,12 +63,12 @@ class Picking(models.Model):
|
|||
def change_dest_location(self, vals, code):
|
||||
if vals.get("partner_id"):
|
||||
partner = self.env["res.partner"].browse(vals.get("partner_id"))
|
||||
if code == "internal":
|
||||
if code in ["internal", "outgoing"]:
|
||||
if not partner.deposit_sale_accept:
|
||||
raise ValidationError("Éste cliente no acepta material en depósito, configúralo antes de crear un depósito para él.")
|
||||
return
|
||||
vals.update({
|
||||
"location_dest_id": partner.deposit_sale_location_id.id,
|
||||
"location_id": partner.deposit_sale_location_id.id,
|
||||
})
|
||||
elif code == 'incoming':
|
||||
if not partner.deposit_buy_accept:
|
||||
|
|
Loading…
Add table
Reference in a new issue