diff --git a/jikimo_frontend/__manifest__.py b/jikimo_frontend/__manifest__.py
index f2096eea..4165a503 100644
--- a/jikimo_frontend/__manifest__.py
+++ b/jikimo_frontend/__manifest__.py
@@ -27,6 +27,7 @@
'jikimo_frontend/static/src/views/list_nums/list_nums.xml',
'jikimo_frontend/static/src/views/list_nums/list_nums2.xml',
'jikimo_frontend/static/src/views/list_nums/list_nums3.xml',
+ 'jikimo_frontend/static/src/js/custom_form_status_indicator.js',
],
},
diff --git a/jikimo_frontend/static/src/js/custom_form_status_indicator.js b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
new file mode 100644
index 00000000..fd06fe75
--- /dev/null
+++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
@@ -0,0 +1,49 @@
+/** @odoo-module */
+
+import {patch} from '@web/core/utils/patch';
+// import { Dialog } from "@web/core/dialog/dialog";
+import {_t} from "@web/core/l10n/translation";
+import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator"
+
+var Dialog = require('web.Dialog');
+// var {patch} = require("web.utils") 这句话也行
+
+patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
+ // 你可以重写或者添加一些方法和属性
+ async _onDiscardChanges() {
+ var self = this;
+ Dialog.confirm(this, _t("Are you sure you want to discard changes?"), {
+ title: _t("Discard Changes"),
+
+ // confirm_callback: function () {
+ // self.model.discardChanges(self.handle);
+ // },
+ });
+ },
+
+ async discard() {
+ // if (window.confirm("Are you sure you want to discard changes?")) {
+ // await this.props.discard();
+ // }
+ const result = await this._confirmDiscardChange();
+ await this.props.discard();
+ },
+
+ _confirmDiscardChange(){
+ var self = this;
+ var def = new Promise(function (resolve, reject) {
+ var message = _t("请确认是否要舍弃之前的更改?");
+ var dialog = Dialog.confirm(self, message, {
+ title: _t("Warning"),
+ confirm_callback: resolve.bind(self, true),
+ cancel_callback: reject,
+ });
+ dialog.on('closed', self, reject);
+ });
+ return def;
+ },
+
+}
+);
+
+
diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py
index 71af29bc..a34868b9 100644
--- a/sf_base/__manifest__.py
+++ b/sf_base/__manifest__.py
@@ -10,7 +10,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
- 'depends': ['account', 'base', 'mrp_workorder', 'sale'],
+ 'depends': ['account', 'base', 'mrp_workorder', 'sale', 'purchase'],
'data': [
'security/group_security.xml',
'security/ir.model.access.csv',
diff --git a/sf_plan_management/views/operations_rename_menu.xml b/sf_plan_management/views/operations_rename_menu.xml
index 28bc5c6c..659df6dd 100644
--- a/sf_plan_management/views/operations_rename_menu.xml
+++ b/sf_plan_management/views/operations_rename_menu.xml
@@ -84,6 +84,29 @@
+
+
+ sale.order.form.inherited
+ sale.order
+
+
+
+
+
+
+
+
+
+ purchase.order.form.inherited
+ purchase.order
+
+
+
+
+
+
+
+
diff --git a/sf_sale/models/auto_quatotion_common.py b/sf_sale/models/auto_quatotion_common.py
index d1bdb65a..09ea3f0f 100644
--- a/sf_sale/models/auto_quatotion_common.py
+++ b/sf_sale/models/auto_quatotion_common.py
@@ -2,7 +2,7 @@
import logging
from odoo.modules import get_resource_path
from odoo import fields, models, api
-# from quatotion import readSql, feature_recognize, auto_quatotion
+from quatotion import readSql, feature_recognize, auto_quatotion
__author__ = 'jinling.yang'
_logger = logging.getLogger(__name__)
@@ -24,14 +24,14 @@ class AutoQuatotion(models.Model):
def get_process_time_db_path(self):
return get_resource_path('sf_sale', 'models', 'process_time.db')
- # def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code):
- # '''
- # 通过打包好的.so库,
- # 以调用autoQuatotion库中Quatotion类,
- # 初始化后调用类的analyseShape方法对模型文件进行价格预测
- # '''
- # # 初始化自动报价类(输入特征数据库和加工时间数据库)
- # reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path)
- # # 获取价格、加工时间、尺寸、XYZ、翻面次数
- # feature_info = reader.analyseShape(stp_url, InfoJson={})
- # return feature_info
+ def get_auto_quatotion(self, stp_url, feature_full_path, process_time_db_path, model_code):
+ '''
+ 通过打包好的.so库,
+ 以调用autoQuatotion库中Quatotion类,
+ 初始化后调用类的analyseShape方法对模型文件进行价格预测
+ '''
+ # 初始化自动报价类(输入特征数据库和加工时间数据库)
+ reader = auto_quatotion.Quatotion(feature_full_path, process_time_db_path)
+ # 获取价格、加工时间、尺寸、XYZ、翻面次数
+ feature_info = reader.analyseShape(stp_url, InfoJson={})
+ return feature_info
diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py
index 91ddedc4..0a3f5c73 100644
--- a/sf_sale/models/quick_easy_order.py
+++ b/sf_sale/models/quick_easy_order.py
@@ -82,17 +82,19 @@ class QuickEasyOrder(models.Model):
# logging.info('create-model_file:%s' % len(vals['model_file']))
obj = super(QuickEasyOrder, self).create(vals)
- self.model_coloring(obj)
+ # self.model_coloring(obj)
self.distribute_to_factory(obj)
obj.state = '待接单'
return obj
# 将attach的datas内容转为glb文件
def transition_glb_file(self, report_path, model_code):
- # shapes = read_step_file(report_path)
+ shapes = read_step_file(report_path)
+ # output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl')
+ output_file = os.path.join('/tmp', str(model_code) + '.stl')
+ write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
# output_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.stl')
output_file = os.path.join('/tmp', str(model_code) + '.stl')
- # write_stl_file(shapes, output_file, 'binary', 0.03, 0.5)
# 转化为glb
# output_glb_file = os.path.join('C:/Users/43484/Desktop/机企猫工作文档', str(model_code) + '.glb')
output_glb_file = os.path.join('/tmp', str(model_code) + '.glb')
@@ -122,17 +124,17 @@ class QuickEasyOrder(models.Model):
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
logging.info("模型编码: %s" % model_code)
item.model_file = self.transition_glb_file(report_path, model_code)
- ret = self.feature_recognition(report_path, model_code)
- logging.info("自动报价返回值: %s" % ret)
- boxshape = ret['boxshape'].tolist()
- logging.info("自动报价boxshape: %s" % boxshape)
- logging.info('自动报价feature_infos:%s' % ret['feature_infos'])
- item.model_length = boxshape[0] # 长 单位mm
- item.model_width = boxshape[1] # 宽
- item.model_height = boxshape[2] # 高
- item.model_volume = boxshape[0] * boxshape[1] * boxshape[2]
- item.model_feature = json.dumps(ret['feature_infos'], ensure_ascii=False)
- self._get_price(item)
+ # ret = self.feature_recognition(report_path, model_code)
+ # logging.info("自动报价返回值: %s" % ret)
+ # boxshape = ret['boxshape'].tolist()
+ # logging.info("自动报价boxshape: %s" % boxshape)
+ # logging.info('自动报价feature_infos:%s' % ret['feature_infos'])
+ # item.model_length = boxshape[0] # 长 单位mm
+ # item.model_width = boxshape[1] # 宽
+ # item.model_height = boxshape[2] # 高
+ # item.model_volume = boxshape[0] * boxshape[1] * boxshape[2]
+ # item.model_feature = json.dumps(ret['feature_infos'], ensure_ascii=False)
+ # self._get_price(item)
else:
item.model_file = False
item.model_feature = False
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index 664876b1..a55f4f17 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -752,40 +752,38 @@ class FunctionalToolAssembly(models.Model):
functional_tool_cutting_type = fields.Char(string='功能刀具切削类型', readonly=False)
# 整体式刀具型号
- cutting_tool_integral_model_id = fields.Many2one('product.product', string='整体式刀具型号', readonly=True,
- domain=[('cutting_tool_material_id', '=', '整体式刀具')])
- integral_code = fields.Char('整体式刀具序列号', readonly=True)
+ integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号', readonly=True)
+ cutting_tool_integral_model_id = fields.Many2one('sf.cutting.tool.material', string='整体式刀具型号', readonly=True)
integral_name = fields.Char('整体式刀具名称', readonly=True)
- sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', '整体式刀具品牌', readonly=True, domain="[('tag_ids.name', 'ilike', '刀具')]")
+ sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True)
+
# 刀片型号
- cutting_tool_blade_model_id = fields.Many2one('product.product', string='刀片型号', readonly=True,
- domain=[('cutting_tool_material_id', '=', '刀片')])
- blade_code = fields.Char('刀片序列号', readonly=True)
+ blade_code_id = fields.Many2one('stock.lot', '刀片序列号', readonly=True)
+ cutting_tool_blade_model_id = fields.Many2one('sf.cutting.tool.material', string='刀片型号', readonly=True)
blade_name = fields.Char('刀片名称', readonly=True)
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
+
# 刀杆型号
- cutting_tool_cutterbar_model_id = fields.Many2one('product.product', string='刀杆型号', readonly=True,
- domain=[('cutting_tool_material_id', '=', '刀杆')])
- bar_code = fields.Char('刀杆序列号', readonly=True)
+ bar_code_id = fields.Many2one('stock.lot', '刀杆序列号', readonly=True)
+ cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting.tool.material', string='刀杆型号', readonly=True)
bar_name = fields.Char('刀杆名称', readonly=True)
sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
+
# 刀盘型号
- cutting_tool_cutterpad_model_id = fields.Many2one('product.product', string='刀盘型号', readonly=True,
- domain=[('cutting_tool_material_id', '=', '刀盘')])
- pad_code = fields.Char('刀盘序列号', readonly=True)
+ pad_code_id = fields.Many2one('stock.lot', '刀盘序列号', readonly=True)
+ cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting.tool.material', string='刀盘型号', readonly=True)
pad_name = fields.Char('刀盘名称', readonly=True)
sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
# 刀柄型号
- cutting_tool_cutterhandle_model_id = fields.Many2one('product.product', string='刀柄型号', readonly=True,
- domain=[('cutting_tool_material_id', '=', '刀柄')])
- handle_code = fields.Char('刀柄序列号', readonly=True)
+ handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', readonly=True)
+ cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting.tool.material', string='刀柄型号', readonly=True)
handle_name = fields.Char('刀柄名称', readonly=True)
sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
+
# 夹头型号
- cutting_tool_cutterhead_model_id = fields.Many2one('product.product', string='夹头型号', readonly=True,
- domain=[('cutting_tool_material_id', '=', '夹头')])
- chuck_code = fields.Char('夹头序列号', readonly=True)
+ chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', readonly=True)
+ cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True)
chuck_name = fields.Char('夹头名称', readonly=True)
sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml
index aba086ca..1e079896 100644
--- a/sf_tool_management/views/tool_base_views.xml
+++ b/sf_tool_management/views/tool_base_views.xml
@@ -1106,72 +1106,192 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index 37f39760..c9dd4eb9 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -118,6 +118,7 @@ class ToolTransferRequestInformation(models.TransientModel):
class FunctionalToolAssemblyOrder(models.TransientModel):
_name = 'sf.functional.tool.assembly.order'
+ _inherit = ["barcodes.barcode_events_mixin"]
_description = '功能刀具组装单'
# 功能刀具申请信息
@@ -137,196 +138,123 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 功能刀具组装信息
# 整体式刀具型号
- cutting_tool_integral_model_id = fields.Many2one('product.product', string='整体式刀具型号', readonly=False,
- domain=[('cutting_tool_material_id', '=', '整体式刀具')])
- integral_code = fields.Char('整体式刀具序列号', readonly=True, compute='_compute_integral_code')
- integral_name = fields.Char('整体式刀具名称', readonly=True, compute='_compute_integral_name')
- sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', '整体式刀具品牌', readonly=True,
- compute='_compute_sf_tool_brand_id_1')
-
- @api.depends('cutting_tool_integral_model_id')
- def _compute_integral_code(self):
- for record in self:
- if record.cutting_tool_integral_model_id:
- self.integral_code = record.cutting_tool_integral_model_id.code
- else:
- self.integral_code = None
-
- @api.depends('cutting_tool_integral_model_id')
- def _compute_integral_name(self):
- for record in self:
- if record.cutting_tool_integral_model_id:
- self.integral_name = record.cutting_tool_integral_model_id.name
- else:
- self.integral_name = None
-
- @api.depends('cutting_tool_integral_model_id')
- def _compute_sf_tool_brand_id_1(self):
- for record in self:
- if record.cutting_tool_integral_model_id:
- self.sf_tool_brand_id_1 = record.cutting_tool_integral_model_id.brand_id.id
- else:
- self.sf_tool_brand_id_1 = None
+ integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号',
+ domain=[('product_id.cutting_tool_material_id.name', '=', '整体式刀具')])
+ cutting_tool_integral_model_id = fields.Many2one('sf.cutting.tool.material', string='整体式刀具型号', readonly=True)
+ integral_name = fields.Char('整体式刀具名称', readonly=True)
+ sf_tool_brand_id_1 = fields.Many2one('sf.machine.brand', string='整体式刀具品牌', readonly=True)
# 刀片型号
- cutting_tool_blade_model_id = fields.Many2one('product.product', string='刀片型号', readonly=False,
- domain=[('cutting_tool_material_id', '=', '刀片')])
- blade_code = fields.Char('刀片序列号', readonly=True, compute='_compute_blade_code')
- blade_name = fields.Char('刀片名称', readonly=True, compute='_compute_blade_name')
- sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True,
- compute='_compute_sf_tool_brand_id_2')
-
- @api.depends('cutting_tool_blade_model_id')
- def _compute_blade_code(self):
- for record in self:
- if record.cutting_tool_blade_model_id:
- self.blade_code = self.cutting_tool_blade_model_id.code
- else:
- self.blade_code = None
-
- @api.depends('cutting_tool_blade_model_id')
- def _compute_blade_name(self):
- for record in self:
- if record.cutting_tool_blade_model_id:
- self.blade_name = self.cutting_tool_blade_model_id.name
- else:
- self.blade_name = None
-
- @api.depends('cutting_tool_blade_model_id')
- def _compute_sf_tool_brand_id_2(self):
- for record in self:
- if record.cutting_tool_blade_model_id:
- self.sf_tool_brand_id_2 = self.cutting_tool_blade_model_id.brand_id.id
- else:
- self.sf_tool_brand_id_2 = None
+ blade_code_id = fields.Many2one('stock.lot', '刀片序列号',
+ domain=[('product_id.cutting_tool_material_id.name', '=', '刀片')])
+ cutting_tool_blade_model_id = fields.Many2one('sf.cutting.tool.material', string='刀片型号', readonly=True)
+ blade_name = fields.Char('刀片名称', readonly=True)
+ sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
# 刀杆型号
- cutting_tool_cutterbar_model_id = fields.Many2one('product.product', string='刀杆型号', readonly=False,
- domain=[('cutting_tool_material_id', '=', '刀杆')])
- bar_code = fields.Char('刀杆序列号', readonly=True, compute='_compute_bar_code')
- bar_name = fields.Char('刀杆名称', readonly=True, compute='_compute_bar_name')
- sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True,
- compute='_compute_sf_tool_brand_id_3')
-
- @api.depends('cutting_tool_cutterbar_model_id')
- def _compute_bar_code(self):
- for record in self:
- if record.cutting_tool_cutterbar_model_id:
- self.bar_code = self.cutting_tool_cutterbar_model_id.code
- else:
- self.bar_code = None
-
- @api.depends('cutting_tool_cutterbar_model_id')
- def _compute_bar_name(self):
- for record in self:
- if record.cutting_tool_cutterbar_model_id:
- self.bar_name = self.cutting_tool_cutterbar_model_id.name
- else:
- self.bar_name = None
-
- @api.depends('cutting_tool_cutterbar_model_id')
- def _compute_sf_tool_brand_id_3(self):
- for record in self:
- if record.cutting_tool_cutterbar_model_id:
- self.sf_tool_brand_id_3 = self.cutting_tool_cutterbar_model_id.brand_id.id
- else:
- self.sf_tool_brand_id_3 = None
+ bar_code_id = fields.Many2one('stock.lot', '刀杆序列号',
+ domain=[('product_id.cutting_tool_material_id.name', '=', '刀杆')])
+ cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting.tool.material', string='刀杆型号', readonly=True)
+ bar_name = fields.Char('刀杆名称', readonly=True)
+ sf_tool_brand_id_3 = fields.Many2one('sf.machine.brand', '刀杆品牌', readonly=True)
# 刀盘型号
- cutting_tool_cutterpad_model_id = fields.Many2one('product.product', string='刀盘型号', readonly=False,
- domain=[('cutting_tool_material_id', '=', '刀盘')])
- pad_code = fields.Char('刀盘序列号', readonly=True, compute='_compute_pad_code')
- pad_name = fields.Char('刀盘名称', readonly=True, compute='_compute_pad_name')
- sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True,
- compute='_compute_sf_tool_brand_id_4')
-
- @api.depends('cutting_tool_cutterpad_model_id')
- def _compute_pad_code(self):
- for record in self:
- if record.cutting_tool_cutterpad_model_id:
- self.pad_code = self.cutting_tool_cutterpad_model_id.code
- else:
- self.pad_code = None
-
- @api.depends('cutting_tool_cutterpad_model_id')
- def _compute_pad_name(self):
- for record in self:
- if record.cutting_tool_cutterpad_model_id:
- self.pad_name = self.cutting_tool_cutterpad_model_id.name
- else:
- self.pad_name = None
-
- @api.depends('cutting_tool_cutterpad_model_id')
- def _compute_sf_tool_brand_id_4(self):
- for record in self:
- if record.cutting_tool_cutterpad_model_id:
- self.sf_tool_brand_id_4 = self.cutting_tool_cutterpad_model_id.brand_id.id
- else:
- self.sf_tool_brand_id_4 = None
+ pad_code_id = fields.Many2one('stock.lot', '刀盘序列号',
+ domain=[('product_id.cutting_tool_material_id.name', '=', '刀盘')])
+ cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting.tool.material', string='刀盘型号', readonly=True)
+ pad_name = fields.Char('刀盘名称', readonly=True)
+ sf_tool_brand_id_4 = fields.Many2one('sf.machine.brand', '刀盘品牌', readonly=True)
# 刀柄型号
- cutting_tool_cutterhandle_model_id = fields.Many2one('product.product', string='刀柄型号', readonly=False,
- domain=[('cutting_tool_material_id', '=', '刀柄')])
- handle_code = fields.Char('刀柄序列号', readonly=True, compute='_compute_handle_code')
- handle_name = fields.Char('刀柄名称', readonly=True, compute='_compute_handle_name')
- sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True,
- compute='_compute_sf_tool_brand_id_5')
-
- @api.depends('cutting_tool_cutterhandle_model_id')
- def _compute_handle_code(self):
- for record in self:
- if record.cutting_tool_cutterhandle_model_id:
- self.handle_code = self.cutting_tool_cutterhandle_model_id.code
- else:
- self.handle_code = None
-
- @api.depends('cutting_tool_cutterhandle_model_id')
- def _compute_handle_name(self):
- for record in self:
- if record.cutting_tool_cutterhandle_model_id:
- self.handle_name = self.cutting_tool_cutterhandle_model_id.name
- else:
- self.handle_name = None
-
- @api.depends('cutting_tool_cutterhandle_model_id')
- def _compute_sf_tool_brand_id_5(self):
- for record in self:
- if record.cutting_tool_cutterhandle_model_id:
- self.sf_tool_brand_id_5 = self.cutting_tool_cutterhandle_model_id.brand_id.id
- else:
- self.sf_tool_brand_id_5 = None
+ handle_code_id = fields.Many2one('stock.lot', '刀柄序列号',
+ domain=[('product_id.cutting_tool_material_id.name', '=', '刀柄')])
+ cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting.tool.material', string='刀柄型号', readonly=True)
+ handle_name = fields.Char('刀柄名称', readonly=True)
+ sf_tool_brand_id_5 = fields.Many2one('sf.machine.brand', '刀柄品牌', readonly=True)
# 夹头型号
- cutting_tool_cutterhead_model_id = fields.Many2one('product.product', string='夹头型号', readonly=False,
- domain=[('cutting_tool_material_id', '=', '夹头')])
- chuck_code = fields.Char('夹头序列号', readonly=True, compute='_compute_chuck_code')
- chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_chuck_name')
- sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True,
- compute='_compute_sf_tool_brand_id_6')
+ chuck_code_id = fields.Many2one('stock.lot', '夹头序列号',
+ domain=[('product_id.cutting_tool_material_id.name', '=', '夹头')])
+ cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting.tool.material', string='夹头型号', readonly=True)
+ chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')
+ sf_tool_brand_id_6 = fields.Many2one('sf.machine.brand', '夹头品牌', readonly=True)
- @api.depends('cutting_tool_cutterhead_model_id')
- def _compute_chuck_code(self):
+ def on_barcode_scanned(self, barcode):
+ """
+ 智能工厂组装单处扫码绑定刀具物料')
+ """
for record in self:
- if record.cutting_tool_cutterhead_model_id:
- self.chuck_code = self.cutting_tool_cutterhead_model_id.code
- else:
- self.chuck_code = None
+ records = record.env['stock.lot'].search([('name', '=', barcode)])
+ if not records:
+ raise ValidationError('扫描的条形码数据不存在,请重新扫描!')
+ for record_stock_lot in records:
+ tool_material_name = record_stock_lot.product_id.cutting_tool_material_id.name
+ if tool_material_name == '整体式刀具':
+ record.integral_code_id = record_stock_lot.id
+ elif tool_material_name == '刀片':
+ record.blade_code_id = record_stock_lot.id
+ elif tool_material_name == '刀杆':
+ record.bar_code_id = record_stock_lot.id
+ elif tool_material_name == '刀盘':
+ record.pad_code_id = record_stock_lot.id
+ elif tool_material_name == '刀柄':
+ record.handle_code_id = record_stock_lot.id
+ elif tool_material_name == '夹头':
+ record.chuck_code_id = record_stock_lot.id
+ else:
+ raise ValidationError('扫描的刀具物料不存在,请重新扫描!')
- @api.depends('cutting_tool_cutterhead_model_id')
- def _compute_chuck_name(self):
+ @api.depends('integral_code_id', 'blade_code_id', 'bar_code_id', 'pad_code_id', 'handle_code_id', 'chuck_code_id')
+ def _compute_auto_fill(self):
for record in self:
- if record.cutting_tool_cutterhead_model_id:
- self.chuck_name = self.cutting_tool_cutterhead_model_id.name
+ if record.integral_code_id:
+ record.cutting_tool_integral_model_id = record.integral_code_id.product_id.cutting_tool_material_id.id
+ record.integral_name = record.integral_code_id.product_id.name
+ record.sf_tool_brand_id_1 = record.integral_code_id.product_id.brand_id.id
else:
- self.chuck_name = None
-
- @api.depends('cutting_tool_cutterhead_model_id')
- def _compute_sf_tool_brand_id_6(self):
- for record in self:
- if record.cutting_tool_cutterhead_model_id:
- self.sf_tool_brand_id_6 = self.cutting_tool_cutterhead_model_id.brand_id.id
+ record.cutting_tool_integral_model_id = None
+ record.integral_name = None
+ record.sf_tool_brand_id_1 = None
+ if record.blade_code_id:
+ record.cutting_tool_blade_model_id = record.blade_code_id.product_id.cutting_tool_material_id.id
+ record.blade_name = record.blade_code_id.product_id.name
+ record.sf_tool_brand_id_2 = record.blade_code_id.product_id.brand_id.id
else:
- self.sf_tool_brand_id_6 = None
+ record.cutting_tool_blade_model_id = None
+ record.blade_name = None
+ record.sf_tool_brand_id_2 = None
+ if record.bar_code_id:
+ record.cutting_tool_cutterbar_model_id = record.bar_code_id.product_id.cutting_tool_material_id.id
+ record.bar_name = record.bar_code_id.product_id.name
+ record.sf_tool_brand_id_3 = record.bar_code_id.product_id.brand_id.id
+ else:
+ record.cutting_tool_cutterbar_model_id = None
+ record.bar_name = None
+ record.sf_tool_brand_id_3 = None
+ if record.pad_code_id:
+ record.cutting_tool_cutterpad_model_id = record.pad_code_id.product_id.cutting_tool_material_id.id
+ record.pad_name = record.pad_code_id.product_id.name
+ record.sf_tool_brand_id_4 = record.pad_code_id.product_id.brand_id.id
+ else:
+ record.cutting_tool_cutterpad_model_id = None
+ record.pad_name = None
+ record.sf_tool_brand_id_4 = None
+ if record.handle_code_id:
+ record.cutting_tool_cutterhandle_model_id = record.handle_code_id.product_id.cutting_tool_material_id.id
+ record.handle_name = record.handle_code_id.product_id.name
+ record.sf_tool_brand_id_5 = record.handle_code_id.product_id.brand_id.id
+ else:
+ record.cutting_tool_cutterhandle_model_id = None
+ record.handle_name = None
+ record.sf_tool_brand_id_5 = None
+ if record.chuck_code_id:
+ record.cutting_tool_cutterhead_model_id = record.chuck_code_id.product_id.cutting_tool_material_id.id
+ record.chuck_name = record.chuck_code_id.product_id.name
+ record.sf_tool_brand_id_6 = record.chuck_code_id.product_id.brand_id.id
+ else:
+ record.cutting_tool_cutterhead_model_id = None
+ record.chuck_name = None
+ record.sf_tool_brand_id_6 = None
coarse_middle_thin = fields.Selection([("1", "粗"), ('2', '中'), ('3', '精')], string='粗/中/精', default='1')
tool_loading_length = fields.Char(string='装刀长')
@@ -343,27 +271,27 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
"""
desc_1 = {
'cutting_tool_integral_model_id': self.cutting_tool_integral_model_id.id,
- 'integral_code': self.integral_code,
+ 'integral_code_id': self.integral_code_id.id,
'integral_name': self.integral_name,
'sf_tool_brand_id_1': self.sf_tool_brand_id_1,
'cutting_tool_blade_model_id': self.cutting_tool_blade_model_id.id,
- 'blade_code': self.blade_code,
+ 'blade_code_id': self.blade_code_id.id,
'blade_name': self.blade_name,
'sf_tool_brand_id_2': self.sf_tool_brand_id_2,
'cutting_tool_cutterbar_model_id': self.cutting_tool_cutterbar_model_id.id,
- 'bar_code': self.bar_code,
+ 'bar_code_id': self.bar_code_id.id,
'bar_name': self.bar_name,
'sf_tool_brand_id_3': self.sf_tool_brand_id_3,
'cutting_tool_cutterpad_model_id': self.cutting_tool_cutterpad_model_id.id,
- 'pad_code': self.pad_code,
+ 'pad_code_id': self.pad_code_id.id,
'pad_name': self.pad_name,
'sf_tool_brand_id_4': self.sf_tool_brand_id_4,
'cutting_tool_cutterhandle_model_id': self.cutting_tool_cutterhandle_model_id.id,
- 'handle_code': self.handle_code,
+ 'handle_code_id': self.handle_code_id.id,
'handle_name': self.handle_name,
'sf_tool_brand_id_5': self.sf_tool_brand_id_5,
'cutting_tool_cutterhead_model_id': self.cutting_tool_cutterhead_model_id.id,
- 'chuck_code': self.chuck_code,
+ 'chuck_code_id': self.chuck_code_id.id,
'chuck_name': self.chuck_name,
'sf_tool_brand_id_6': self.sf_tool_brand_id_6,
'coarse_middle_thin': self.coarse_middle_thin,
diff --git a/sf_tool_management/wizard/wizard_view.xml b/sf_tool_management/wizard/wizard_view.xml
index 6398b362..e90599e6 100644
--- a/sf_tool_management/wizard/wizard_view.xml
+++ b/sf_tool_management/wizard/wizard_view.xml
@@ -140,58 +140,142 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+