维保计划新增确认维保计划和标记已完成按钮,处理自动生成维保计划的方法报错的bug
This commit is contained in:
@@ -421,7 +421,7 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
'owner_user_id': self.owner_user_id.id,
|
'owner_user_id': self.owner_user_id.id,
|
||||||
'user_id': self.technician_user_id.id,
|
'user_id': self.technician_user_id.id,
|
||||||
'maintenance_team_id': self.maintenance_team_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,
|
'company_id': self.company_id.id or self.env.company.id,
|
||||||
'equipment_maintenance_id': self.overhaul_id.id,
|
'equipment_maintenance_id': self.overhaul_id.id,
|
||||||
'sf_maintenance_type': '检修'
|
'sf_maintenance_type': '检修'
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ class SfMaintenanceEquipmentCategory(models.Model):
|
|||||||
if not record.equipment_maintenance_id:
|
if not record.equipment_maintenance_id:
|
||||||
raise UserError(_("设备维保标准不能为空,请选择后再保存"))
|
raise UserError(_("设备维保标准不能为空,请选择后再保存"))
|
||||||
|
|
||||||
|
def confirm_maintenance(self):
|
||||||
|
self.write({'stage_id': 2})
|
||||||
|
|
||||||
|
def confirm_maintenance_done(self):
|
||||||
|
self.write({'stage_id': 3})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,10 @@
|
|||||||
<field name="model">maintenance.request</field>
|
<field name="model">maintenance.request</field>
|
||||||
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_form"/>
|
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_form"/>
|
||||||
<field name="arch" type="xml">
|
<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">
|
<xpath expr="//field[@name='maintenance_type']" position="replace">
|
||||||
<field name="sf_maintenance_type" widget="radio"/>
|
<field name="sf_maintenance_type" widget="radio"/>
|
||||||
<field name="equipment_maintenance_id"/>
|
<field name="equipment_maintenance_id"/>
|
||||||
@@ -17,7 +21,7 @@
|
|||||||
<notebook>
|
<notebook>
|
||||||
<page string="维保标准" attrs="{'invisible': [('equipment_maintenance_id', '=', False)]}">
|
<page string="维保标准" attrs="{'invisible': [('equipment_maintenance_id', '=', False)]}">
|
||||||
<group>
|
<group>
|
||||||
<field name="maintenance_standards" widget="ony2many">
|
<field name="maintenance_standards" widget="ony2many">
|
||||||
<tree create="False" string="维保项目">
|
<tree create="False" string="维保项目">
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="maintenance_standards"/>
|
<field name="maintenance_standards"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user