añadido almacén central en partner_network

This commit is contained in:
santiky 2022-04-20 16:47:24 +02:00
parent fecbdb7a9c
commit 808e60729f
Signed by: snt
GPG key ID: A9FD34930EADBE71
4 changed files with 55 additions and 0 deletions

View file

@ -0,0 +1,25 @@
# Copyright (C) 2022: Criptomart (<https://criptomart.net/>)
# @author: Criptomart (<tech@criptomart.net>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
#import logging
from odoo import models, fields, api
from odoo.exceptions import ValidationError, Warning
#_logger = logging.getLogger(__name__)
class PartnerNetwork(models.Model):
_inherit = 'partner.network'
wh_id = fields.Many2one('stock.warehouse', string="Almacén asociado", help='El almacén central donde recibe productos la red y se redistribuye a los nodos.')
@api.model
def create(self, vals):
if vals.get('wh_id', False) == False:
vals['wh_id'] = self.env['stock.warehouse'].create({
'name': vals.get('name'),
'code': vals.get('name')[4:]
}).id
return super().create(vals)