优化代码结构
This commit is contained in:
@@ -86,7 +86,7 @@ class MachineTool(models.Model):
|
||||
state = fields.Selection(
|
||||
[("正常", "正常"), ("故障", "故障"), ("不可用", "不可用")],
|
||||
default='正常', string="机床状态")
|
||||
#0606新增字段
|
||||
# 0606新增字段
|
||||
machine_tool_picture = fields.Binary('图片')
|
||||
heightened_way = fields.Selection([
|
||||
('sifudianji', '伺服电机驱动'),
|
||||
@@ -260,7 +260,7 @@ class MachineToolType(models.Model):
|
||||
default="", string="刀把类型")
|
||||
number_of_knife_library = fields.Integer('刀库数量')
|
||||
rotate_speed = fields.Integer('转速')
|
||||
#0606新增字段
|
||||
# 0606新增字段
|
||||
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||
machine_tool_picture = fields.Binary('图片')
|
||||
heightened_way = fields.Selection([
|
||||
@@ -327,4 +327,3 @@ class MachineToolCategory(models.Model):
|
||||
active = fields.Boolean('有效', default=True)
|
||||
category = fields.Selection([('shukong', u'数控'), ('putong', u'普通')], string=u'机床类别',
|
||||
default='shukong')
|
||||
|
||||
|
||||
@@ -105,7 +105,6 @@ class StatusChange(models.Model):
|
||||
#
|
||||
# return True
|
||||
|
||||
|
||||
# def action_cancel(self):
|
||||
# """ Cancel SO after showing the cancel wizard when needed. (cfr `_show_cancel_wizard`)
|
||||
#
|
||||
|
||||
@@ -165,7 +165,7 @@ class ResMrpWorkOrder(models.Model):
|
||||
y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / (
|
||||
(y3 - y4) * (x1 - x2) - (y1 - y2) * (x3 - x4))
|
||||
x1 = ((x7 - x8) * (x6 * y5 - x5 * y6) - (x5 - x6) * (x8 * y7 - x7 * y8)) / (
|
||||
(x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8));
|
||||
(x7 - x8) * (y5 - y6) - (x5 - x6) * (y7 - y8))
|
||||
y1 = ((y7 - y8) * (y6 * x5 - y5 * x6) - (y5 - y6) * (y8 * x7 - y7 * x8)) / (
|
||||
(y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8))
|
||||
x = (x0 + x1) / 2
|
||||
@@ -189,19 +189,26 @@ class ResMrpWorkOrder(models.Model):
|
||||
def json_workorder_str(self, k, production, route):
|
||||
# 计算预计时长duration_expected
|
||||
if route.routing_type == '切割':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '切割')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '切割')]).time_cycle
|
||||
elif route.routing_type == '获取CNC加工程序':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '获取CNC加工程序')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '获取CNC加工程序')]).time_cycle
|
||||
elif route.routing_type == '工件装夹':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '工件装夹')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '工件装夹')]).time_cycle
|
||||
elif route.routing_type == '前置三元定位检测':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '前置三元定位检测')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '前置三元定位检测')]).time_cycle
|
||||
elif route.routing_type == 'CNC加工':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', 'CNC加工')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', 'CNC加工')]).time_cycle
|
||||
elif route.routing_type == '后置三元质量检测':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '后置三元质量检测')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '后置三元质量检测')]).time_cycle
|
||||
elif route.routing_type == '解除装夹':
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search([('name', '=', '解除装夹')]).time_cycle
|
||||
duration_expected = self.env['mrp.routing.workcenter'].sudo().search(
|
||||
[('name', '=', '解除装夹')]).time_cycle
|
||||
else:
|
||||
duration_expected = 60
|
||||
workorders_values_str = [0, '', {
|
||||
|
||||
@@ -7,9 +7,8 @@ class SfQualityPoint(models.Model):
|
||||
|
||||
product_ids = fields.Many2many(
|
||||
'product.product', string='适用产品',
|
||||
domain="[('type', 'in', ('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]",
|
||||
help="Quality Point will apply to every selected Products.")
|
||||
domain="[('type', 'in', "
|
||||
"('product', 'consu')), '|', ('company_id', '=', False), ('company_id', '=', company_id)]", help=
|
||||
"Quality Point will apply to every selected Products.")
|
||||
# picking_type_ids = fields.Many2many(
|
||||
# 'stock.picking.type', string='执行节点', required=True, check_company=True)
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
from . import base
|
||||
from . import tool_material_search
|
||||
|
||||
|
||||
@@ -19,13 +19,15 @@ class SfToolMaterialSearch(models.Model):
|
||||
mrs_cutting_tool_material_name = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料名称',
|
||||
store=True)
|
||||
cutting_tool_type = fields.Char(related='mrs_cutting_tool_material_id.name', string='刀具物料类型', store=True)
|
||||
mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True, domain="[('tag_ids.name', 'ilike', '刀具')]")
|
||||
mrs_machine_brand_id = fields.Many2one('sf.machine.brand', '品牌', required=True,
|
||||
domain="[('tag_ids.name', 'ilike', '刀具')]")
|
||||
# 关联刀具型号
|
||||
# mrs_cutting_tool_model_id = fields.Many2one('sf.cutting.tool.model', '刀具型号')
|
||||
|
||||
# 关联刀具物料模型
|
||||
mrs_cutting_tool_material_id = fields.Many2one('sf.cutting.tool.material', '刀具物料',
|
||||
group_expand='_read_group_mrs_cutting_tool_material_ids', required=True)
|
||||
group_expand='_read_group_mrs_cutting_tool_material_ids',
|
||||
required=True)
|
||||
cutting_tool_material_name = fields.Char(string='物料名称', invisible=True)
|
||||
|
||||
@api.onchange('mrs_cutting_tool_material_id')
|
||||
@@ -91,7 +93,7 @@ class SfToolMaterialSearch(models.Model):
|
||||
# integral_blade_material = fields.Selection([('碳素钢', '碳素钢'), ('硬质合金', '硬质合金')], '整体式刀具刀具材质')
|
||||
integral_hardness = fields.Integer('整体式刀具硬度(HRC)')
|
||||
integral_coating_material = fields.Char('整体式刀具涂层材质')
|
||||
integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6,1))
|
||||
integral_run_out_accuracy_max = fields.Float('整体式刀具端跳精度max', digits=(6, 1))
|
||||
integral_run_out_accuracy_min = fields.Float('整体式刀具端跳精度min', digits=(6, 1))
|
||||
|
||||
suitable_machining_method_ids = fields.Many2many('maintenance.equipment.image',
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
'web.assets_qweb': [
|
||||
],
|
||||
|
||||
'web.assets_backend':[
|
||||
'web.assets_backend': [
|
||||
# 'sf_warehouse/static/src/js/vanilla-masker.min.js',
|
||||
'sf_warehouse/static/src/css/kanban_color_change.scss',
|
||||
'sf_warehouse/static/src/js/custom_kanban_controller.js',
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
from . import model
|
||||
|
||||
|
||||
@@ -203,7 +203,8 @@ class SfLocation(models.Model):
|
||||
# def generate_barcode(self, i, j):
|
||||
# # 这里是你生成barcode的代码
|
||||
# area_type_barcode = self.location_id.barcode
|
||||
# return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + str(i + 1) + '-' + str(j + 1)
|
||||
# return area_type_barcode + self.channel + self.direction + '-' + self.barcode + '-' + str(i + 1) + '-'
|
||||
# + str(j + 1)
|
||||
|
||||
|
||||
class SfProcurementGroup(models.Model):
|
||||
@@ -223,7 +224,8 @@ class SfProcurementGroup(models.Model):
|
||||
res_list = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]),
|
||||
order='route_sequence, sequence')
|
||||
for res1 in res_list:
|
||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type:
|
||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \
|
||||
res1.location_src_id.product_type:
|
||||
res = res1
|
||||
if not res:
|
||||
res = Rule.search(expression.AND([[('route_id', 'in', route_ids.ids)], domain]),
|
||||
@@ -235,7 +237,8 @@ class SfProcurementGroup(models.Model):
|
||||
res_list = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]),
|
||||
order='route_sequence, sequence')
|
||||
for res1 in res_list:
|
||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type:
|
||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \
|
||||
res1.location_src_id.product_type:
|
||||
res = res1
|
||||
if not res:
|
||||
res = Rule.search(expression.AND([[('route_id', 'in', packaging_routes.ids)], domain]),
|
||||
@@ -246,7 +249,8 @@ class SfProcurementGroup(models.Model):
|
||||
res_list = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]),
|
||||
order='route_sequence, sequence')
|
||||
for res1 in res_list:
|
||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type:
|
||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \
|
||||
res1.location_src_id.product_type:
|
||||
res = res1
|
||||
if not res:
|
||||
res = Rule.search(expression.AND([[('route_id', 'in', product_routes.ids)], domain]),
|
||||
@@ -257,7 +261,8 @@ class SfProcurementGroup(models.Model):
|
||||
res_list = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]),
|
||||
order='route_sequence, sequence')
|
||||
for res1 in res_list:
|
||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in res1.location_src_id.product_type:
|
||||
if product_id.categ_id in res1.location_dest_id.product_type or product_id.categ_id in \
|
||||
res1.location_src_id.product_type:
|
||||
res = res1
|
||||
if not res:
|
||||
res = Rule.search(expression.AND([[('route_id', 'in', warehouse_routes.ids)], domain]),
|
||||
|
||||
@@ -13,8 +13,6 @@ from odoo.http import request
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -44,9 +42,3 @@ class WxWorkApproval(models.Model):
|
||||
# ], string='请假类型')
|
||||
# leave_days = fields.Float(string='Leave Days')
|
||||
# overtime_hours = fields.Float(string='Overtime Hours')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -80,7 +80,8 @@ class WxSettings(models.Model):
|
||||
# 'control_type': child_data.get('property', {}).get('control', None),
|
||||
# 'unique_control_id': child_data.get('property', {}).get('id', None),
|
||||
# 'title': child_data.get('property', {}).get('title', [{}])[0].get('text', None),
|
||||
# 'placeholder': child_data.get('property', {}).get('placeholder', [{}])[0].get('text', None),
|
||||
# 'placeholder': child_data.get('property', {}).get('placeholder', [{}])[0].
|
||||
# get('text', None),
|
||||
# 'require': child_data.get('property', {}).get('require', None),
|
||||
# 'un_print': child_data.get('property', {}).get('un_print', None),
|
||||
# 'un_replace': child_data.get('property', {}).get('un_replace', None),
|
||||
@@ -99,7 +100,8 @@ class WxSettings(models.Model):
|
||||
# 例如:
|
||||
config_id_data = {
|
||||
'date_type': [(0, 0, {'date_type': child_data.get('config', {}).get('date', {}).get('type',
|
||||
None)})] if 'date' in child_data.get(
|
||||
None)})]
|
||||
if 'date' in child_data.get(
|
||||
'config', {}) else [],
|
||||
'selector_type': [(0, 0, {
|
||||
'selector_type': 'single',
|
||||
@@ -108,26 +110,14 @@ class WxSettings(models.Model):
|
||||
'contact_type': [
|
||||
(0, 0, {'contact_type': config_data.get('contact', {}).get('type', None),
|
||||
'contact_mode': config_data.get('contact', {}).get('mode',
|
||||
None)})] if 'contact' in child_data.get(
|
||||
None)})] if 'contact' in
|
||||
child_data.get(
|
||||
'config', {}).get('contact', {}) else [],
|
||||
'file_type': [
|
||||
(0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo',
|
||||
None)})] if 'file' in child_data.get(
|
||||
None)})] if 'file' in
|
||||
child_data.get(
|
||||
'config', {}).get('file', {}) else [],
|
||||
# 'table_type': [(0, 0, {
|
||||
# 'table_children': [
|
||||
# (0, 0, {'control_type': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('control', None),
|
||||
# 'unique_control_id': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('id', None),
|
||||
# 'title': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('title', None)[0].get('text', None),
|
||||
# 'placeholder': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('placeholder', None)[0].get('text', None),
|
||||
# 'require': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('require', None),
|
||||
# 'un_print': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('un_print', None),
|
||||
# 'un_replace': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('un_replace', None),
|
||||
# 'display': config_data.get('table', {}).get('children', None)[0].get('property', {}).get('display', None),
|
||||
# })],
|
||||
# })] if 'table' in config_data else [],
|
||||
# 'attendance_type': [(0, 0, {'attendance_type': '1',
|
||||
# 'attendance_date_range_type': 'hour'})] if 'attendance' in config_data else [],
|
||||
}
|
||||
|
||||
# 将config_id_data添加到property_data中(如果有的话)
|
||||
@@ -152,16 +142,9 @@ class WxSettings(models.Model):
|
||||
'display': property_data.get('display', None),
|
||||
})],
|
||||
'config_id': [(0, 0, {
|
||||
'date_type': [(0, 0, {'date_type': config_data.get('date', {}).get('type',
|
||||
None)})] if 'date' in config_data else [],
|
||||
# 'selector_type': [(0, 0, {
|
||||
# 'selector_type': config_data['table']['children'][0].get('config', {}).get(
|
||||
# 'selector', {}).get('type', None),
|
||||
# 'options': [
|
||||
# (0, 0, {'key': option['key'], 'text': option['value'][0]['text']})
|
||||
# for option in config_data['table']['children'][0].get('config', {}).get('selector', {}).get('options', [])
|
||||
# ],
|
||||
# })] if 'selector' in config_data else [],
|
||||
'date_type': [(0, 0, {'date_type':
|
||||
config_data.get('date', {}).get(
|
||||
'type', None)})] if 'date' in config_data else [],
|
||||
'selector_type': [
|
||||
(0, 0, {
|
||||
'selector_type': child.get('config', {}).get('selector', {}).get('type', None),
|
||||
@@ -177,10 +160,12 @@ class WxSettings(models.Model):
|
||||
'contact_type': [
|
||||
(0, 0, {'contact_type': config_data.get('contact', {}).get('type', None),
|
||||
'contact_mode': config_data.get('contact', {}).get('mode',
|
||||
None)})] if 'contact' in config_data else [],
|
||||
None)})]
|
||||
if 'contact' in config_data else [],
|
||||
'file_type': [
|
||||
(0, 0, {'is_only_photo': config_data.get('file', {}).get('is_only_photo',
|
||||
None)})] if 'file' in config_data else [],
|
||||
None)})]
|
||||
if 'file' in config_data else [],
|
||||
'table_type': [(0, 0, {
|
||||
'table_children': table_children_records,
|
||||
})] if 'table' in config_data else [],
|
||||
@@ -200,7 +185,8 @@ class WxSettings(models.Model):
|
||||
# # 'title': '文本框2'})]
|
||||
|
||||
'attendance_type': [(0, 0, {'attendance_type': '1',
|
||||
'attendance_date_range_type': 'hour'})] if 'attendance' in config_data else [],
|
||||
'attendance_date_range_type': 'hour'})]
|
||||
if 'attendance' in config_data else [],
|
||||
})],
|
||||
}),
|
||||
# 在这里添加更多的控件数据
|
||||
|
||||
Reference in New Issue
Block a user