add views template
This commit is contained in:
parent
b4f4bbace3
commit
f25fd36814
@ -1,11 +1,7 @@
|
||||
from trytond.pool import Pool
|
||||
from . import product
|
||||
|
||||
|
||||
__all__ = ['register']
|
||||
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
product.Product,
|
||||
product.Template,
|
||||
module='optical_equipment', type_='model')
|
||||
|
32
product.py
32
product.py
@ -2,10 +2,9 @@
|
||||
#txhis repository contains the full copyright notices and license terms
|
||||
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import ModelView, ModelSQL
|
||||
from trytond.model import fields
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.pyson import If, Eval
|
||||
|
||||
__all__ = ['Product']
|
||||
|
||||
_RISK = [('uno', 'I'),
|
||||
('dosA', 'IIA'),
|
||||
@ -26,11 +25,12 @@ _MAIN_TECNOLOGY = [('mecanico', 'Mecánico'),
|
||||
|
||||
_MACHINE_TYPE = [('mobiliario_optico', 'Mobiliario óptico'),
|
||||
('refraccion', 'Refracción'),
|
||||
('medicio', 'Medicion'),
|
||||
('medico', 'Medicion'),
|
||||
('accesorios', 'Accesorios')]
|
||||
|
||||
class Product(ModelSQL, ModelView, metaclass=PoolMeta):
|
||||
'Product'
|
||||
|
||||
class Template(metaclass=PoolMeta):
|
||||
'Template'
|
||||
__name__ = 'product.template'
|
||||
|
||||
machine = fields.Boolean('It is machine')
|
||||
@ -43,8 +43,9 @@ class Product(ModelSQL, ModelView, metaclass=PoolMeta):
|
||||
'Main tecnology')
|
||||
calibration = fields.Boolean("Apply calibration")
|
||||
observation = fields.Text(size=None)
|
||||
trade_mark = fields.Char("Trade Mark", size=None, required=True)
|
||||
model = fields.Char("Model", size=None, required=True)
|
||||
mark_category = fields.Many2One('product.category', 'Mark')
|
||||
model_category = fields.Many2One('product.category', "Model",
|
||||
domain=[Eval('parent')])
|
||||
reference = fields.Char("Reference", size=None, required=True)
|
||||
origin_country = fields.Many2One('country.country',"Origin Country")
|
||||
software_version = fields.Char(
|
||||
@ -86,7 +87,16 @@ class Product(ModelSQL, ModelView, metaclass=PoolMeta):
|
||||
@staticmethod
|
||||
def default_refurbish():
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
@fields.depends('mark_category', 'model_category')
|
||||
def on_change_mark_category(self):
|
||||
if self.mark_category:
|
||||
self.model_category = None
|
||||
|
||||
@classmethod
|
||||
def view_attributes(cls):
|
||||
return super(Template, cls).view_attributes() + [
|
||||
('//page[@id="features"]', 'states', {
|
||||
'invisible': ~Eval('machine'),
|
||||
})]
|
||||
|
||||
|
@ -4,9 +4,9 @@
|
||||
<tryton>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="template_view_form">
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit" ref="product.template_view_form"/>
|
||||
<field name="name">template_form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit" ref="product.template_view_form"/>
|
||||
<field name="name">template_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="template_view_tree">
|
||||
<field name="model">product.template</field>
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form col="6">
|
||||
<notebook colspan="6">
|
||||
<page string="Features" id="features">
|
||||
<label name="risk"/>
|
||||
<field name="risk"/>
|
||||
<label name="use"/>
|
||||
<field name="use"/>
|
||||
<label name="biomedical_class"/>
|
||||
<field name="biomedical_class"/>
|
||||
<label name="main_tecnology"/>
|
||||
<field name="main_tecnology"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
Loading…
Reference in New Issue
Block a user