修改维保生成编码和名称的规则

This commit is contained in:
qihao.gong@jikimo.com
2023-09-26 17:29:14 +08:00
parent 9c2d4dbc24
commit 22a4ccad6b
8 changed files with 38 additions and 12 deletions

View File

@@ -6,8 +6,8 @@ from dateutil.relativedelta import relativedelta
class MaintenanceEquipment(models.Model):
_inherit = "maintenance.equipment"
_check_company_auto = True
production_line_id = fields.Many2one('sf.production.line', string='生产线')
expected_mtbf = fields.Integer(string='Expected MTBF', help='Expected Mean Time Between Failure')
mtbf = fields.Integer(compute='_compute_maintenance_request', string='MTBF',
help='Mean Time Between Failure, computed based on done corrective maintenances.')
@@ -16,8 +16,6 @@ class MaintenanceEquipment(models.Model):
string='Estimated time before next failure (in days)',
help='Computed as Latest Failure Date + MTBF')
latest_failure_date = fields.Date(compute='_compute_maintenance_request', string='Latest Failure Date')
workcenter_id = fields.Many2one(
'mrp.workcenter', string='Work Center', check_company=True)
@api.depends('effective_date', 'maintenance_ids.stage_id', 'maintenance_ids.close_date',
'maintenance_ids.request_date')

View File

@@ -10,12 +10,10 @@ class ResWorkcenter(models.Model):
# 生产线显示
production_line_show = fields.Char(string='生产线名称')
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
production_line_id = fields.Many2one('sf.production.line', string='生产线')
equipment_id = fields.Many2one(
'maintenance.equipment', string="设备",
check_company=True)
)
production_line_id = fields.Many2one('sf.production.line', string='生产线')
is_process_outsourcing = fields.Boolean('工艺外协')
users_ids = fields.Many2many("res.users", 'users_workcenter')

View File

@@ -22,6 +22,7 @@ class ProductionLine(models.Model):
return num
mrp_workcenter_ids = fields.One2many('mrp.workcenter', 'production_line_id', '工作中心')
mrp_manufacturing_ids = fields.One2many('maintenance.equipment', 'production_line_id', '设备')
name = fields.Char('生产线', size=20, required=True)
code = fields.Char('编码', default=_get_code, readonly=True)
remark = fields.Char('备注')