al confirmar una orden, asigna el warehouse al correspondiente al nodo del usuario

This commit is contained in:
santiky 2022-04-20 17:13:30 +02:00
parent 808e60729f
commit 5d4cbd476f
Signed by: snt
GPG key ID: A9FD34930EADBE71
3 changed files with 9 additions and 2 deletions

View file

@ -1,6 +1,7 @@
import random
from odoo import models, api, fields
from odoo.exceptions import ValidationError, Warning
class SaleOrder(models.Model):
@ -14,3 +15,9 @@ class SaleOrder(models.Model):
)
is_cp = fields.Boolean(string="Is part of a Collective Purchase")
@api.multi
def action_confirm(self):
for order in self:
order.warehouse_id = order.partner_id.node_id.wh_id
return super(SaleOrder, self).action_confirm()