añadido almacén central en partner_network
This commit is contained in:
parent
fecbdb7a9c
commit
808e60729f
4 changed files with 55 additions and 0 deletions
25
purchase_collective/models/partner_network.py
Normal file
25
purchase_collective/models/partner_network.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 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)
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue