add views template
This commit is contained in:
parent
b4f4bbace3
commit
f25fd36814
@ -1,11 +1,7 @@
|
|||||||
from trytond.pool import Pool
|
from trytond.pool import Pool
|
||||||
from . import product
|
from . import product
|
||||||
|
|
||||||
|
|
||||||
__all__ = ['register']
|
|
||||||
|
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
Pool.register(
|
Pool.register(
|
||||||
product.Product,
|
product.Template,
|
||||||
module='optical_equipment', type_='model')
|
module='optical_equipment', type_='model')
|
||||||
|
28
product.py
28
product.py
@ -2,10 +2,9 @@
|
|||||||
#txhis repository contains the full copyright notices and license terms
|
#txhis repository contains the full copyright notices and license terms
|
||||||
|
|
||||||
from trytond.pool import Pool, PoolMeta
|
from trytond.pool import Pool, PoolMeta
|
||||||
from trytond.model import ModelView, ModelSQL
|
from trytond.model import ModelView, ModelSQL, fields
|
||||||
from trytond.model import fields
|
from trytond.pyson import If, Eval
|
||||||
|
|
||||||
__all__ = ['Product']
|
|
||||||
|
|
||||||
_RISK = [('uno', 'I'),
|
_RISK = [('uno', 'I'),
|
||||||
('dosA', 'IIA'),
|
('dosA', 'IIA'),
|
||||||
@ -26,11 +25,12 @@ _MAIN_TECNOLOGY = [('mecanico', 'Mecánico'),
|
|||||||
|
|
||||||
_MACHINE_TYPE = [('mobiliario_optico', 'Mobiliario óptico'),
|
_MACHINE_TYPE = [('mobiliario_optico', 'Mobiliario óptico'),
|
||||||
('refraccion', 'Refracción'),
|
('refraccion', 'Refracción'),
|
||||||
('medicio', 'Medicion'),
|
('medico', 'Medicion'),
|
||||||
('accesorios', 'Accesorios')]
|
('accesorios', 'Accesorios')]
|
||||||
|
|
||||||
class Product(ModelSQL, ModelView, metaclass=PoolMeta):
|
|
||||||
'Product'
|
class Template(metaclass=PoolMeta):
|
||||||
|
'Template'
|
||||||
__name__ = 'product.template'
|
__name__ = 'product.template'
|
||||||
|
|
||||||
machine = fields.Boolean('It is machine')
|
machine = fields.Boolean('It is machine')
|
||||||
@ -43,8 +43,9 @@ class Product(ModelSQL, ModelView, metaclass=PoolMeta):
|
|||||||
'Main tecnology')
|
'Main tecnology')
|
||||||
calibration = fields.Boolean("Apply calibration")
|
calibration = fields.Boolean("Apply calibration")
|
||||||
observation = fields.Text(size=None)
|
observation = fields.Text(size=None)
|
||||||
trade_mark = fields.Char("Trade Mark", size=None, required=True)
|
mark_category = fields.Many2One('product.category', 'Mark')
|
||||||
model = fields.Char("Model", size=None, required=True)
|
model_category = fields.Many2One('product.category', "Model",
|
||||||
|
domain=[Eval('parent')])
|
||||||
reference = fields.Char("Reference", size=None, required=True)
|
reference = fields.Char("Reference", size=None, required=True)
|
||||||
origin_country = fields.Many2One('country.country',"Origin Country")
|
origin_country = fields.Many2One('country.country',"Origin Country")
|
||||||
software_version = fields.Char(
|
software_version = fields.Char(
|
||||||
@ -87,6 +88,15 @@ class Product(ModelSQL, ModelView, metaclass=PoolMeta):
|
|||||||
def default_refurbish():
|
def default_refurbish():
|
||||||
return False
|
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'),
|
||||||
|
})]
|
||||||
|
|
||||||
|
@ -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