diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index d6f8a88a..7e53ef7b 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -10,7 +10,7 @@ """, 'category': 'sf', 'website': 'https://www.sf.jikimo.com', - 'depends': ['account', 'base', 'mrp'], + 'depends': ['account', 'base', 'mrp_workorder'], 'data': [ 'security/group_security.xml', 'security/ir.model.access.csv', diff --git a/sf_maintenance/models/sf_equipment_maintenance_standards.py b/sf_maintenance/models/sf_equipment_maintenance_standards.py index ebf42b37..804a80e1 100644 --- a/sf_maintenance/models/sf_equipment_maintenance_standards.py +++ b/sf_maintenance/models/sf_equipment_maintenance_standards.py @@ -53,15 +53,11 @@ class SfEquipmentSaintenanceStandards(models.Model): class SfSaintenanceStandards(models.Model): _name = 'maintenance.standards' _description = '维保项目' - _order = 'sequence, id' name = fields.Char('维保项目') maintenance_standards = fields.Char('维保标准') equipment_maintenance_standards_id = fields.Many2one('equipment.maintenance.standards', string='设备维保标准') maintenance_request_id = fields.Many2one('maintenance.request', string='设备维保计划') - cycle = fields.Integer('频次/周期') - device_unit = fields.Char('设备单元') - sequence = fields.Integer('序列号') diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py index 911c043b..a541185a 100644 --- a/sf_maintenance/models/sf_maintenance.py +++ b/sf_maintenance/models/sf_maintenance.py @@ -47,6 +47,7 @@ class SfMaintenanceEquipment(models.Model): overhaul_id = fields.Many2one('equipment.maintenance.standards', string='设备检修标准', domain="[('maintenance_type','=','检修')]") + @api.onchange('eq_maintenance_id', 'overhaul_id') def _compute_equipment_maintenance_standards_ids(self): for record in self: @@ -88,8 +89,9 @@ class SfMaintenanceEquipment(models.Model): control_system_id = fields.Many2one('sf.machine.control_system', string="控制系统") # 多个机床型号对应一个机床 - type_id = fields.Many2one('sf.machine_tool.type', '型号') brand_id = fields.Many2one('sf.machine.brand', string='品牌') + type_id = fields.Many2one('sf.machine_tool.type', '型号') + state = fields.Selection( [("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")], default='正常', string="机床状态") @@ -414,7 +416,6 @@ class SfMaintenanceEquipment(models.Model): 'company_id': self.company_id.id or self.env.company.id, 'equipment_maintenance_id': self.eq_maintenance_id.id, 'sf_maintenance_type': '保养' - } # 拼接维保请求字符串 diff --git a/sf_maintenance/models/sf_maintenance_requests.py b/sf_maintenance/models/sf_maintenance_requests.py index 1de354fe..b7c001eb 100644 --- a/sf_maintenance/models/sf_maintenance_requests.py +++ b/sf_maintenance/models/sf_maintenance_requests.py @@ -25,9 +25,7 @@ class SfMaintenanceEquipmentCategory(models.Model): if not record.equipment_maintenance_id: record.equipment_maintenance_id = False - - - maintenance_standards = fields.One2many('maintenance.standards','maintenance_request_id', string='维保标准', related='equipment_maintenance_id.maintenance_standards_ids') + maintenance_standards = fields.One2many('maintenance.standards','maintenance_request_id', string='维保标准') @api.constrains('equipment_maintenance_id') def _check_equipment_maintenance_id(self): diff --git a/sf_maintenance/views/equipment_maintenance_standards_views.xml b/sf_maintenance/views/equipment_maintenance_standards_views.xml index 4807d5cc..82fbf15b 100644 --- a/sf_maintenance/views/equipment_maintenance_standards_views.xml +++ b/sf_maintenance/views/equipment_maintenance_standards_views.xml @@ -29,19 +29,6 @@ - - - - - - - - - - - - - diff --git a/sf_maintenance/views/maintenance_request_views.xml b/sf_maintenance/views/maintenance_request_views.xml index 1460bf36..c942deac 100644 --- a/sf_maintenance/views/maintenance_request_views.xml +++ b/sf_maintenance/views/maintenance_request_views.xml @@ -20,14 +20,12 @@ - - + - diff --git a/sf_maintenance/views/maintenance_views.xml b/sf_maintenance/views/maintenance_views.xml index 0620d90d..3738896c 100644 --- a/sf_maintenance/views/maintenance_views.xml +++ b/sf_maintenance/views/maintenance_views.xml @@ -17,17 +17,22 @@ maintenance.equipment + + + + + - - - - + + + @@ -36,21 +41,55 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + - - - - - + + + @@ -115,8 +159,8 @@ - + @@ -206,9 +250,9 @@ groups="maintenance.group_equipment_manager,base.group_user" sequence="2"/> - - - + + +