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
|
|
@ -31,6 +31,7 @@ El Usuario que crea la orden es el encargado de distribuir los productos al rest
|
||||||
'views/actions.xml',
|
'views/actions.xml',
|
||||||
'views/menus.xml',
|
'views/menus.xml',
|
||||||
'views/partner_node_views.xml',
|
'views/partner_node_views.xml',
|
||||||
|
'views/partner_net_views.xml',
|
||||||
],
|
],
|
||||||
'demo': [],
|
'demo': [],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
from . import purchase_collective
|
from . import purchase_collective
|
||||||
from . import sale_order
|
from . import sale_order
|
||||||
from . import partner_node
|
from . import partner_node
|
||||||
|
from . import partner_network
|
||||||
|
|
|
||||||
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)
|
||||||
|
|
||||||
28
purchase_collective/views/partner_net_views.xml
Normal file
28
purchase_collective/views/partner_net_views.xml
Normal 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>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue