tabs in maintenance
This commit is contained in:
parent
610106befe
commit
50f6249562
@ -16,6 +16,7 @@ def register():
|
|||||||
equipment.OpticalEquipment,
|
equipment.OpticalEquipment,
|
||||||
configuration_equipment.Configuration,
|
configuration_equipment.Configuration,
|
||||||
maintenance.Maintenance,
|
maintenance.Maintenance,
|
||||||
|
maintenance.MaintenanceActivity,
|
||||||
maintenance.MaintenanceLine,
|
maintenance.MaintenanceLine,
|
||||||
subscription.Subscription,
|
subscription.Subscription,
|
||||||
subscription.SubscriptionEquipment,
|
subscription.SubscriptionEquipment,
|
||||||
|
@ -32,11 +32,17 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
|||||||
#when the maintenance is in agended status
|
#when the maintenance is in agended status
|
||||||
diary = fields.One2Many('optical_equipment.maintenance.diary', 'diary')
|
diary = fields.One2Many('optical_equipment.maintenance.diary', 'diary')
|
||||||
estimated_agended = fields.DateTime("Date Maintenance")
|
estimated_agended = fields.DateTime("Date Maintenance")
|
||||||
|
state_agended = fields.Selection([('no_agenda', "No agenda"),
|
||||||
|
('agended', "Agended"),
|
||||||
|
('in_progress', "In progress"),
|
||||||
|
('finish', "Finish"),
|
||||||
|
('failed', "Failed")], "State Agenda")
|
||||||
technical = fields.Many2One('company.employee', "Technical")
|
technical = fields.Many2One('company.employee', "Technical")
|
||||||
|
|
||||||
maintenance_lines = fields.One2Many('optical_equipment.maintenance.line', 'maintenance_activity',
|
#Preventive maintenance
|
||||||
'Maintenance Lines', states={
|
|
||||||
'readonly': Eval('state') != 'draft',})
|
# maintenance_activity = fields.Many2Many('optical_equipment.maintenance-product.product', 'activity', 'maintenance', "Maintenance Activitys")
|
||||||
|
maintenance_lines = fields.One2Many('optical_equipment.maintenance.line', 'maintenance', 'Lines')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def __setup__(cls):
|
def __setup__(cls):
|
||||||
@ -52,7 +58,6 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
|||||||
'in_progress': {},
|
'in_progress': {},
|
||||||
'finished': {},
|
'finished': {},
|
||||||
})
|
})
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
return Transaction().context.get('company')
|
return Transaction().context.get('company')
|
||||||
@ -61,6 +66,10 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
|||||||
def default_state(cls):
|
def default_state(cls):
|
||||||
return 'draft'
|
return 'draft'
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def default_state_agended(cls):
|
||||||
|
return 'no_agenda'
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ModelView.button
|
@ModelView.button
|
||||||
@Workflow.transition('draft')
|
@Workflow.transition('draft')
|
||||||
@ -85,12 +94,22 @@ class Maintenance(Workflow, ModelSQL, ModelView):
|
|||||||
def finished(cls, maintenances):
|
def finished(cls, maintenances):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class MaintenanceActivity(ModelSQL):
|
||||||
|
'Maintenance - Products'
|
||||||
|
__name__ = 'optical_equipment.maintenance-product.product'
|
||||||
|
|
||||||
|
activity = fields.Many2One('product.product', "Activity", select=True)
|
||||||
|
maintenance = fields.Many2One('optical_equipment.maintenance', "Maintenance", select=True)
|
||||||
|
|
||||||
class MaintenanceLine(ModelSQL, ModelView):
|
class MaintenanceLine(ModelSQL, ModelView):
|
||||||
'Maintenance Line'
|
'Maintenance Line'
|
||||||
__name__ = 'optical_equipment.maintenance.line'
|
__name__ = 'optical_equipment.maintenance.line'
|
||||||
|
|
||||||
|
product = fields.Many2One('product.product', 'Product',
|
||||||
|
ondelete='RESTRICT',domain=[
|
||||||
|
If(Eval('sale_state').in_(['draft']),
|
||||||
|
('maintenance_activity', '=', True),
|
||||||
|
()),
|
||||||
|
],)
|
||||||
maintenance = fields.Many2One('optical_equipment.maintenance', 'Maintenance', ondelete='CASCADE', select=True)
|
maintenance = fields.Many2One('optical_equipment.maintenance', 'Maintenance', ondelete='CASCADE', select=True)
|
||||||
maintenance_activity = fields.Many2One('product.product', 'Maintenance activity',
|
maintenance_activity = fields.Many2One('product.product', 'Maintenance activity')
|
||||||
ondelete='RESTRICT',
|
|
||||||
domain=[If(Eval('state').in_(['draft']),
|
|
||||||
('maintenance_activity', '=', True),()),])
|
|
||||||
|
@ -94,5 +94,10 @@
|
|||||||
action="act_maintenance_form"
|
action="act_maintenance_form"
|
||||||
sequence="30"
|
sequence="30"
|
||||||
id="menu_maintenance_form"/>
|
id="menu_maintenance_form"/>
|
||||||
|
<record model="ir.ui.view" id="maintenance_line_view_tree">
|
||||||
|
<field name="model">optical_equipment.maintenance.line</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="name">maintenance_line_form</field>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
@ -15,15 +15,26 @@
|
|||||||
<label name="equipment"/>
|
<label name="equipment"/>
|
||||||
<field name="equipment"/>
|
<field name="equipment"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
|
<notebook colspan="6">
|
||||||
|
<page string="Agended" id="agended">
|
||||||
<label name="estimated_agended"/>
|
<label name="estimated_agended"/>
|
||||||
<field name="estimated_agended"/>
|
<field name="estimated_agended"/>
|
||||||
<newline/>
|
|
||||||
<label name="technical"/>
|
<label name="technical"/>
|
||||||
<field name="technical"/>
|
<field name="technical"/>
|
||||||
<newline/>
|
<label name="state_agended"/>
|
||||||
|
<field name="state_agended"/>
|
||||||
|
</page>
|
||||||
|
<page string="Preventive" id="preventive">
|
||||||
<label name="maintenance_lines"/>
|
<label name="maintenance_lines"/>
|
||||||
<field name="maintenance_lines"/>
|
<field name="maintenance_lines"/>
|
||||||
<field name="maintenance_lines"/>
|
<field name="maintenance_lines"/>
|
||||||
|
</page>
|
||||||
|
<page string="Corrective" id="corrective">
|
||||||
|
<label name="maintenance_lines"/>
|
||||||
|
<field name="maintenance_lines"/>
|
||||||
|
<field name="maintenance_lines"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label name="state"/>
|
<label name="state"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user