修改故障日志bug
This commit is contained in:
@@ -2,8 +2,8 @@ from . import model_type
|
||||
from . import product_template
|
||||
from . import mrp_production
|
||||
from . import mrp_workorder
|
||||
from . import mrp_workcenter
|
||||
from . import mrp_maintenance
|
||||
from . import mrp_workcenter
|
||||
from . import mrp_routing_workcenter
|
||||
from . import stock
|
||||
from . import res_user
|
||||
|
||||
@@ -62,3 +62,8 @@ class MaintenanceRequest(models.Model):
|
||||
'mrp.workorder', string='Work Order', check_company=True)
|
||||
production_company_id = fields.Many2one(string='Production Company', related='production_id.company_id')
|
||||
company_id = fields.Many2one(domain="[('id', '=?', production_company_id)]")
|
||||
|
||||
class SfMaintenanceLogs(models.Model):
|
||||
_inherit = 'sf.maintenance.logs'
|
||||
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', related='maintenance_equipment_id.production_line_id', store=True)
|
||||
|
||||
@@ -9,11 +9,10 @@ class ResWorkcenter(models.Model):
|
||||
|
||||
# 生产线显示
|
||||
production_line_show = fields.Char(string='生产线名称')
|
||||
machine_tool_id = fields.Many2one('sf.machine_tool', string='机床')
|
||||
equipment_id = fields.Many2one(
|
||||
'maintenance.equipment', string="设备",
|
||||
)
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线')
|
||||
production_line_id = fields.Many2one('sf.production.line', string='生产线', related='equipment_id.production_line_id', store=True)
|
||||
|
||||
is_process_outsourcing = fields.Boolean('工艺外协')
|
||||
users_ids = fields.Many2many("res.users", 'users_workcenter')
|
||||
@@ -23,13 +22,13 @@ class ResWorkcenter(models.Model):
|
||||
|
||||
equipment_status = fields.Selection(
|
||||
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
||||
string="设备状态", compute='_compute_equipment_id')
|
||||
string="设备状态", related='equipment_id.state')
|
||||
|
||||
@api.depends('equipment_id')
|
||||
def _compute_equipment_id(self):
|
||||
for record in self:
|
||||
if record:
|
||||
record.equipment_status = record.equipment_id.state
|
||||
# @api.depends('equipment_id')
|
||||
# def _compute_equipment_id(self):
|
||||
# for record in self:
|
||||
# if record:
|
||||
# record.equipment_status = record.equipment_id.state
|
||||
|
||||
equipment_image = fields.Binary('设备图片', related='equipment_id.machine_tool_picture')
|
||||
|
||||
@@ -38,23 +37,23 @@ class ResWorkcenter(models.Model):
|
||||
outsourcing_workcenter = self.env['mrp.workcenter'].search([('is_process_outsourcing', '=', True)])
|
||||
return outsourcing_workcenter.id
|
||||
|
||||
@api.onchange('machine_tool_id')
|
||||
def update_machine_tool_is_binding(self):
|
||||
machine_tool = self.env["sf.machine_tool"].search([('is_binding', '=', True)])
|
||||
if machine_tool:
|
||||
for item in machine_tool:
|
||||
workcenter_machine_tool = self.env["mrp.workcenter"].search([('machine_tool_id', '=', item.id)])
|
||||
if workcenter_machine_tool:
|
||||
if self.machine_tool_id.id:
|
||||
if workcenter_machine_tool.id != self.machine_tool_id.id:
|
||||
self.machine_tool_id.is_binding = True
|
||||
else:
|
||||
self.machine_tool_id.is_binding = True
|
||||
else:
|
||||
self.machine_tool_id.is_binding = True
|
||||
item.is_binding = False
|
||||
else:
|
||||
self.machine_tool_id.is_binding = True
|
||||
# @api.onchange('machine_tool_id')
|
||||
# def update_machine_tool_is_binding(self):
|
||||
# machine_tool = self.env["sf.machine_tool"].search([('is_binding', '=', True)])
|
||||
# if machine_tool:
|
||||
# for item in machine_tool:
|
||||
# workcenter_machine_tool = self.env["mrp.workcenter"].search([('machine_tool_id', '=', item.id)])
|
||||
# if workcenter_machine_tool:
|
||||
# if self.machine_tool_id.id:
|
||||
# if workcenter_machine_tool.id != self.machine_tool_id.id:
|
||||
# self.machine_tool_id.is_binding = True
|
||||
# else:
|
||||
# self.machine_tool_id.is_binding = True
|
||||
# else:
|
||||
# self.machine_tool_id.is_binding = True
|
||||
# item.is_binding = False
|
||||
# else:
|
||||
# self.machine_tool_id.is_binding = True
|
||||
|
||||
def action_work_order(self):
|
||||
if not self.env.context.get('desktop_list_view', False):
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
<field name="equipment_status"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='alternative_workcenter_ids']" position="after">
|
||||
<field name="production_line_id" readonly="1"/>
|
||||
<field name="production_line_id"/>
|
||||
<field name="equipment_id"/>
|
||||
<field name="production_line_show" invisible="1"/>
|
||||
</xpath>
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
sequence="20"
|
||||
action="sf_production_line_act"/>
|
||||
|
||||
<!-- 设备新增生产线-->
|
||||
<record id="sf_hr_equipment_view_form_manufacturing" model="ir.ui.view">
|
||||
<field name="name">sf_equipment.form</field>
|
||||
<field name="model">maintenance.equipment</field>
|
||||
@@ -93,4 +94,15 @@
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- 故障日志增加产线对象-->
|
||||
<record id="sf_view_maintenance_logs_tree" model="ir.ui.view">
|
||||
<field name="name">sf.maintenance.logs.tree</field>
|
||||
<field name="model">sf.maintenance.logs</field>
|
||||
<field name="inherit_id" ref="sf_maintenance.view_maintenance_logs_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='code']" position="after">
|
||||
<field name="production_line_id"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user