Accept Merge Request #286: (feature/修改设备模块 -> develop)

Merge Request: 修改设备模块bug

Created By: @龚启豪
Accepted By: @龚启豪
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/286?initial=true
This commit is contained in:
龚启豪
2023-07-28 15:46:37 +08:00
7 changed files with 78 additions and 54 deletions

View File

@@ -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',

View File

@@ -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('序列号')

View File

@@ -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': '保养'
}
# 拼接维保请求字符串

View File

@@ -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):

View File

@@ -29,19 +29,6 @@
<group>
<field name="maintenance_equipment_ids" widget="many2many_tags" attrs="{'invisible': [('maintenance_equipment_category_id', '=', False)]}"/>
</group>
<notebook>
<page string="维保项目">
<field name="maintenance_standards_ids" widget="ony2many">
<tree editable="top" create="true" string="维保项目">
<field name="sequence"/>
<field name="name"/>
<field name="maintenance_standards"/>
<field name="cycle"/>
<field name="device_unit"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>

View File

@@ -20,14 +20,12 @@
<notebook>
<page string="维保标准" attrs="{'invisible': [('equipment_maintenance_id', '=', False)]}">
<group>
<field name="maintenance_standards" widget="ony2many">
<tree create="False" string="维保项目">
<tree create="False">
<field name="name"/>
<field name="maintenance_standards"/>
</tree>
</field>
</group>
</page>
</notebook>

View File

@@ -17,17 +17,22 @@
<field name="model">maintenance.equipment</field>
<field name="inherit_id" ref="maintenance.hr_equipment_view_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//sheet" position="before">
<!-- <button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册"/>-->
<field name="state_zc" widget="radio" options="{'horizontal': true}"/>
</xpath>
<xpath expr="//field[@name='maintenance_team_id']" position="before">
<field name="machine_tool_picture" widget="image"/>
</xpath>
<xpath expr="//field[@name='category_id']" position="after">
<field name="code" readonly="1"/>
<field name="equipment_type"/>
<field name="type_id" attrs="{'invisible': [('equipment_type', '!=', '机床')]}" required="1"/>
<field name="brand_id" attrs="{'invisible': [('type_id', '=', False)]}"
<field name="state" widget="radio" options="{'horizontal': true}"/>
<field name="equipment_type" invisible="1"/>
<field name="brand_id" attrs="{'invisible': [('equipment_type', '!=', '机床')]}"
force_save="1"/>
<field name="type_id" attrs="{'invisible': [('equipment_type', '!=', '机床')]}" required="1" domain="[('brand_id', '=', brand_id)]"/>
<field name="machine_tool_category" readonly="1" attrs="{'invisible': [('type_id', '=', False)]}"
force_save="1"/>
</xpath>
@@ -36,21 +41,55 @@
<group string="参数">
<group>
<field name="control_system_id" options="{'no_create': True}"/>
<field name="workbench_L"/>
<field name="workbench_W"/>
<field name="machine_tool_L"/>
<field name="machine_tool_W"/>
<field name="machine_tool_H"/>
<field name="knife_type"/>
<field name="workpiece_load"/>
<field name="lead_screw"/>
<field name="taper"/>
<field name="torque"/>
<field name="motor_power"/>
<field name="number_of_knife_library" options="{'format': false}"/>
<label for="workbench_L" string="工作台[mm]"/>
<div class="o_address_format">
<label for="workbench_L" string="长"/>
<field name="workbench_L" class="o_address_zip"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="workbench_W" string="宽"/>
<field name="workbench_W" class="o_address_zip"
options="{'format': false}"/>
</div>
<!-- <field name="workbench_L"/>-->
<!-- <field name="workbench_W"/>-->
<label for="machine_tool_L" string="机床[mm]"/>
<div class="o_address_format">
<label for="machine_tool_L" string="长"/>
<field name="machine_tool_L" class="o_address_zip"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="machine_tool_W" string="宽"/>
<field name="machine_tool_W" class="o_address_zip"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="machine_tool_H" string="高"/>
<field name="machine_tool_H" class="o_address_zip"
options="{'format': false}"/>
</div>
<!-- <field name="machine_tool_L"/>-->
<!-- <field name="machine_tool_W"/>-->
<!-- <field name="machine_tool_H"/>-->
<label for="taper" string="主轴"/>
<div class="o_address_format">
<label for="taper" string="锥度(°)"/>
<field name="taper" class="o_address_zip"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="torque" string="点击扭矩(n/m)"/>
<field name="torque" class="o_address_zip"
options="{'format': false}"/>
<span>&amp;nbsp;</span>
<label for="motor_power" string="电机功率(kw)"/>
<field name="motor_power" class="o_address_zip"
options="{'format': false}"/>
<label for="motor_power" string="转速(min)"/>
<field name="rotate_speed" class="o_address_zip"
options="{'format': false}"/>
</div>
<field name="number_of_axles" widget="radio"
options="{'horizontal': true}"/>
<field name="heightened_way"/>
<label for="x_axis" string="加工行程(mm)"
attrs="{'invisible': [('number_of_axles', '=', False)]}"/>
<div class="test_model"
@@ -79,23 +118,28 @@
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"
options="{'format': false}"/>
</div>
<field name="distance"/>
<field name="precision" string="X轴定位精度(mm)"/>
<!-- <field name="taper"/>-->
<!-- <field name="torque"/>-->
<!-- <field name="motor_power"/>-->
</group>
<group>
<field name="heightened_way"/>
<field name="knife_type"/>
<field name="number_of_knife_library" options="{'format': false}"/>
<field name="tool_quality_max"/>
<field name="tool_long_max"/>
<field name="tool_diameter_max"/>
<field name="tool_speed"/>
<field name="guide_rail"/>
<field name="feed_speed"/>
<field name="tool_speed"/>
<field name="distance"/>
<field name="rotate_speed" string="主轴转速(min)"
options="{'format': false}"/>
<field name="precision" string="X轴定位精度(mm)(mm)"/>
<field name="workpiece_load"/>
<field name="lead_screw"/>
</group>
</group>
</group>
</group>
</page>
<page string="其他" attrs="{'invisible': [('type_id', '=', False)]}">
<group string="其他">
@@ -115,8 +159,8 @@
<xpath expr="//div[@class='o_row'][field[@name='maintenance_duration']]" position="after">
<field name='overhaul_id'/>
<field name='overhaul_id'/>
<field name="overhaul_date" string="下次预防检修"/>
<label for="overhaul_period" string="预防检修频次"/>
<div class="o_row">