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:
parent
72e7b5087e
commit
fecbdb7a9c
12 changed files with 73 additions and 88 deletions
25
purchase_collective/models/partner_node.py
Normal file
25
purchase_collective/models/partner_node.py
Normal 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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue