Reports sale and maintenance_service

This commit is contained in:
cosmos 2022-10-20 23:31:33 -05:00
parent 587ff4094f
commit b64c897618
3 changed files with 1328 additions and 758 deletions

View File

@ -215,6 +215,7 @@ class Maintenance(Workflow, ModelSQL, ModelView):
states={'readonly': Eval('state') == 'finished'}) states={'readonly': Eval('state') == 'finished'})
maintenance_lines = fields.One2Many('optical_equipment.maintenance.line', 'maintenance', 'Lines') maintenance_lines = fields.One2Many('optical_equipment.maintenance.line', 'maintenance', 'Lines')
description_activity = fields.Char('Activity') description_activity = fields.Char('Activity')
next_maintenance = fields.Function(fields.Date('Next Maintenance'), 'get_next_maintenance')
@classmethod @classmethod
def __setup__(cls): def __setup__(cls):
@ -286,6 +287,15 @@ class Maintenance(Workflow, ModelSQL, ModelView):
def default_check_calibration(self): def default_check_calibration(self):
return True return True
def get_next_maintenance(self, action):
next_maintenance = None
if self.service_maintenance.estimated_agended:
if self.propietary.client_type == "ips":
next_maintenance = self.service_maintenance.estimated_agended + timedelta(days=365)
else:
next_maintenance = self.service_maintenance.estimated_agended + timedelta(days=182)
return next_maintenance
def get_standard_deviation(samples): def get_standard_deviation(samples):
""" """
This function calculated the This function calculated the

View File

@ -271,6 +271,18 @@
<field name="model">optical_equipment_maintenance.service,-1</field> <field name="model">optical_equipment_maintenance.service,-1</field>
<field name="action" ref="report_capacitation"/> <field name="action" ref="report_capacitation"/>
</record> </record>
<record model="ir.action.report" id="report_maintenance_service">
<field name="name">Maintenance Service</field>
<field name="model">optical_equipment.maintenance</field>
<field name="report_name">optical_equipment.maintenance</field>
<field name="report">report/maintenance_service.fodt</field>
<field name="single" eval="True"/>
</record>
<record model="ir.action.keyword" id="report_maintenance_service_keyword">
<field name="keyword">form_print</field>
<field name="model">optical_equipment.maintenance,-1</field>
<field name="action" ref="report_maintenance_service"/>
</record>
<!-- <!--
<menuitem parent="menu_diary" <menuitem parent="menu_diary"
action="act_maintenance_diary_calendar" action="act_maintenance_diary_calendar"

File diff suppressed because it is too large Load Diff