维保计划新增确认维保计划和标记已完成按钮,处理自动生成维保计划的方法报错的bug

This commit is contained in:
qihao.gong@jikimo.com
2023-07-05 14:32:22 +08:00
parent e6060b9bab
commit 3e6130da15
3 changed files with 12 additions and 2 deletions

View File

@@ -421,7 +421,7 @@ class SfMaintenanceEquipment(models.Model):
'owner_user_id': self.owner_user_id.id,
'user_id': self.technician_user_id.id,
'maintenance_team_id': self.maintenance_team_id.id,
'duration': self.maintenance_duration,
'duration': self.overhaul_duration,
'company_id': self.company_id.id or self.env.company.id,
'equipment_maintenance_id': self.overhaul_id.id,
'sf_maintenance_type': '检修'

View File

@@ -35,6 +35,12 @@ class SfMaintenanceEquipmentCategory(models.Model):
if not record.equipment_maintenance_id:
raise UserError(_("设备维保标准不能为空,请选择后再保存"))
def confirm_maintenance(self):
self.write({'stage_id': 2})
def confirm_maintenance_done(self):
self.write({'stage_id': 3})

View File

@@ -7,6 +7,10 @@
<field name="model">maintenance.request</field>
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='archive_equipment_request']" position="before">
<button name="confirm_maintenance" string="确认维保计划" type="object" class="btn-primary" attrs="{'invisible': [('stage_id', '!=', 1)]}" />
<button name="confirm_maintenance_done" string="标记已完成" type="object" class="btn-primary" attrs="{'invisible': [('stage_id', '!=', 2)]}" />
</xpath>
<xpath expr="//field[@name='maintenance_type']" position="replace">
<field name="sf_maintenance_type" widget="radio"/>
<field name="equipment_maintenance_id"/>