No need for the processes field in products and use process in product - bom relationship.

This commit is contained in:
Albert Cervera i Areny 2014-05-14 19:26:52 +02:00
parent b2d597d36d
commit 35319ad472
7 changed files with 32 additions and 49 deletions

View File

@ -15,6 +15,5 @@ def register():
Route,
BOM,
Production,
Product,
ProductBom,
module='production_process', type_='model')

View File

@ -4,29 +4,10 @@ from trytond.model import fields
from trytond.pyson import Eval, Get, If, Bool
from trytond.pool import Pool, PoolMeta
__all__ = ['Product', 'ProductBom']
__all__ = ['ProductBom']
__metaclass__ = PoolMeta
class Product:
__name__ = 'product.product'
processes = fields.One2Many('product.product-production.bom', 'product',
'Processes', order=[('sequence', 'ASC'), ('id', 'ASC')],
states={
'invisible': Eval('type', 'service') == 'service',
},
depends=['type'])
@classmethod
def copy(cls, products, default=None):
if default is None:
default = {}
default = default.copy()
default.setdefault('processes', None)
return super(Product, cls).copy(products, default=default)
class ProductBom:
__name__ = 'product.product-production.bom'

View File

@ -3,23 +3,25 @@
copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="product-bom_view_list_process">
<record model="ir.ui.view" id="product-bom_view_list">
<field name="model">product.product-production.bom</field>
<field name="type">tree</field>
<field name="name">product_bom_list</field>
<field name="inherit" ref="production.product-bom_view_list"/>
</record>
<record model="ir.ui.view" id="product-bom_view_form_process">
<record model="ir.ui.view" id="product-bom_view_list_sequence">
<field name="model">product.product-production.bom</field>
<field name="type">tree</field>
<field name="name">product_bom_list_sequence</field>
<field name="inherit" ref="production.product-bom_view_list_sequence"/>
</record>
<record model="ir.ui.view" id="product-bom_view_form">
<field name="model">product.product-production.bom</field>
<field name="type">form</field>
<field name="name">product_bom_form</field>
</record>
<record model="ir.ui.view" id="product_view_form">
<field name="model">product.product</field>
<field name="inherit" ref="product.product_view_form"/>
<field name="name">product_form</field>
<field name="inherit" ref="production.product-bom_view_form"/>
</record>
</data>
</tryton>

View File

@ -1,9 +1,10 @@
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<form string="Product - Process" col="4">
<label name="process"/>
<field name="process" widget="selection"/>
<label name="sequence"/>
<field name="sequence"/>
</form>
<data>
<xpath expr="/form/label[@name='bom']" position="before">
<newline/>
<label name="process"/>
<field name="process"/>
</xpath>
</data>

View File

@ -1,7 +1,8 @@
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<tree string="Product - Process" sequence="sequence">
<field name="process"/>
<field name="sequence" tree_invisible="1"/>
</tree>
<data>
<xpath expr="/tree/field[@name='bom']" position="before">
<field name="process"/>
</xpath>
</data>

View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<data>
<xpath expr="/tree/field[@name='bom']" position="before">
<field name="process"/>
</xpath>
</data>

View File

@ -1,9 +0,0 @@
<?xml version="1.0"?>
<!-- The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license terms. -->
<data>
<xpath expr="/form/field[@name='boms']" position="replace">
<field name="processes" colspan="6"
view_ids="production_process.product-bom_view_list_process,production_process.product-bom_view_form_process"/>
</xpath>
</data>