add views to product and add model sale.line and views
This commit is contained in:
parent
d877ba95d2
commit
7c9b63ec88
@ -1,7 +1,9 @@
|
||||
from trytond.pool import Pool
|
||||
from . import product
|
||||
from . import sale
|
||||
|
||||
def register():
|
||||
Pool.register(
|
||||
product.Template,
|
||||
sale.SaleLine,
|
||||
module='optical_equipment', type_='model')
|
||||
|
28
product.py
28
product.py
@ -23,7 +23,7 @@ _MAIN_TECNOLOGY = [('mecanico', 'Mecánico'),
|
||||
('hidraulico', 'Hidraulico'),
|
||||
('neumatico', 'Neumatico')]
|
||||
|
||||
_MACHINE_TYPE = [('mobiliario_optico', 'Mobiliario óptico'),
|
||||
_EQUIPMENT_TYPE = [('mobiliario_optico', 'Mobiliario óptico'),
|
||||
('refraccion', 'Refracción'),
|
||||
('medico', 'Medicion'),
|
||||
('accesorios', 'Accesorios')]
|
||||
@ -33,8 +33,8 @@ class Template(metaclass=PoolMeta):
|
||||
'Template'
|
||||
__name__ = 'product.template'
|
||||
|
||||
machine = fields.Boolean('It is machine')
|
||||
machine_type = fields.Selection(_MACHINE_TYPE, 'Machine type')
|
||||
equipment = fields.Boolean('It is equipment')
|
||||
equipment_type = fields.Selection(_EQUIPMENT_TYPE, 'Equipment type')
|
||||
risk = fields.Selection(_RISK, 'Type risk')
|
||||
use = fields.Selection(_USE, 'Use')
|
||||
biomedical_class = fields.Selection(_BIOMEDICAL_CLASS,
|
||||
@ -42,26 +42,10 @@ class Template(metaclass=PoolMeta):
|
||||
main_tecnology = fields.Selection(_MAIN_TECNOLOGY,
|
||||
'Main tecnology')
|
||||
calibration = fields.Boolean("Apply calibration")
|
||||
observation = fields.Text(size=None)
|
||||
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(
|
||||
"Origin country", size=None, required=True)
|
||||
useful_life = fields.Char(
|
||||
"Useful life", size=None, required=True)
|
||||
warranty = fields.Char(
|
||||
"Warranty", size=None, required=True)
|
||||
serial = fields.Char(
|
||||
"Serial", size=None, required=True)
|
||||
health_register = fields.Char(
|
||||
"Serial", size=None, required=True)
|
||||
refurbish = fields.Boolean('Refurbish')
|
||||
observation = fields.Text('Observation')
|
||||
|
||||
@staticmethod
|
||||
def default_machine():
|
||||
def default_equipment():
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
@ -97,6 +81,6 @@ class Template(metaclass=PoolMeta):
|
||||
def view_attributes(cls):
|
||||
return super(Template, cls).view_attributes() + [
|
||||
('//page[@id="features"]', 'states', {
|
||||
'invisible': ~Eval('machine'),
|
||||
'invisible': ~Eval('equipment'),
|
||||
})]
|
||||
|
||||
|
18
sale.py
18
sale.py
@ -1,6 +1,24 @@
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
from trytond.model import ModelView, ModelSQL
|
||||
from trytond.model import fields
|
||||
|
||||
|
||||
class SaleLine(ModelSQL, ModelView, metaclass=PoolMeta):
|
||||
'SaleLine'
|
||||
__name__ = 'sale.line'
|
||||
|
||||
mark_category = fields.Many2One('product.category', 'Mark')
|
||||
model_category = fields.Many2One('product.category', "Model")
|
||||
reference = fields.Char("Reference", size=None, required=True)
|
||||
origin_country = fields.Many2One('country.country',"Origin Country")
|
||||
software_version = fields.Char(
|
||||
"Origin country", size=None, required=True)
|
||||
useful_life = fields.Char(
|
||||
"Useful life", size=None, required=True)
|
||||
warranty = fields.Char(
|
||||
"Warranty", size=None, required=True)
|
||||
serial = fields.Char(
|
||||
"Serial", size=None, required=True)
|
||||
health_register = fields.Char(
|
||||
"Serial", size=None, required=True)
|
||||
refurbish = fields.Boolean('Refurbish')
|
||||
|
9
sale.xml
Normal file
9
sale.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="10.0"?>
|
||||
<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<record model="ir.ui.view" id="sale_line_view_form">
|
||||
<field name="model">sale.line</field>
|
||||
<field name="inherit" ref="sale.sale_line_view_form"/>
|
||||
<field name="name">sale_line_form</field>
|
||||
</record>
|
||||
</tryton>
|
@ -3,6 +3,8 @@ version=6.0
|
||||
depends:
|
||||
ir
|
||||
product
|
||||
sale
|
||||
country
|
||||
xml:
|
||||
product.xml
|
||||
sale.xml
|
27
view/sale_line_form.xml
Normal file
27
view/sale_line_form.xml
Normal file
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--This file file is part of Tryton. The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath
|
||||
expr="/form/notebook/page[@id='notes']" position="before">
|
||||
<page string="Equipment" id="equipment">
|
||||
<label name="mark_category"/>
|
||||
<field name="mark_category"/>
|
||||
<label name="model_category"/>
|
||||
<field name="model_category"/>
|
||||
<label name="refurbish"/>
|
||||
<field name="refurbish"/>
|
||||
<label name="software_version"/>
|
||||
<field name="software_version"/>
|
||||
<label name="useful_life"/>
|
||||
<field name="useful_life"/>
|
||||
<label name="warranty"/>
|
||||
<field name="warranty"/>
|
||||
<label name="serial"/>
|
||||
<field name="serial"/>
|
||||
<label name="health_register"/>
|
||||
<field name="health_register"/>
|
||||
<label name="origin_country"/>
|
||||
<field name="origin_country"/>
|
||||
</page>
|
||||
</xpath>
|
||||
</data>
|
@ -3,11 +3,15 @@
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="/form/notebook/page[@id='general']/group[@id='checkboxes']" position="inside">
|
||||
<label name="machine"/>
|
||||
<field name="machine"/>
|
||||
<label name="equipment"/>
|
||||
<field name="equipment"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='general']" position="after">
|
||||
<page string="Features" id="features">
|
||||
<label name="equipment_type"/>
|
||||
<field name="equipment_type"/>
|
||||
<label name="calibration"/>
|
||||
<field name="calibration"/>
|
||||
<label name="risk"/>
|
||||
<field name="risk"/>
|
||||
<label name="use"/>
|
||||
@ -16,6 +20,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="biomedical_class"/>
|
||||
<label name="main_tecnology"/>
|
||||
<field name="main_tecnology"/>
|
||||
<label name="observation"/>
|
||||
<field name="observation"/>
|
||||
</page>
|
||||
</xpath>
|
||||
</data>
|
||||
|
Loading…
Reference in New Issue
Block a user