añade campo warehouse a partner_node

crea un almacén al crea un nuevo nodo si no se define
movido menús al root de network_partner
This commit is contained in:
santiky 2022-04-20 15:51:27 +02:00
parent 72e7b5087e
commit fecbdb7a9c
Signed by: snt
GPG key ID: A9FD34930EADBE71
12 changed files with 73 additions and 88 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 PartnerNode(models.Model):
_inherit = 'partner.node'
wh_id = fields.Many2one('stock.warehouse', string="Almacén asociado", help='El almacén donde recibe productos el nodo y los manda a los socios finales.')
@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)