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

@ -31,6 +31,7 @@ El Usuario que crea la orden es el encargado de distribuir los productos al rest
'views/actions.xml',
'views/menus.xml',
'views/partner_node_views.xml',
'views/partner_net_views.xml',
],
'demo': [],
'installable': True,

View file

@ -1,3 +1,4 @@
from . import purchase_collective
from . import sale_order
from . import partner_node
from . import partner_network

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)

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record id="view_partner_network_net_inherit_pc_form" model="ir.ui.view">
<field name="name">partner.net.form.wh.view</field>
<field name="model">partner.network</field>
<field name="inherit_id" ref="network_partner.view_partner_network_net_form"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="wh_id"/>
</field>
</field>
</record>
<record id="view_partner_network_net_inherit_pc_tree" model="ir.ui.view">
<field name="name">partner.net.tree.wh.view</field>
<field name="model">partner.network</field>
<field name="inherit_id" ref="network_partner.view_partner_network_net_tree"/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="wh_id"/>
</field>
</field>
</record>
</data>
</odoo>