add rec_names
This commit is contained in:
parent
ae62a07fe1
commit
253500af41
@ -18,7 +18,10 @@ from datetime import timedelta
|
|||||||
class Contract(Workflow, ModelSQL, ModelView):
|
class Contract(Workflow, ModelSQL, ModelView):
|
||||||
'Contracts'
|
'Contracts'
|
||||||
__name__ = 'optical_equipment.contract'
|
__name__ = 'optical_equipment.contract'
|
||||||
|
_rec_name = 'number'
|
||||||
|
_order_name = 'number'
|
||||||
|
|
||||||
|
|
||||||
company = fields.Many2One(
|
company = fields.Many2One(
|
||||||
'company.company', "Company", required=True, select=True,
|
'company.company', "Company", required=True, select=True,
|
||||||
states={
|
states={
|
||||||
@ -74,6 +77,10 @@ class Contract(Workflow, ModelSQL, ModelView):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(Contract, cls).__setup__()
|
super(Contract, cls).__setup__()
|
||||||
|
cls._order = [
|
||||||
|
('number', 'DESC NULLS FIRST'),
|
||||||
|
('id', 'DESC'),
|
||||||
|
]
|
||||||
cls._transitions = ({
|
cls._transitions = ({
|
||||||
('draft', 'running'),
|
('draft', 'running'),
|
||||||
('running', 'closed'),
|
('running', 'closed'),
|
||||||
|
11
equipment.py
11
equipment.py
@ -18,6 +18,8 @@ _MAINTENANCE_FREQUENCY = [("none", ''),
|
|||||||
class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||||
'Optical Equipment'
|
'Optical Equipment'
|
||||||
__name__ = 'optical_equipment.equipment'
|
__name__ = 'optical_equipment.equipment'
|
||||||
|
_rec_name = 'rec_name'
|
||||||
|
_order_name = 'code'
|
||||||
|
|
||||||
_states={
|
_states={
|
||||||
'readonly': Eval('state') != 'draft',
|
'readonly': Eval('state') != 'draft',
|
||||||
@ -113,9 +115,16 @@ class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
|||||||
)
|
)
|
||||||
shipment_destination = fields.Reference("Stock Move", selection='get_shipment', select=True,
|
shipment_destination = fields.Reference("Stock Move", selection='get_shipment', select=True,
|
||||||
states={'readonly': True})
|
states={'readonly': True})
|
||||||
|
rec_name = fields.Function(fields.Char("rec_name"), 'get_rec_name')
|
||||||
|
|
||||||
del _states_serial, _states, _depends
|
del _states_serial, _states, _depends
|
||||||
|
|
||||||
|
|
||||||
|
@fields.depends('product', 'serial', 'code')
|
||||||
|
def get_rec_name(self, name):
|
||||||
|
name = str(self.product.name) + '@' + str(self.serial) + '/' + str(self.code)
|
||||||
|
|
||||||
|
return name
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_shipment():
|
def _get_shipment():
|
||||||
'Return list of Model names for shipment Reference'
|
'Return list of Model names for shipment Reference'
|
||||||
|
@ -23,7 +23,10 @@ _digits = (16, 2)
|
|||||||
class MaintenanceService(Workflow, ModelSQL, ModelView):
|
class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||||
'Equipment Maintenance Service'
|
'Equipment Maintenance Service'
|
||||||
__name__ = 'optical_equipment_maintenance.service'
|
__name__ = 'optical_equipment_maintenance.service'
|
||||||
|
_rec_name = 'rec_name'
|
||||||
|
_order_name = 'code'
|
||||||
|
|
||||||
|
|
||||||
_states = {'readonly': If(Eval('state') != 'draft', True)}
|
_states = {'readonly': If(Eval('state') != 'draft', True)}
|
||||||
|
|
||||||
code = fields.Char("Code", readonly=True, select=True)
|
code = fields.Char("Code", readonly=True, select=True)
|
||||||
@ -60,8 +63,18 @@ class MaintenanceService(Workflow, ModelSQL, ModelView):
|
|||||||
('failed', "Failed"),
|
('failed', "Failed"),
|
||||||
('finished', "Finished")
|
('finished', "Finished")
|
||||||
], "State", required=True, readonly=True, sort=True)
|
], "State", required=True, readonly=True, sort=True)
|
||||||
|
|
||||||
|
|
||||||
|
rec_name = fields.Function(fields.Char('rec_name'), 'get_rec_name')
|
||||||
|
|
||||||
|
@fields.depends('maintenance_type', 'code')
|
||||||
|
def get_rec_name(self, name):
|
||||||
|
if self.maintenance_type and self.code:
|
||||||
|
name = str(self.maintenance_type) + '@' + str(self.code)
|
||||||
|
else:
|
||||||
|
name = str(self.maintenance_type) + '@' + 'Borrador'
|
||||||
|
|
||||||
|
return name
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
super(MaintenanceService, cls).__setup__()
|
super(MaintenanceService, cls).__setup__()
|
||||||
@ -244,6 +257,34 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
|||||||
def default_state_agended(cls):
|
def default_state_agended(cls):
|
||||||
return 'no_agenda'
|
return 'no_agenda'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_initial_operation(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_check_equipment(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_check_electric_system(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_clean_int_ext(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_clean_eyes(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_optical(self):
|
||||||
|
return True
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_check_calibration(self):
|
||||||
|
return True
|
||||||
|
|
||||||
def get_standard_deviation(samples):
|
def get_standard_deviation(samples):
|
||||||
"""
|
"""
|
||||||
This function calculated the
|
This function calculated the
|
||||||
|
@ -3,12 +3,10 @@
|
|||||||
this repository contains the full copyright notices and license terms.-->
|
this repository contains the full copyright notices and license terms.-->
|
||||||
<tree>
|
<tree>
|
||||||
<field name="code"/>
|
<field name="code"/>
|
||||||
|
<field name="propietary" xexpand="1"/>
|
||||||
|
<field name="propietary_address" xexpand="1"/>
|
||||||
<field name="sale_origin"/>
|
<field name="sale_origin"/>
|
||||||
<field name="sale_date"/>
|
<field name="sale_date"/>
|
||||||
<field name="estimated_agended" widget="date"/>
|
|
||||||
<field name="estimated_agended" string="Time" widget="time"/>
|
|
||||||
<field name="technical"/>
|
<field name="technical"/>
|
||||||
<field name="propietary"/>
|
|
||||||
<field name="propietary_address"/>
|
|
||||||
<field name="lines" string="# Equipments"/>
|
<field name="lines" string="# Equipments"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
Loading…
Reference in New Issue
Block a user