设备维保
This commit is contained in:
4
sf_maintenance/__init__.py
Normal file
4
sf_maintenance/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
23
sf_maintenance/__manifest__.py
Normal file
23
sf_maintenance/__manifest__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
{
|
||||
'name': 'sf_maintenance',
|
||||
'version': '1.0',
|
||||
'sequence': 100,
|
||||
'category': '工厂设备',
|
||||
'description': """
|
||||
Track equipments and maintenance requests""",
|
||||
'depends': ['maintenance', 'sf_base'],
|
||||
'summary': 'Track equipment and manage maintenance requests',
|
||||
'data': [
|
||||
'security/group_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'views/maintenance_views.xml',
|
||||
'views/equipment_maintenance_standards_views.xml',
|
||||
'views/maintenance_request_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
'auto_install': False,
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
3
sf_maintenance/models/__init__.py
Normal file
3
sf_maintenance/models/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*-coding:utf-8-*-
|
||||
from . import sf_maintenance
|
||||
from . import sf_equipment_maintenance_standards
|
||||
28
sf_maintenance/models/sf_equipment_maintenance_standards.py
Normal file
28
sf_maintenance/models/sf_equipment_maintenance_standards.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# -*-coding:utf-8-*-
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
class SfEquipmentSaintenanceStandards(models.Model):
|
||||
_name = 'equipment.maintenance.standards'
|
||||
_description = '设备维保标准'
|
||||
|
||||
def get_no(self):
|
||||
partner = self.env['equipment.maintenance.standards'].sudo().search(
|
||||
[('code', '!=', '')],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not partner:
|
||||
num = "%04d" % 1
|
||||
|
||||
else:
|
||||
m = int(partner.code) + 1
|
||||
num = "%04d" % m
|
||||
return num
|
||||
code = fields.Char(string='编码', default=get_no)
|
||||
maintenance_type = fields.Selection([('保养', '保养'), ("检修", "检修")], string='类型', default='保养')
|
||||
name = fields.Char(string='名称')
|
||||
created_user_id = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||
maintenance_equipment_category_id = fields.Many2one('maintenance.equipment.category', string='设备类别')
|
||||
maintenance_equipment_ids = fields.Many2many('maintenance.equipment', 'equipment_maintenance_standards_ids', string='设备')
|
||||
maintenance_projects = fields.Char('维保项目')
|
||||
maintenance_standards = fields.Char('维保标准')
|
||||
292
sf_maintenance/models/sf_maintenance.py
Normal file
292
sf_maintenance/models/sf_maintenance.py
Normal file
@@ -0,0 +1,292 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
from odoo.exceptions import UserError
|
||||
import logging
|
||||
import requests
|
||||
import json
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
|
||||
class SfMaintenanceEquipmentCategory(models.Model):
|
||||
_inherit = 'maintenance.equipment.category'
|
||||
_description = '设备类别'
|
||||
|
||||
equipment_type = fields.Selection([('机床', '机床')], string='类型', default='机床')
|
||||
|
||||
|
||||
class SfMaintenanceEquipment(models.Model):
|
||||
_inherit = 'maintenance.equipment'
|
||||
_description = '设备'
|
||||
|
||||
crea_url = "/api/machine_tool/create"
|
||||
def get_no(self):
|
||||
partner = self.env['maintenance.equipment'].sudo().search(
|
||||
[('MTcode', '!=', '')],
|
||||
limit=1,
|
||||
order="id desc")
|
||||
if not partner:
|
||||
num = "%04d" % 1
|
||||
|
||||
else:
|
||||
m = int(partner.MTcode) + 1
|
||||
num = "%04d" % m
|
||||
return num
|
||||
|
||||
equipment_maintenance_standards_ids = fields.Many2many('equipment.maintenance.standards', 'maintenance_equipment_ids', string='设备维保标准')
|
||||
eq_maintenance_id =fields.Many2one('equipment.maintenance.standards', string='设备保养标准', domain="[('maintenance_type','=','保养')]")
|
||||
overhaul_date = fields.Date(string='下次预防检修')
|
||||
overhaul_period = fields.Integer(string='预防检修频次')
|
||||
overhaul_duration = fields.Float(string='检修时长')
|
||||
|
||||
overhaul_id = fields.Many2one('equipment.maintenance.standards', string='设备检修标准', domain="[('maintenance_type','=','检修')]")
|
||||
|
||||
# @api.depends('eq_maintenance_id', 'overhaul_id')
|
||||
# def _compute_equipment_maintenance_standards_ids(self):
|
||||
# for record in self:
|
||||
# if record.eq_maintenance_id == False:
|
||||
# record.equipment_maintenance_standards_ids = [
|
||||
# (6, 0, [record.overhaul_id.id]),(3,record.eq_maintenance_id.id,0)]
|
||||
# if record.overhaul_id == False:
|
||||
# record.equipment_maintenance_standards_ids = [
|
||||
# (6, 0, [record.eq_maintenance_id.id]),(3,record.overhaul_id.id,0)]
|
||||
# else:
|
||||
# record.equipment_maintenance_standards_ids = [(6, 0, [record.eq_maintenance_id.id, record.overhaul_id.id])]
|
||||
|
||||
|
||||
MTcode = fields.Char("编码", default=get_no)
|
||||
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||
equipment_type = fields.Selection([('机床', '机床')], related='category_id.equipment_type')
|
||||
code = fields.Char('行业编码')
|
||||
name = fields.Char('名称')
|
||||
knife_type = fields.Selection(
|
||||
[("BT40", "BT40"), ("BT30", "BT30")],
|
||||
default="", string="刀把类型")
|
||||
number_of_knife_library = fields.Integer('刀库数量')
|
||||
rotate_speed = fields.Integer('转速')
|
||||
number_of_axles = fields.Selection(
|
||||
[("三轴", "三轴"), ("四轴", "四轴"), ("五轴", "五轴")],
|
||||
default="", string="轴数")
|
||||
# 加工进程
|
||||
x_axis = fields.Integer('X轴')
|
||||
y_axis = fields.Integer('Y轴')
|
||||
z_axis = fields.Integer('Z轴')
|
||||
b_axis = fields.Integer('B轴')
|
||||
c_axis = fields.Integer('C轴')
|
||||
remark = fields.Char('备注')
|
||||
is_binding = fields.Boolean('是否绑定机床', default=False)
|
||||
precision = fields.Float('加工精度')
|
||||
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='品牌')
|
||||
state = fields.Selection(
|
||||
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
||||
default='正常', string="机床状态")
|
||||
# 0606新增字段
|
||||
machine_tool_picture = fields.Binary('图片')
|
||||
heightened_way = fields.Selection([
|
||||
('sifudianji', '伺服电机驱动'),
|
||||
('youyagang', '油压缸驱动'),
|
||||
('chilunjia', '齿轮架驱动')
|
||||
], string="主轴加高方式", default='sifudianji')
|
||||
workpiece_load = fields.Char('工件负载')
|
||||
lead_screw = fields.Char('丝杆')
|
||||
workbench_L = fields.Char('工作台长度(mm)')
|
||||
workbench_W = fields.Char('工作台宽度(mm)')
|
||||
guide_rail = fields.Char('导轨')
|
||||
machine_tool_L = fields.Char('机床长度(mm)')
|
||||
machine_tool_W = fields.Char('机床宽度(mm)')
|
||||
machine_tool_H = fields.Char('机床高度(mm)')
|
||||
feed_speed = fields.Char('进给速度(mm/min)')
|
||||
tool_speed = fields.Char('刀具速度')
|
||||
distance = fields.Char('主轴端面至工作台面距离(mm)')
|
||||
taper = fields.Char('主轴锥度(°)')
|
||||
torque = fields.Char('主轴点击扭矩(n/m)')
|
||||
motor_power = fields.Char('主轴电机功率(kw)')
|
||||
tool_quality_max = fields.Char('刀具最大质量')
|
||||
tool_long_max = fields.Char('刀具最大长度')
|
||||
tool_diameter_max = fields.Char('刀具最大刀径')
|
||||
machine_tool_category = fields.Many2one('sf.machine_tool.category', string='机床类型')
|
||||
# 一个机床对应一個加工工厂,一个加工工厂对应多个机床
|
||||
factory_id = fields.Many2one('res.partner', string='所属工厂',
|
||||
domain="[('is_factory', '=', True)]")
|
||||
# 一个机床对应一个供应商,一个供应商对应多个机床
|
||||
supplier_id = fields.Many2one('res.partner', string='制造商',
|
||||
domain="[('is_vendor', '=', True)]")
|
||||
registration_date = fields.Date('注册日期')
|
||||
state_zc = fields.Selection([("已注册", "已注册"), ("未注册", "未注册")], string="注册状态", default='未注册',
|
||||
tracking=True)
|
||||
active = fields.Boolean('有效', default=True)
|
||||
# 多个型号对应一个机床
|
||||
machine_tool_id = fields.Many2one('sf.machine_tool', '机床')
|
||||
number_of_axles = fields.Selection(
|
||||
[("三轴", "三轴"), ("四轴", "四轴"), ("五轴", "五轴")],
|
||||
default="", string="轴数")
|
||||
# 加工进程
|
||||
x_axis = fields.Integer('X轴')
|
||||
y_axis = fields.Integer('Y轴')
|
||||
z_axis = fields.Integer('Z轴')
|
||||
b_axis = fields.Integer('B轴')
|
||||
c_axis = fields.Integer('C轴')
|
||||
remark = fields.Char('备注')
|
||||
precision = fields.Float('加工精度')
|
||||
control_system_id = fields.Many2one('sf.machine.control_system',
|
||||
string="控制系统")
|
||||
active = fields.Boolean('有效', default=True)
|
||||
code = fields.Char('编码')
|
||||
|
||||
@api.constrains('rotate_speed')
|
||||
def _check_rotate_speed(self):
|
||||
if self.rotate_speed <= 0:
|
||||
raise UserError("转速不能为0")
|
||||
|
||||
@api.constrains('precision')
|
||||
def _check_precision(self):
|
||||
if self.precision <= 0.00:
|
||||
raise UserError("加工精度不能为0")
|
||||
|
||||
@api.constrains('number_of_knife_library')
|
||||
def _check_number_of_knife_library(self):
|
||||
if self.number_of_knife_library <= 0:
|
||||
raise UserError("刀库数量不能为0")
|
||||
|
||||
@api.constrains('x_axis')
|
||||
def _check_x_axis(self):
|
||||
if self.x_axis <= 0:
|
||||
raise UserError("加工行程里x轴不能为0")
|
||||
|
||||
@api.constrains('y_axis')
|
||||
def _check_y_axis(self):
|
||||
if self.y_axis <= 0:
|
||||
raise UserError("加工行程里y轴不能为0")
|
||||
|
||||
@api.constrains('z_axis')
|
||||
def _check_z_axis(self):
|
||||
if self.z_axis <= 0:
|
||||
raise UserError("加工行程里z轴不能为0")
|
||||
|
||||
@api.constrains('b_axis')
|
||||
def _check_b_axis(self):
|
||||
if self.number_of_axles == '四轴':
|
||||
print(self.number_of_axles)
|
||||
if self.b_axis <= 0:
|
||||
raise UserError("加工行程里b轴不能为0")
|
||||
|
||||
@api.constrains('c_axis')
|
||||
def _check_c_axis(self):
|
||||
if self.number_of_axles == '五轴':
|
||||
if self.c_axis <= 0:
|
||||
raise UserError("加工行程里c轴不能为0")
|
||||
|
||||
@api.onchange('type_id')
|
||||
def get_type_info(self):
|
||||
for item in self:
|
||||
item.knife_type = item.type_id.knife_type
|
||||
item.number_of_knife_library = item.type_id.number_of_knife_library
|
||||
item.number_of_axles = item.type_id.number_of_axles
|
||||
item.rotate_speed = item.type_id.rotate_speed
|
||||
item.precision = item.type_id.precision
|
||||
item.control_system_id = item.type_id.control_system_id
|
||||
item.x_axis = item.type_id.x_axis
|
||||
item.y_axis = item.type_id.y_axis
|
||||
item.z_axis = item.type_id.z_axis
|
||||
item.b_axis = item.type_id.b_axis
|
||||
item.c_axis = item.type_id.c_axis
|
||||
item.machine_tool_picture = item.type_id.machine_tool_picture
|
||||
item.heightened_way = item.type_id.heightened_way
|
||||
item.workpiece_load = item.type_id.workpiece_load
|
||||
item.lead_screw = item.type_id.lead_screw
|
||||
item.workbench_L = item.type_id.workbench_L
|
||||
item.workbench_W = item.type_id.workbench_W
|
||||
item.guide_rail = item.type_id.guide_rail
|
||||
item.machine_tool_L = item.type_id.machine_tool_L
|
||||
item.machine_tool_W = item.type_id.machine_tool_W
|
||||
item.machine_tool_H = item.type_id.machine_tool_H
|
||||
item.feed_speed = item.type_id.feed_speed
|
||||
item.tool_speed = item.type_id.tool_speed
|
||||
item.distance = item.type_id.distance
|
||||
item.taper = item.type_id.taper
|
||||
item.torque = item.type_id.torque
|
||||
item.motor_power = item.type_id.motor_power
|
||||
item.tool_quality_max = item.type_id.tool_quality_max
|
||||
item.tool_long_max = item.type_id.tool_long_max
|
||||
item.tool_diameter_max = item.type_id.tool_diameter_max
|
||||
item.machine_tool_category = item.type_id.machine_tool_category.id
|
||||
item.brand_id = item.type_id.brand_id.id
|
||||
|
||||
# 注册同步机床
|
||||
def enroll_machine_tool(self):
|
||||
sf_sync_config = self.env['res.config.settings'].get_values()
|
||||
token = sf_sync_config['token']
|
||||
sf_secret_key = sf_sync_config['sf_secret_key']
|
||||
headers = Common.get_headers(self, token, sf_secret_key)
|
||||
strurl = sf_sync_config['sf_url'] + self.crea_url
|
||||
objs_all = self.env['maintenance.equipment'].search([('MTcode', '=', self.MTcode)])
|
||||
machine_tool_list = []
|
||||
if objs_all:
|
||||
for item in objs_all:
|
||||
if item.machine_tool_picture != False:
|
||||
image = base64.b64encode(item.machine_tool_picture).decode('utf-8')
|
||||
else:
|
||||
image = False
|
||||
val = {
|
||||
'MTcode': item.MTcode,
|
||||
'factory_token': token,
|
||||
'id': item.id,
|
||||
'name': item.name,
|
||||
'code': item.code,
|
||||
'precision': item.precision,
|
||||
'knife_type': item.knife_type,
|
||||
'number_of_knife_library': item.number_of_knife_library,
|
||||
'rotate_speed': item.rotate_speed,
|
||||
'number_of_axles': item.number_of_axles,
|
||||
'control_system_id': self.env['sf.machine.control_system'].search(
|
||||
[('id', '=', item.control_system_id.id)]).code,
|
||||
'type_id': self.env['sf.machine_tool.type'].search([('id', '=', item.type_id.id)]).code,
|
||||
'brand_id': self.env['sf.machine.brand'].search([('id', '=', item.brand_id.id)]).code,
|
||||
'supplier_id': item.supplier_id.id,
|
||||
'x_axis': item.x_axis,
|
||||
'y_axis': item.y_axis,
|
||||
'z_axis': item.z_axis,
|
||||
'b_axis': item.b_axis,
|
||||
'c_axis': item.c_axis,
|
||||
'state': item.state,
|
||||
'active': item.active,
|
||||
'machine_tool_picture': image,
|
||||
'heightened_way': item.heightened_way,
|
||||
'workpiece_load': item.workpiece_load,
|
||||
'lead_screw': item.lead_screw,
|
||||
'workbench_L': item.workbench_L,
|
||||
'workbench_W': item.workbench_W,
|
||||
'guide_rail': item.guide_rail,
|
||||
'machine_tool_L': item.machine_tool_L,
|
||||
'machine_tool_W': item.machine_tool_W,
|
||||
'machine_tool_H': item.machine_tool_H,
|
||||
'feed_speed': item.feed_speed,
|
||||
'tool_speed': item.tool_speed,
|
||||
'distance': item.distance,
|
||||
'taper': item.taper,
|
||||
'torque': item.torque,
|
||||
'motor_power': item.motor_power,
|
||||
'tool_quality_max': item.tool_quality_max,
|
||||
'tool_long_max': item.tool_long_max,
|
||||
'tool_diameter_max': item.tool_diameter_max,
|
||||
'machine_tool_category': item.machine_tool_category.code,
|
||||
|
||||
|
||||
}
|
||||
machine_tool_list.append(val)
|
||||
# kw = machine_tool_list
|
||||
kw = json.dumps(machine_tool_list, ensure_ascii=False)
|
||||
r = requests.post(strurl, json={}, data={'kw': kw, 'token': token}, headers=headers)
|
||||
ret = r.json()
|
||||
self.code = ret['message']
|
||||
self.state_zc = "已注册"
|
||||
if r == 200:
|
||||
return "机床注册成功"
|
||||
else:
|
||||
raise UserError("没有注册机床信息")
|
||||
|
||||
|
||||
13
sf_maintenance/models/sf_maintenance_requests.py
Normal file
13
sf_maintenance/models/sf_maintenance_requests.py
Normal file
@@ -0,0 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import base64
|
||||
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class SfMaintenanceEquipmentCategory(models.Model):
|
||||
_inherit = 'maintenance.request'
|
||||
_description = '维保计划'
|
||||
|
||||
|
||||
|
||||
4
sf_maintenance/security/group_security.xml
Normal file
4
sf_maintenance/security/group_security.xml
Normal file
@@ -0,0 +1,4 @@
|
||||
<odoo>
|
||||
<data>
|
||||
</data>
|
||||
</odoo>
|
||||
4
sf_maintenance/security/ir.model.access.csv
Normal file
4
sf_maintenance/security/ir.model.access.csv
Normal file
@@ -0,0 +1,4 @@
|
||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
access_equipment_maintenance_standards,equipment_maintenance_standards,model_equipment_maintenance_standards,base.group_user,1,1,1,1
|
||||
|
||||
|
||||
|
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="view_equipment_maintenance_standards_form" model="ir.ui.view">
|
||||
<field name="name">equipment.maintenance.standards.form</field>
|
||||
<field name="model">equipment.maintenance.standards</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="设备维保标准">
|
||||
<sheet>
|
||||
<group>
|
||||
<field name="code" readonly="1" force_save="1"/>
|
||||
<field name="maintenance_type" required="1"/>
|
||||
<field name="name" required="1"/>
|
||||
<field name="created_user_id"/>
|
||||
<field name="maintenance_equipment_category_id" required="1"/>
|
||||
<field name="maintenance_equipment_ids" widget="many2many_tags"/>
|
||||
<field name="maintenance_projects" required="1"/>
|
||||
<field name="maintenance_standards" required="1"/>
|
||||
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_equipment_maintenance_standards_tree" model="ir.ui.view">
|
||||
<field name="name">equipment.maintenance.standards.tree</field>
|
||||
<field name="model">equipment.maintenance.standards</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="设备维保标准">
|
||||
<field name="code" readonly="1" force_save="1"/>
|
||||
<field name="maintenance_type" required="1"/>
|
||||
<field name="name" required="1"/>
|
||||
<field name="maintenance_equipment_category_id" required="1"/>
|
||||
<field name="maintenance_equipment_ids"/>
|
||||
<field name="maintenance_projects" required="1"/>
|
||||
<field name="maintenance_standards" required="1"/>
|
||||
<field name="created_user_id"/>
|
||||
<field name="create_date" string="创建时间"/>
|
||||
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_equipment_maintenance_standards_search" model="ir.ui.view">
|
||||
<field name="name">equipment.maintenance.standards.search</field>
|
||||
<field name="model">equipment.maintenance.standards</field>
|
||||
<field name="arch" type="xml">
|
||||
<search>
|
||||
<searchpanel>
|
||||
<field name="maintenance_type" icon="fa-building" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
<field name="code" string="编码"/>
|
||||
<field name="maintenance_type" string="类型"/>
|
||||
<field name="name" string="日常机床保养"/>
|
||||
<field name="created_user_id" string="创建人"/>
|
||||
<field name="maintenance_equipment_category_id" string="设备类别"/>
|
||||
<field name="maintenance_projects" string="维保项目"/>
|
||||
<field name="maintenance_standards" string="维保标准"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="action_equipment_maintenance_standards" model="ir.actions.act_window">
|
||||
<field name="name">设备维保标准</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">equipment.maintenance.standards</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_equipment_maintenance_standards_search"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
点击下方的创建按钮来添加设备维保标准。
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="menu_equipment_maintenance_standards"
|
||||
name="设备维保标准"
|
||||
parent="maintenance.menu_maintenance_configuration"
|
||||
action="action_equipment_maintenance_standards"
|
||||
sequence="4"/>
|
||||
|
||||
|
||||
</odoo>
|
||||
30
sf_maintenance/views/maintenance_request_views.xml
Normal file
30
sf_maintenance/views/maintenance_request_views.xml
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<!-- equiment.request : actions -->
|
||||
<!-- <record id="hr_equipment_request_action" model="ir.actions.act_window">-->
|
||||
<!-- <field name="name">维保计划</field>-->
|
||||
<!-- <field name="res_model">maintenance.request</field>-->
|
||||
<!-- <field name="view_mode">kanban,tree,form,pivot,graph,calendar</field>-->
|
||||
<!-- <field name="view_id" ref="maintenance.hr_equipment_request_view_kanban"/>-->
|
||||
<!-- <field name="context">{'default_user_id': uid}</field>-->
|
||||
<!-- <field name="help" type="html">-->
|
||||
<!-- <p class="o_view_nocontent_smiling_face">-->
|
||||
<!-- Add a new maintenance request-->
|
||||
<!-- </p><p>-->
|
||||
<!-- Follow the process of the request and communicate with the collaborator.-->
|
||||
<!-- </p>-->
|
||||
<!-- </field>-->
|
||||
<!-- </record>-->
|
||||
|
||||
|
||||
|
||||
<menuitem
|
||||
id="menu_m_request_form"
|
||||
name="维保计划"
|
||||
parent="maintenance.menu_m_request"
|
||||
action="maintenance.hr_equipment_request_action"
|
||||
groups="maintenance.group_equipment_manager,base.group_user"
|
||||
sequence="1"/>
|
||||
|
||||
|
||||
</odoo>
|
||||
156
sf_maintenance/views/maintenance_views.xml
Normal file
156
sf_maintenance/views/maintenance_views.xml
Normal file
@@ -0,0 +1,156 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<!-- 设备类别 -->
|
||||
<record id="sf_maintenance_equipment_category" model="ir.ui.view">
|
||||
<field name="name">sf.maintenance.equipment.category</field>
|
||||
<field name="model">maintenance.equipment.category</field>
|
||||
<field name="inherit_id" ref="maintenance.hr_equipment_category_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='technician_user_id']" position="before">
|
||||
<field name="equipment_type" required='1'/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- 修改设备表单视图-->
|
||||
<record id="sf_hr_equipment_view_form" model="ir.ui.view">
|
||||
<field name="name">sf_equipment.form</field>
|
||||
<field name="model">maintenance.equipment</field>
|
||||
<field name="inherit_id" ref="maintenance.hr_equipment_view_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='category_id']" position="after">
|
||||
<field name="equipment_type" invisible="1"/>
|
||||
<field name="brand_id" invisible="1"/>
|
||||
<field name="type_id" attrs="{'invisible': [('equipment_type', '!=', '机床')]}"/>
|
||||
<field name="machine_tool_category" readonly="1" attrs="{'invisible': [('type_id', '=', False)]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//page[@name='maintenance']" position="after">
|
||||
<page string="设备参数" name="sf_equipment" attrs="{'invisible': [('type_id', '=', False)]}">
|
||||
<group string="参数">
|
||||
<group>
|
||||
<field name="knife_type" required="1"/>
|
||||
<field name="workpiece_load" invisible="1"/>
|
||||
<field name="lead_screw" invisible="1"/>
|
||||
<field name="workbench_L" invisible="1"/>
|
||||
<field name="workbench_W" invisible="1"/>
|
||||
<field name="guide_rail" invisible="1"/>
|
||||
<field name="machine_tool_L" invisible="1"/>
|
||||
<field name="machine_tool_W" invisible="1"/>
|
||||
<field name="machine_tool_H" invisible="1"/>
|
||||
<field name="feed_speed" invisible="1"/>
|
||||
<field name="tool_speed" invisible="1"/>
|
||||
<field name="distance" invisible="1"/>
|
||||
<field name="taper" invisible="1"/>
|
||||
<field name="torque" invisible="1"/>
|
||||
<field name="motor_power" invisible="1"/>
|
||||
<field name="tool_quality_max" invisible="1"/>
|
||||
<field name="tool_long_max" invisible="1"/>
|
||||
<field name="number_of_knife_library" required="1" options="{'format': false}"/>
|
||||
<field name="number_of_axles" widget="radio" options="{'horizontal': true}"/>
|
||||
<label for="x_axis" string="加工行程(mm)"
|
||||
attrs="{'invisible': [('number_of_axles', '=', False)]}"/>
|
||||
<div class="o_address_format"
|
||||
attrs="{'invisible': [('number_of_axles', '=', False)]}">
|
||||
<label for="x_axis" string="x"/>
|
||||
<field name="x_axis" class="o_address_city" required="1"
|
||||
options="{'format': false}"/>
|
||||
<label for="y_axis" string="y"/>
|
||||
<field name="y_axis" class="o_address_zip" required="1"
|
||||
options="{'format': false}"/>
|
||||
<label for="z_axis" string="z"/>
|
||||
<field name="z_axis" class="o_address_zip" required="1"
|
||||
options="{'format': false}"/>
|
||||
<label for="b_axis" string="b"
|
||||
attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"/>
|
||||
<field name="b_axis" class="o_address_city" required="1"
|
||||
attrs="{'invisible': [('number_of_axles', '=', '三轴')]}"
|
||||
options="{'format': false}"/>
|
||||
<label for="c_axis" string="c"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"/>
|
||||
<field name="c_axis" class="o_address_zip" required="1"
|
||||
attrs="{'invisible': [('number_of_axles', 'in', ['三轴','四轴'])]}"
|
||||
options="{'format': false}"/>
|
||||
</div>
|
||||
</group>
|
||||
<group>
|
||||
<field name="rotate_speed" required="1" string="转速(min)" options="{'format': false}"/>
|
||||
<field name="precision" required="1" string="加工精度(mm)"/>
|
||||
<field name="control_system_id" required="1" options="{'no_create': True}"/>
|
||||
<field name="state" widget="selection"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="其他">
|
||||
<group string="其他">
|
||||
<field name="remark"/>
|
||||
</group>
|
||||
<button type="object" class="oe_highlight" name='enroll_machine_tool' string="机床注册"/>
|
||||
</page>
|
||||
|
||||
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='next_action_date']" position="before">
|
||||
|
||||
<field name='eq_maintenance_id'/>
|
||||
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//div[@class='o_row'][field[@name='maintenance_duration']]" position="after">
|
||||
|
||||
<field name='overhaul_id'/>
|
||||
|
||||
<field name="overhaul_date" string="下次预防检修"/>
|
||||
<label for="overhaul_period" string="预防检修频次"/>
|
||||
<div class="o_row">
|
||||
<field name="overhaul_period"/>
|
||||
days
|
||||
</div>
|
||||
|
||||
<label for="overhaul_duration" string="检修时长"/>
|
||||
<div class="o_row">
|
||||
<field name="overhaul_duration"/>
|
||||
hours
|
||||
</div>
|
||||
<field name='equipment_maintenance_standards_ids' widget="many2many_tags" invisible="1"/>
|
||||
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
<!-- 修改设备搜索视图-->
|
||||
<record id="sf_hr_equipment_view_search" model="ir.ui.view">
|
||||
<field name="name">sf_equipment.view.search</field>
|
||||
<field name="model">maintenance.equipment</field>
|
||||
<field name="inherit_id" ref="maintenance.hr_equipment_view_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='category_id']" position="after">
|
||||
<searchpanel>
|
||||
<field name="category_id" icon="fa-building" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
</xpath>
|
||||
</data>
|
||||
</field>
|
||||
</record>
|
||||
<!-- 修改设备列表视图-->
|
||||
<record id="sf_maintenance_hr_equipment_view_tree_inherit" model="ir.ui.view">
|
||||
<field name="name">sf.maintenance.hr.equipment.view.tree.inherit</field>
|
||||
<field name="model">maintenance.equipment</field>
|
||||
<field name="inherit_id" ref="maintenance.hr_equipment_view_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='activity_exception_decoration']" position="before">
|
||||
<field name="workcenter_id"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='activity_exception_decoration']" position="after">
|
||||
<field name="created_user"/>
|
||||
<field name="create_date"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user