add rec_names
This commit is contained in:
parent
ae62a07fe1
commit
253500af41
@ -18,6 +18,9 @@ from datetime import timedelta
|
||||
class Contract(Workflow, ModelSQL, ModelView):
|
||||
'Contracts'
|
||||
__name__ = 'optical_equipment.contract'
|
||||
_rec_name = 'number'
|
||||
_order_name = 'number'
|
||||
|
||||
|
||||
company = fields.Many2One(
|
||||
'company.company', "Company", required=True, select=True,
|
||||
@ -74,6 +77,10 @@ class Contract(Workflow, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(Contract, cls).__setup__()
|
||||
cls._order = [
|
||||
('number', 'DESC NULLS FIRST'),
|
||||
('id', 'DESC'),
|
||||
]
|
||||
cls._transitions = ({
|
||||
('draft', 'running'),
|
||||
('running', 'closed'),
|
||||
|
@ -18,6 +18,8 @@ _MAINTENANCE_FREQUENCY = [("none", ''),
|
||||
class OpticalEquipment(DeactivableMixin, Workflow, ModelSQL, ModelView):
|
||||
'Optical Equipment'
|
||||
__name__ = 'optical_equipment.equipment'
|
||||
_rec_name = 'rec_name'
|
||||
_order_name = 'code'
|
||||
|
||||
_states={
|
||||
'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,
|
||||
states={'readonly': True})
|
||||
rec_name = fields.Function(fields.Char("rec_name"), 'get_rec_name')
|
||||
|
||||
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
|
||||
def _get_shipment():
|
||||
'Return list of Model names for shipment Reference'
|
||||
|
@ -23,6 +23,9 @@ _digits = (16, 2)
|
||||
class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
'Equipment Maintenance Service'
|
||||
__name__ = 'optical_equipment_maintenance.service'
|
||||
_rec_name = 'rec_name'
|
||||
_order_name = 'code'
|
||||
|
||||
|
||||
_states = {'readonly': If(Eval('state') != 'draft', True)}
|
||||
|
||||
@ -61,6 +64,16 @@ class MaintenanceService(Workflow, ModelSQL, ModelView):
|
||||
('finished', "Finished")
|
||||
], "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
|
||||
def __setup__(cls):
|
||||
@ -244,6 +257,34 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
||||
def default_state_agended(cls):
|
||||
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):
|
||||
"""
|
||||
This function calculated the
|
||||
|
@ -3,12 +3,10 @@
|
||||
this repository contains the full copyright notices and license terms.-->
|
||||
<tree>
|
||||
<field name="code"/>
|
||||
<field name="propietary" xexpand="1"/>
|
||||
<field name="propietary_address" xexpand="1"/>
|
||||
<field name="sale_origin"/>
|
||||
<field name="sale_date"/>
|
||||
<field name="estimated_agended" widget="date"/>
|
||||
<field name="estimated_agended" string="Time" widget="time"/>
|
||||
<field name="technical"/>
|
||||
<field name="propietary"/>
|
||||
<field name="propietary_address"/>
|
||||
<field name="lines" string="# Equipments"/>
|
||||
</tree>
|
||||
|
Loading…
Reference in New Issue
Block a user