Date: Mon, 27 Nov 2023 17:08:11 +0800
Subject: [PATCH 08/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9coding=E4=BB=A3?=
=?UTF-8?q?=E7=A0=81=E6=89=AB=E6=8F=8F=E8=AD=A6=E5=91=8A?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_machine_connect/models/ftp_client.py | 4 ----
sf_machine_connect/models/ftp_operate.py | 2 --
.../sf_equipment_maintenance_standards.py | 4 ++--
sf_maintenance/models/sf_maintenance.py | 4 ++--
.../models/sf_maintenance_requests.py | 2 +-
sf_manufacturing/__manifest__.py | 8 -------
sf_manufacturing/models/mrp_workorder.py | 2 +-
sf_sale/models/auto_quatotion_common.py | 24 +++++++++----------
sf_tool_management/__manifest__.py | 2 +-
sf_warehouse/models/model.py | 3 +--
.../controllers/main.py | 1 -
.../models/login_image.py | 2 +-
.../models/res_config_settings.py | 2 +-
zpl_print/controllers/report.py | 4 +---
zpl_print/models/common.py | 2 +-
15 files changed, 24 insertions(+), 42 deletions(-)
diff --git a/sf_machine_connect/models/ftp_client.py b/sf_machine_connect/models/ftp_client.py
index 7ca0ad06..8a3eb95f 100644
--- a/sf_machine_connect/models/ftp_client.py
+++ b/sf_machine_connect/models/ftp_client.py
@@ -3,9 +3,7 @@ import os
import time
import json
import base64
-import shutil
import logging
-import hashlib
from io import BytesIO
from zipfile import ZipFile
from datetime import datetime, timedelta
@@ -13,8 +11,6 @@ import requests
from odoo.http import request
from odoo import fields, models, api, _
from odoo.exceptions import UserError
-from odoo.exceptions import MissingError
-from odoo.exceptions import ValidationError
from odoo.addons.sf_machine_connect.models import py2opcua, ftp_operate
_logger = logging.getLogger(__name__)
diff --git a/sf_machine_connect/models/ftp_operate.py b/sf_machine_connect/models/ftp_operate.py
index 457ef6ed..29ee69a1 100644
--- a/sf_machine_connect/models/ftp_operate.py
+++ b/sf_machine_connect/models/ftp_operate.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-import os
import logging
from ftplib import FTP
@@ -20,7 +19,6 @@ class FTP_P(FTP):
cmd = 'LIST'
templist = []
tempdic = {}
- func = None
if args[-1:] and type(args[-1]) != type(''):
args, func = args[:-1], args[-1]
for arg in args:
diff --git a/sf_maintenance/models/sf_equipment_maintenance_standards.py b/sf_maintenance/models/sf_equipment_maintenance_standards.py
index 2892cac4..92a94c0e 100644
--- a/sf_maintenance/models/sf_equipment_maintenance_standards.py
+++ b/sf_maintenance/models/sf_equipment_maintenance_standards.py
@@ -1,6 +1,6 @@
# -*-coding:utf-8-*-
-from odoo import api, fields, models, SUPERUSER_ID, _
-from odoo.exceptions import UserError
+from odoo import api, fields, models
+
class SfEquipmentSaintenanceStandards(models.Model):
diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py
index 0bd64991..d7eb3d55 100644
--- a/sf_maintenance/models/sf_maintenance.py
+++ b/sf_maintenance/models/sf_maintenance.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
import json
import base64
-from datetime import date, datetime, timedelta
+from datetime import timedelta
import requests
from odoo.addons.sf_base.commons.common import Common
-from odoo import api, fields, models, SUPERUSER_ID, _
+from odoo import api, fields, models, _
from odoo.exceptions import UserError
diff --git a/sf_maintenance/models/sf_maintenance_requests.py b/sf_maintenance/models/sf_maintenance_requests.py
index 4c9e8fde..8686926b 100644
--- a/sf_maintenance/models/sf_maintenance_requests.py
+++ b/sf_maintenance/models/sf_maintenance_requests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import base64
-from odoo import api, fields, models, SUPERUSER_ID, _
+from odoo import api, fields, models, _
from odoo.exceptions import UserError
diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py
index 69004216..d963ab3e 100644
--- a/sf_manufacturing/__manifest__.py
+++ b/sf_manufacturing/__manifest__.py
@@ -41,14 +41,6 @@
],
'qweb': [
],
- 'assets': {
- 'web.assets_backend': [
- 'sf_manufacturing/static/src/js/kanban_change.js',
- 'sf_manufacturing/static/src/scss/kanban_change.scss',
- 'sf_manufacturing/static/src/xml/kanban_change.xml',
- ],
-
- },
'license': 'LGPL-3',
'installable': True,
'application': False,
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 133c1ec0..8d3bf6c2 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -616,7 +616,7 @@ class CNCprocessing(models.Model):
logging.info('folder_name:%s' % folder_name)
serverdir = os.path.join('/tmp', folder_name, 'return', processing_panel)
logging.info('serverdir:%s' % serverdir)
- for root, dirs, files in os.walk(serverdir):
+ for root, files in os.walk(serverdir):
for f in files:
logging.info('f:%s' % f)
if os.path.splitext(f)[1] == ".pdf":
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_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py
index d59c6b34..20bf2b2a 100644
--- a/sf_tool_management/__manifest__.py
+++ b/sf_tool_management/__manifest__.py
@@ -12,7 +12,7 @@
'website': 'https://www.sf.jikimo.com',
'depends': ['sf_base', 'sf_manufacturing'],
'data': [
- # 'security/group_security.xml',
+ 'security/group_security.xml',
'security/ir.model.access.csv',
# 'views/tool_base_views.xml',
# # 'views/menu_view.xml',
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index cfa097ce..3e6f52d0 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
-import logging
-from odoo import SUPERUSER_ID, _, api, fields, models
+from odoo import api, fields, models
from odoo.osv import expression
diff --git a/yizuo_login_background_and_styles/controllers/main.py b/yizuo_login_background_and_styles/controllers/main.py
index 6412ba67..d1271133 100644
--- a/yizuo_login_background_and_styles/controllers/main.py
+++ b/yizuo_login_background_and_styles/controllers/main.py
@@ -23,7 +23,6 @@ try:
import httpagentparser
except ImportError:
pass
-from time import gmtime, strftime
from odoo.addons.web.controllers import home
from odoo.http import request
from odoo.exceptions import Warning
diff --git a/yizuo_login_background_and_styles/models/login_image.py b/yizuo_login_background_and_styles/models/login_image.py
index 5b3b19fe..c8a36e0d 100644
--- a/yizuo_login_background_and_styles/models/login_image.py
+++ b/yizuo_login_background_and_styles/models/login_image.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from odoo import models, fields, api, _
+from odoo import models, fields
class LoginImage(models.Model):
diff --git a/yizuo_login_background_and_styles/models/res_config_settings.py b/yizuo_login_background_and_styles/models/res_config_settings.py
index 66394f9e..cefc659f 100644
--- a/yizuo_login_background_and_styles/models/res_config_settings.py
+++ b/yizuo_login_background_and_styles/models/res_config_settings.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from odoo import api, fields, models, modules
+from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
diff --git a/zpl_print/controllers/report.py b/zpl_print/controllers/report.py
index ade1c26f..7d9041de 100644
--- a/zpl_print/controllers/report.py
+++ b/zpl_print/controllers/report.py
@@ -8,11 +8,9 @@ import werkzeug.exceptions
import werkzeug.utils
import werkzeug.wrappers
import werkzeug.wsgi
-from werkzeug.urls import url_parse
from odoo import http
-from odoo.http import content_disposition, request
-from odoo.tools.safe_eval import safe_eval, time
+from odoo.http import request
from odoo.addons.web.controllers.report import ReportController
from ..models.common import Common
diff --git a/zpl_print/models/common.py b/zpl_print/models/common.py
index c10d5a74..d45f74e0 100644
--- a/zpl_print/models/common.py
+++ b/zpl_print/models/common.py
@@ -18,4 +18,4 @@ class Common(models.Model):
tsclibrary.printlabelW("0", "1");
tsclibrary.closeport();
except Exception as e:
- raise UserWarning("错误警告")
+ raise UserWarning("错误警告:%s" % e)
From 5926d71d2720dd505cfa2f19a35493385409c3cd Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Mon, 27 Nov 2023 17:27:55 +0800
Subject: [PATCH 09/14] =?UTF-8?q?1=E3=80=81=E6=96=B0=E5=A2=9E=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E5=88=80=E5=85=B7=E5=88=97=E8=A1=A8=E6=A8=A1=E5=9E=8B?=
=?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97=E5=8A=9F=E8=83=BD=E5=88=80?=
=?UTF-8?q?=E5=85=B7=E5=9C=A8=E5=88=80=E5=85=B7=E6=88=BF=E6=95=B0=E9=87=8F?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=9B2=E3=80=81=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E5=AE=89=E5=85=A8=E5=BA=93?=
=?UTF-8?q?=E5=AD=98=E6=A8=A1=E5=9E=8B=E7=9B=B8=E5=90=8C=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=88=80=E5=85=B7=E7=9A=84=E6=A3=80=E7=B4=A2=E6=9D=A1=E4=BB=B6?=
=?UTF-8?q?=EF=BC=9B3=E3=80=81=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=88=80=E5=85=B7=E7=BB=84=E8=A3=85=E5=8D=95=E7=BB=84=E8=A3=85?=
=?UTF-8?q?=E7=9A=84=E5=88=9D=E5=A7=8B=E4=BD=8D=E7=BD=AE=E4=B8=BAProductio?=
=?UTF-8?q?n=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=8A=9F=E8=83=BD=E5=88=80?=
=?UTF-8?q?=E5=85=B7=E5=BA=8F=E5=88=97=E5=8F=B7=E7=9A=84=E7=94=9F=E6=88=90?=
=?UTF-8?q?=E8=A7=84=E5=88=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/model_type.py | 2 +-
sf_tool_management/__manifest__.py | 4 +-
sf_tool_management/models/base.py | 4 +-
.../models/tool_material_search.py | 2 +-
sf_tool_management/views/tool_base_views.xml | 1 +
sf_tool_management/wizard/wizard.py | 37 ++-----------------
6 files changed, 9 insertions(+), 41 deletions(-)
diff --git a/sf_manufacturing/models/model_type.py b/sf_manufacturing/models/model_type.py
index 48707939..29357d02 100644
--- a/sf_manufacturing/models/model_type.py
+++ b/sf_manufacturing/models/model_type.py
@@ -1,4 +1,4 @@
-from odoo import fields, models, api
+from odoo import fields, models
class ModelType(models.Model):
diff --git a/sf_tool_management/__manifest__.py b/sf_tool_management/__manifest__.py
index d59c6b34..66142708 100644
--- a/sf_tool_management/__manifest__.py
+++ b/sf_tool_management/__manifest__.py
@@ -10,12 +10,10 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
- 'depends': ['sf_base', 'sf_manufacturing'],
+ 'depends': ['sf_manufacturing'],
'data': [
# 'security/group_security.xml',
'security/ir.model.access.csv',
- # 'views/tool_base_views.xml',
- # # 'views/menu_view.xml',
'wizard/wizard_view.xml',
'views/tool_base_views.xml',
'views/menu_view.xml',
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index 35949f47..99a7f3d9 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -25,7 +25,7 @@ class FunctionalCuttingToolEntity(models.Model):
tool_loading_length = fields.Float(string='装刀长(mm)', readonly=True)
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True)
effective_length = fields.Float(string='有效长(mm)', readonly=True)
- tool_room_num = fields.Integer(string='刀具房数量', readonly=True, )
+ tool_room_num = fields.Integer(string='刀具房数量', readonly=True, compute='_compute_location_num')
line_edge_knife_library_num = fields.Integer(string='线边刀库数量', readonly=True)
machine_knife_library_num = fields.Integer(string='机内刀库数量', readonly=True)
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
@@ -241,7 +241,7 @@ class RealTimeDistributionOfFunctionalTools(models.Model):
record = self.env['sf.real.time.distribution.of.functional.tools'].search(
[('name', '=', vals['name']), ('sf_cutting_tool_type_id', '=', vals['sf_cutting_tool_type_id']),
('diameter', '=', vals['diameter']), ('knife_tip_r_angle', '=', vals['knife_tip_r_angle']),
- ('knife_tip_r_angle', '=', vals['knife_tip_r_angle'])])
+ ('coarse_middle_thin', '=', vals['coarse_middle_thin'])])
print(record)
if len(record) > 0:
for obj in record:
diff --git a/sf_tool_management/models/tool_material_search.py b/sf_tool_management/models/tool_material_search.py
index b89b76cd..2453aafb 100644
--- a/sf_tool_management/models/tool_material_search.py
+++ b/sf_tool_management/models/tool_material_search.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from odoo import fields, models, api, SUPERUSER_ID
-from odoo.exceptions import ValidationError
+# from odoo.exceptions import ValidationError
# 刀具物料搜索
diff --git a/sf_tool_management/views/tool_base_views.xml b/sf_tool_management/views/tool_base_views.xml
index a764b896..8ebb20d4 100644
--- a/sf_tool_management/views/tool_base_views.xml
+++ b/sf_tool_management/views/tool_base_views.xml
@@ -284,6 +284,7 @@
+
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index 16ae5259..e3d4cff7 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -438,45 +438,13 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
return stock_lot
- # def tool_material_out_of_store(self, tool_material_serial_id):
- # """
- # 刀具物料出库
- # """
- # # 获取位置
- # location_id = self.env['stock.location'].search([('name', '=', 'Stock')])
- # location_dest_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
- # print("已运行2222")
- # # 创建库存移动
- # stock_move_id = self.env['stock.move'].create({
- # 'name': '刀具物料出库',
- # 'lot_id': tool_material_serial_id.id,
- # 'product_id': tool_material_serial_id.product_id.id,
- # 'location_id': location_id.id,
- # 'location_dest_id': location_dest_id.id,
- # 'product_uom_qty': 1.00,
- # 'state': 'done'
- # })
- # print("已运行3333")
- # print(stock_move_id)
- # # 创建移动历史
- # stock_move_line_id = self.env['stock.move.line'].create({
- # 'product_id': tool_material_serial_id.product_id.id,
- # 'lot_id': tool_material_serial_id.id,
- # 'move_id': stock_move_id.id,
- # 'install_tool_time': fields.Datetime.now(),
- # 'qty_done': 1.0,
- # 'state': 'done'
- # })
- #
- # return stock_move_id, stock_move_line_id
-
def create_stock_quant(self, product_id, stock_lot, functional_tool_assembly):
"""
创建功能刀具该批次/序列号 库存移动和移动历史
"""
# 获取位置对象
stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
- location_inventory_id = self.env['stock.location'].search([('name', '=', 'Inventory adjustment')])
+ location_inventory_id = self.env['stock.location'].search([('name', '=', 'Production')])
# 创建库存移动
stock_move_id = self.env['stock.move'].create({
@@ -504,7 +472,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
"""
生成功能刀具序列号
"""
- code = 'JKM-T-' + str(self.functional_tool_type_id.code) + '-' + str(self.functional_tool_diameter) + '-'
+ code = 'JKM-T-' + str(self.functional_tool_type_id.code) + '-' + str(
+ self.after_assembly_functional_tool_diameter) + '-'
new_time = fields.Date.today()
code += str(new_time) + '-'
stock_lot_id = self.env['stock.lot'].sudo().search(
From 4f83c5f29acb018f87c6a5d18ec801f2249eb2e1 Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Mon, 27 Nov 2023 21:30:45 +0800
Subject: [PATCH 10/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AD=A6=E5=91=8A?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Many2OneRadioField/many2one_radio_field.js | 2 --
.../custom_many2many_checkboxes.js | 13 +++++++------
.../src/js/custom_form_status_indicator.js | 2 +-
jikimo_frontend/static/src/list/custom_width.js | 4 ++--
.../static/src/views/list_nums/list_nbCols.js | 2 +-
sf_bf_connect/models/jd_eclp.py | 13 +++++++++----
sf_bf_connect/models/process_status.py | 2 +-
sf_machine_connect/models/ftp_client.py | 5 ++---
.../static/src/js/barcode_button.js | 7 +++----
sf_machine_connect/static/src/js/barcode_form.js | 2 +-
.../static/src/js/barcode_handler_field.js | 7 +++----
sf_machine_connect/wizard/action_up.py | 10 +++-------
sf_manufacturing/static/src/js/kanban_change.js | 15 +++------------
sf_quality/models/custom_quality.py | 2 +-
sf_warehouse/static/src/colorGuide.js | 6 ++----
sf_warehouse/static/src/js/cust_char.js | 16 +++++++---------
.../static/src/js/custom_kanban_controller.js | 8 ++++----
sf_warehouse/static/src/js/custom_many2one.js | 8 ++++----
.../static/src/js/3d_viewer.js | 8 ++++----
19 files changed, 58 insertions(+), 74 deletions(-)
diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
index 836ee6d8..2be3365c 100644
--- a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
+++ b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
@@ -11,7 +11,6 @@ export class Many2OneRadioField extends RadioField {
// 你自己的代码
}
-
onImageClick(event) {
// 放大图片逻辑
// 获取图片元素
@@ -47,7 +46,6 @@ export class Many2OneRadioField extends RadioField {
return [];
}
}
-
}
Many2OneRadioField.template = "jikimo_frontend.Many2OneRadioField"
diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js
index 5845dbae..a3053b72 100644
--- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js
+++ b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js
@@ -15,23 +15,24 @@ export class MyCustomWidget extends Many2ManyCheckboxesField {
// 放大图片逻辑
// 获取图片元素
const img = event.target;
- const close = img.nextSibling
+ const close = img.nextSibling;
// 实现放大图片逻辑
// 比如使用 CSS 放大
img.parentElement.classList.add('zoomed');
- close.classList.add('img_close')
+ close.classList.add('img_close');
}
onCloseClick(event) {
const close = event.target;
- const img = close.previousSibling
- img.parentElement.classList.remove('zoomed')
- close.classList.remove('img_close')
+ const img = close.previousSibling;
+ img.parentElement.classList.remove('zoomed');
+ close.classList.remove('img_close');
}
}
-MyCustomWidget.template = "jikimo_frontend.MyCustomWidget"
+MyCustomWidget.template = "jikimo_frontend.MyCustomWidget";
// MyCustomWidget.supportedTypes = ['many2many'];
registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget);
+
diff --git a/jikimo_frontend/static/src/js/custom_form_status_indicator.js b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
index a5f68479..c1ba8248 100644
--- a/jikimo_frontend/static/src/js/custom_form_status_indicator.js
+++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
@@ -3,7 +3,7 @@
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"
+import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator";
var Dialog = require('web.Dialog');
// var {patch} = require("web.utils") 这句话也行
diff --git a/jikimo_frontend/static/src/list/custom_width.js b/jikimo_frontend/static/src/list/custom_width.js
index 785bedb5..f7c1c55d 100644
--- a/jikimo_frontend/static/src/list/custom_width.js
+++ b/jikimo_frontend/static/src/list/custom_width.js
@@ -1,7 +1,7 @@
/** @odoo-module */
import {patch} from '@web/core/utils/patch';
-import {ListRenderer} from "@web/views/list/list_renderer"
+import {ListRenderer} from "@web/views/list/list_renderer";
// var {patch} = require("web.utils") 这句话也行
@@ -17,7 +17,7 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
const table = this.tableRef.el;
const headers = [...table.querySelectorAll("thead th:not(.o_list_actions_header)")];
- const column_num = headers.length
+ const column_num = headers.length;
if (!this.columnWidths || !this.columnWidths.length) {
// no column widths to restore
diff --git a/jikimo_frontend/static/src/views/list_nums/list_nbCols.js b/jikimo_frontend/static/src/views/list_nums/list_nbCols.js
index b0bacb02..1403544f 100644
--- a/jikimo_frontend/static/src/views/list_nums/list_nbCols.js
+++ b/jikimo_frontend/static/src/views/list_nums/list_nbCols.js
@@ -8,4 +8,4 @@ patch(ListRenderer.prototype, '/jikimo_frontend/static/src/views/list_nums/list_
const nbCols = this._super(...arguments);
return nbCols + 1;
}
-});
\ No newline at end of file
+});
diff --git a/sf_bf_connect/models/jd_eclp.py b/sf_bf_connect/models/jd_eclp.py
index 1b3c10ab..4ccb0db6 100644
--- a/sf_bf_connect/models/jd_eclp.py
+++ b/sf_bf_connect/models/jd_eclp.py
@@ -3,9 +3,9 @@ import logging
from datetime import datetime
import requests
import cpca
-from odoo.exceptions import UserError
-from odoo.exceptions import ValidationError
-from odoo import api, fields, models, SUPERUSER_ID, _
+# from odoo.exceptions import UserError
+# from odoo.exceptions import ValidationError
+from odoo import api, fields, models
_logger = logging.getLogger(__name__)
@@ -44,12 +44,18 @@ class JdEclp(models.Model):
@api.depends('name')
def _check_is_out(self):
+ """
+ 判断是否为出库单
+ """
if self.name:
is_check_out = self.name.split('/')
self.check_out = is_check_out[1]
@api.depends('carrier_tracking_ref')
def query_bill_pdf(self):
+ """
+ 查询物流面单,并赋值给bill
+ """
self.bill = self.env['ir.attachment'].sudo().search([('name', '=', self.carrier_tracking_ref)])
@api.depends('origin')
@@ -84,7 +90,6 @@ class JdEclp(models.Model):
self.receiverTownName = self.receiverTownName
except Exception as e:
print(f"Error address is none: {e}")
- pass
def create_order(self):
# sale_order_id = self.env['sale.order'].search([('name', '=', self.origin)])
diff --git a/sf_bf_connect/models/process_status.py b/sf_bf_connect/models/process_status.py
index f7b7dccd..d79b3369 100644
--- a/sf_bf_connect/models/process_status.py
+++ b/sf_bf_connect/models/process_status.py
@@ -212,7 +212,7 @@ class FinishStatusChange(models.Model):
action['context'] = {'default_picking_ids': self.ids}
return action
- out_start_time = str(datetime.now())
+ # out_start_time = str(datetime.now())
json2 = {
'params': {
'model_name': 'jikimo.process.order',
diff --git a/sf_machine_connect/models/ftp_client.py b/sf_machine_connect/models/ftp_client.py
index 7ca0ad06..10894d3a 100644
--- a/sf_machine_connect/models/ftp_client.py
+++ b/sf_machine_connect/models/ftp_client.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import os
-import time
import json
import base64
import shutil
@@ -11,7 +10,7 @@ from zipfile import ZipFile
from datetime import datetime, timedelta
import requests
from odoo.http import request
-from odoo import fields, models, api, _
+from odoo import fields, models, api
from odoo.exceptions import UserError
from odoo.exceptions import MissingError
from odoo.exceptions import ValidationError
@@ -470,7 +469,7 @@ class WorkCenterBarcode(models.Model):
raise UserError('NC下发执行超时, 请检查下发状态')
def get__state(self):
- pay_time = str(datetime.now())
+ # pay_time = str(datetime.now())
json = {
'params': {
'model_name': 'jikimo.process.order',
diff --git a/sf_machine_connect/static/src/js/barcode_button.js b/sf_machine_connect/static/src/js/barcode_button.js
index e7d9f879..5fcd8caf 100644
--- a/sf_machine_connect/static/src/js/barcode_button.js
+++ b/sf_machine_connect/static/src/js/barcode_button.js
@@ -97,13 +97,12 @@ export class CodeField extends Component {
} else {
if (records[0].state === '占用') {
// console.log('此托盘已占用,请检查')
- alert('此托盘已占用,请检查')
+ alert('此托盘已占用,请检查');
} else {
// console.log('此托盘已损坏,请登记')
- alert('此托盘已损坏,请登记')
+ alert('此托盘已损坏,请登记');
}
}
-
} else {
const searchInput = this.autocompleteContainerRef.el.querySelector("input");
searchInput.value = barcode;
@@ -114,7 +113,7 @@ export class CodeField extends Component {
}
}
}
-CodeField.template = 'sf_machine_connect.CodeField'
+CodeField.template = 'sf_machine_connect.CodeField';
// Register the field in the registry
CodeField.props = standardFieldProps;
registry.category("fields").add("code", CodeField);
diff --git a/sf_machine_connect/static/src/js/barcode_form.js b/sf_machine_connect/static/src/js/barcode_form.js
index f6190918..3eefda66 100644
--- a/sf_machine_connect/static/src/js/barcode_form.js
+++ b/sf_machine_connect/static/src/js/barcode_form.js
@@ -48,4 +48,4 @@ odoo.define('my_module.barcode_handler', function (require) {
return {
BarcodeHandlerField: BarcodeHandlerField,
};
-});
\ No newline at end of file
+});
diff --git a/sf_machine_connect/static/src/js/barcode_handler_field.js b/sf_machine_connect/static/src/js/barcode_handler_field.js
index 526f28d7..133e0ffe 100644
--- a/sf_machine_connect/static/src/js/barcode_handler_field.js
+++ b/sf_machine_connect/static/src/js/barcode_handler_field.js
@@ -8,7 +8,7 @@ const { Component, xml } = owl;
export class BarcodeHandlerField extends Component {
setup() {
- this.actionService = useService("action")
+ this.actionService = useService("action");
const barcode = useService("barcode");
// this.rpc = useService("rpc");
// useBus(barcode.bus, "barcode_scanned", this.onBarcodeScanned.bind(this));
@@ -18,7 +18,7 @@ export class BarcodeHandlerField extends Component {
// const { data } = await this.env.services.rpc('/web/dataset/call_kw', params);
const response = await this.env.services.rpc('/web/dataset/call_kw', params);
// return response
- const responseObject = JSON.parse(response)
+ const responseObject = JSON.parse(response);
return responseObject;
}
@@ -58,8 +58,7 @@ export class BarcodeHandlerField extends Component {
} else {
// console.error("Barcode not found or RPC call failed.");
}
- }
-
+ };
}
BarcodeHandlerField.template = xml``;
diff --git a/sf_machine_connect/wizard/action_up.py b/sf_machine_connect/wizard/action_up.py
index ffcb88ad..e2d160cd 100644
--- a/sf_machine_connect/wizard/action_up.py
+++ b/sf_machine_connect/wizard/action_up.py
@@ -2,15 +2,11 @@
import base64
import logging
import os
-import json
-import hashlib
-import time
from datetime import datetime
-import requests
-from odoo import fields, models, api, _
-from odoo.exceptions import ValidationError
+from odoo import fields, models
+# from odoo.exceptions import ValidationError
from odoo.exceptions import UserError
-from odoo.addons.sf_machine_connect.models import py2opcua, ftp_operate
+from odoo.addons.sf_machine_connect.models import ftp_operate
_logger = logging.getLogger(__name__)
diff --git a/sf_manufacturing/static/src/js/kanban_change.js b/sf_manufacturing/static/src/js/kanban_change.js
index 7e425e3b..edef0285 100644
--- a/sf_manufacturing/static/src/js/kanban_change.js
+++ b/sf_manufacturing/static/src/js/kanban_change.js
@@ -17,16 +17,10 @@ class CustomKanbanController extends KanbanController {
this.workOrders = await this.getAllWorkOrders();
// this.workOrdersNew = this.workOrders;
// console.log('lines222222222', this.workOrders);
- //
// console.log(typeof this.workOrders);
// console.log(Array.isArray(this.workOrders));
- //
// console.log(this.workOrders.every(order =>
// typeof order === 'object' && order.id !== undefined));
-
-
-
-
// var aDiv = document.getElementsByClassName('o_kanban_record')
// for (var i = 0; i < aDiv.length; i++) {
// console.log(aDiv[i])
@@ -37,7 +31,6 @@ class CustomKanbanController extends KanbanController {
buttonClick(ev) {
const button = ev.currentTarget;
const id = button.getAttribute('data-id');
-
// console.log('true_id', id);
// const context = {production_line_show: 'shengchanxian1'}
this.env.services.rpc('/web/dataset/call_kw', {
@@ -58,8 +51,8 @@ class CustomKanbanController extends KanbanController {
// console.log('response', response);
location.reload();
window.onload = function () {
- button.classList.add('choose')
- }
+ button.classList.add('choose');
+ };
});
});
}
@@ -82,8 +75,6 @@ class CustomKanbanController extends KanbanController {
// 你可以在这里处理响应,例如将其存储在控制器的状态中
return response;
}
-
-
}
CustomKanbanController.template = "sf_manufacturing.CustomKanbanView1";
@@ -94,4 +85,4 @@ export const customKanbanView = {
};
// Register it to the views registry
-registry.category("views").add("custom_kanban1", customKanbanView);
\ No newline at end of file
+registry.category("views").add("custom_kanban1", customKanbanView);
diff --git a/sf_quality/models/custom_quality.py b/sf_quality/models/custom_quality.py
index 1887da7a..c700b88b 100644
--- a/sf_quality/models/custom_quality.py
+++ b/sf_quality/models/custom_quality.py
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
-from odoo import models, fields, api, _
+from odoo import models, fields
class SfQualityPoint(models.Model):
diff --git a/sf_warehouse/static/src/colorGuide.js b/sf_warehouse/static/src/colorGuide.js
index c6cc0f94..dd5a4b02 100644
--- a/sf_warehouse/static/src/colorGuide.js
+++ b/sf_warehouse/static/src/colorGuide.js
@@ -1,12 +1,11 @@
odoo.define('sf_warehouse.custom_kanban', function (require) {
- "use strict"
+ "use strict";
var KanbanRenderer = require('web.KanbanRenderer');
KanbanRenderer.include({
_render: function () {
var self = this;
return this._super.apply(this, arguments).then(function () {
-
var colorGuide = $(' \
\
\
@@ -16,5 +15,4 @@ odoo.define('sf_warehouse.custom_kanban', function (require) {
});
},
});
-
-});
\ No newline at end of file
+});
diff --git a/sf_warehouse/static/src/js/cust_char.js b/sf_warehouse/static/src/js/cust_char.js
index 3757bfb8..9a529d42 100644
--- a/sf_warehouse/static/src/js/cust_char.js
+++ b/sf_warehouse/static/src/js/cust_char.js
@@ -1,9 +1,7 @@
/** @odoo-module **/
-import { registry } from "@web/core/registry";
-import { CharField } from '@web/views/fields/char/char_field';
-
-
+import {registry} from "@web/core/registry";
+import {CharField} from '@web/views/fields/char/char_field';
// 继承CharField组件实现自定义组件:当光标聚焦于输入框时,选中输入框内容
class CustomChar extends CharField {
@@ -20,7 +18,7 @@ class CustomChar extends CharField {
// 当光标聚焦于输入框时,选中输入框内容
this.input.el.addEventListener('focus', function () {
this.select();
- })
+ });
}
@@ -72,13 +70,13 @@ class CustomChar extends CharField {
// }
// }
- // this.$input.on('focus', function () {
- // $(this).select();
- // });
+ // this.$input.on('focus', function () {
+ // $(this).select();
+ // });
// 当光标聚焦于输入框时,选中输入框内容
}
-registry.category("fields").add("custom_char", CustomChar);
\ No newline at end of file
+registry.category("fields").add("custom_char", CustomChar);
diff --git a/sf_warehouse/static/src/js/custom_kanban_controller.js b/sf_warehouse/static/src/js/custom_kanban_controller.js
index 7b9d01fb..62c83505 100644
--- a/sf_warehouse/static/src/js/custom_kanban_controller.js
+++ b/sf_warehouse/static/src/js/custom_kanban_controller.js
@@ -1,8 +1,8 @@
/** @odoo-module */
-import { KanbanController } from "@web/views/kanban/kanban_controller";
-import { kanbanView } from "@web/views/kanban/kanban_view";
-import { registry } from "@web/core/registry";
+import {KanbanController} from "@web/views/kanban/kanban_controller";
+import {kanbanView} from "@web/views/kanban/kanban_view";
+import {registry} from "@web/core/registry";
// the controller usually contains the Layout and the renderer.
class CustomKanbanController extends KanbanController {
@@ -18,4 +18,4 @@ export const customKanbanView = {
};
// Register it to the views registry
-registry.category("views").add("custom_kanban", customKanbanView);
\ No newline at end of file
+registry.category("views").add("custom_kanban", customKanbanView);
diff --git a/sf_warehouse/static/src/js/custom_many2one.js b/sf_warehouse/static/src/js/custom_many2one.js
index c6a86af5..592d910b 100644
--- a/sf_warehouse/static/src/js/custom_many2one.js
+++ b/sf_warehouse/static/src/js/custom_many2one.js
@@ -1,8 +1,7 @@
/** @odoo-module **/
-import { registry } from "@web/core/registry";
-import { Many2OneField } from '@web/views/fields/many2one/many2one_field';
-
+import {registry} from "@web/core/registry";
+import {Many2OneField} from '@web/views/fields/many2one/many2one_field';
// 继承FieldMany2One组件实现自定义组件:当光标聚焦于输入框时,选中输入框内容
@@ -17,12 +16,13 @@ class CustomMany2One extends Many2OneField {
// console.log('CustomMany2One.setup11111111111111');
super.setup();
}
+
onMounted() {
// console.log('CustomMany2One.onMounted1');
// 当光标聚焦于输入框时,选中输入框内容
this.input.el.addEventListener('focus', function () {
this.select();
- })
+ });
}
}
diff --git a/web_widget_model_viewer/static/src/js/3d_viewer.js b/web_widget_model_viewer/static/src/js/3d_viewer.js
index 3c66b142..15374070 100644
--- a/web_widget_model_viewer/static/src/js/3d_viewer.js
+++ b/web_widget_model_viewer/static/src/js/3d_viewer.js
@@ -26,15 +26,15 @@ export class StepViewer extends Component {
model: this.props.record.resModel,
id: JSON.stringify(this.props.record.data['id']),
field: this.props.name
- }
- url = url_props['base_url'].replace('http://', 'https://') + '/web/content/' + url_props['model'] + '/' + url_props['id'] + '/' + url_props['field'] + '?download=true'
+ };
+ url = url_props['base_url'].replace('http://', 'https://') + '/web/content/' + url_props['model'] + '/' + url_props['id'] + '/' + url_props['field'] + '?download=true';
// url = 'http://localhost:8069'+'/web/content/'+url_props['model']+'/'+url_props['id']+'/'+url_props['field']+'?download=true'
// console.log('url111111', url)
- return url
+ return url;
} else {
url = "data:model/gltf-binary;base64," + this.props.value;
// console.log('url2', url)
- return url
+ return url;
// localStorage.setItem('url',url)
// let new_url = localStorage.getItem(('url'))
// var oViewer = document.getElementsByTagName('model-viewer')[0];
From 9fef877d122559ba7e90a1fc14a662ecc130d9aa Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Mon, 27 Nov 2023 22:40:56 +0800
Subject: [PATCH 11/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AD=A6=E5=91=8A?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Many2OneRadioField/many2one_radio_field.js | 13 ++++++-------
sf_machine_connect/models/ftp_client.py | 2 +-
sf_warehouse/static/src/js/cust_char.js | 3 ---
sf_warehouse/static/src/js/custom_many2one.js | 1 -
4 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
index 2be3365c..8c2be97f 100644
--- a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
+++ b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
@@ -15,19 +15,18 @@ export class Many2OneRadioField extends RadioField {
// 放大图片逻辑
// 获取图片元素
const img = event.target;
- const close = img.nextSibling
-
+ const close = img.nextSibling;
// 实现放大图片逻辑
// 比如使用 CSS 放大
img.parentElement.classList.add('zoomed');
- close.classList.add('img_close')
+ close.classList.add('img_close');
}
onCloseClick(event) {
const close = event.target;
- const img = close.previousSibling
- img.parentElement.classList.remove('zoomed')
- close.classList.remove('img_close')
+ const img = close.previousSibling;
+ img.parentElement.classList.remove('zoomed');
+ close.classList.remove('img_close');
}
get items() {
@@ -48,7 +47,7 @@ export class Many2OneRadioField extends RadioField {
}
}
-Many2OneRadioField.template = "jikimo_frontend.Many2OneRadioField"
+Many2OneRadioField.template = "jikimo_frontend.Many2OneRadioField";
// MyCustomWidget.supportedTypes = ['many2many'];
registry.category("fields").add("many2one_radio", Many2OneRadioField);
diff --git a/sf_machine_connect/models/ftp_client.py b/sf_machine_connect/models/ftp_client.py
index 10894d3a..92ccc4d5 100644
--- a/sf_machine_connect/models/ftp_client.py
+++ b/sf_machine_connect/models/ftp_client.py
@@ -537,7 +537,7 @@ class WorkCenterBarcode(models.Model):
action1 = json.dumps(action)
return action1
else:
- return False
+ return None
def cnc_file_download(self):
"""
diff --git a/sf_warehouse/static/src/js/cust_char.js b/sf_warehouse/static/src/js/cust_char.js
index 9a529d42..d67f2d7a 100644
--- a/sf_warehouse/static/src/js/cust_char.js
+++ b/sf_warehouse/static/src/js/cust_char.js
@@ -73,10 +73,7 @@ class CustomChar extends CharField {
// this.$input.on('focus', function () {
// $(this).select();
// });
-
-
// 当光标聚焦于输入框时,选中输入框内容
-
}
registry.category("fields").add("custom_char", CustomChar);
diff --git a/sf_warehouse/static/src/js/custom_many2one.js b/sf_warehouse/static/src/js/custom_many2one.js
index 592d910b..2e0e70bf 100644
--- a/sf_warehouse/static/src/js/custom_many2one.js
+++ b/sf_warehouse/static/src/js/custom_many2one.js
@@ -24,7 +24,6 @@ class CustomMany2One extends Many2OneField {
this.select();
});
}
-
}
registry.category("fields").add("custom_many2one", CustomMany2One);
From 4d8b463cb3e41e03fcee39bdd37261938f23faed Mon Sep 17 00:00:00 2001
From: mgw <1392924357@qq.com>
Date: Tue, 28 Nov 2023 08:59:01 +0800
Subject: [PATCH 12/14] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AD=A6=E5=91=8A?=
=?UTF-8?q?=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_machine_connect/models/res_config_setting.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sf_machine_connect/models/res_config_setting.py b/sf_machine_connect/models/res_config_setting.py
index 6d9a6c84..16cc4d77 100644
--- a/sf_machine_connect/models/res_config_setting.py
+++ b/sf_machine_connect/models/res_config_setting.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import logging
-from odoo import api, fields, models, _
+from odoo import api, fields, models
_logger = logging.getLogger(__name__)
From e403f2f8e6cb983427b0ca5a97dbc0b4c2b1a896 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Tue, 28 Nov 2023 14:52:43 +0800
Subject: [PATCH 13/14] =?UTF-8?q?1=E3=80=81=E6=8C=89=E9=9D=A2=E5=90=91?=
=?UTF-8?q?=E5=AF=B9=E8=B1=A1=E7=9A=84=E6=80=9D=E6=83=B3=E4=BC=98=E5=8C=96?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7=E7=BB=84=E8=A3=85=E5=8A=9F?=
=?UTF-8?q?=E8=83=BD=E7=9A=84=E6=95=B4=E4=B8=AA=E6=B5=81=E7=A8=8B=EF=BC=9B?=
=?UTF-8?q?2=E3=80=81=E6=96=B0=E5=A2=9E=E5=88=80=E5=85=B7=E7=BB=84?=
=?UTF-8?q?=E8=A3=85=E5=AE=8C=E6=88=90=E6=97=B6=E7=9A=84=E5=88=80=E5=85=B7?=
=?UTF-8?q?=E7=89=A9=E6=96=99=E5=87=BA=E5=BA=93=E5=88=B0=E5=88=80=E5=85=B7?=
=?UTF-8?q?=E7=BB=84=E8=A3=85=E4=BD=8D=E7=BD=AE=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/wizard/wizard.py | 182 ++++++++++++++++------------
1 file changed, 107 insertions(+), 75 deletions(-)
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index e3d4cff7..649d6b86 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -341,6 +341,7 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
功能刀具组装
:return:
"""
+ # 获取组装单对象
functional_tool_assembly = self.env['sf.functional.tool.assembly'].search([
('assembly_order_code', '=', self.assembly_order_code),
('machine_tool_name_id', '=', self.machine_tool_name_id.id),
@@ -349,20 +350,28 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
])
# 对物料做必填判断
self.materials_must_be_judged()
- # # 刀具物料出库
- # if self.integral_code_id:
- # print("已运行1111")
- # self.tool_material_out_of_store(self.integral_code_id)
+ product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
# 创建组装入库单
# 创建功能刀具批次/序列号记录
- stock_lot = self.create_assemble_warehouse_receipt(functional_tool_assembly)
+ stock_lot = product_id.create_assemble_warehouse_receipt(self.id, functional_tool_assembly)
# 创建刀具组装入库单
self.create_stocking_picking(stock_lot)
- # 封装功能刀具数据
- desc_1 = self.get_desc_1(stock_lot)
+ # 刀具物料出库
+ if self.integral_code_id:
+ product_id.tool_material_stock_moves(self.integral_code_id)
+ if self.blade_code_id:
+ product_id.tool_material_stock_moves(self.blade_code_id)
+ if self.bar_code_id:
+ product_id.tool_material_stock_moves(self.bar_code_id)
+ if self.pad_code_id:
+ product_id.tool_material_stock_moves(self.pad_code_id)
+ if self.handle_code_id:
+ product_id.tool_material_stock_moves(self.handle_code_id)
+ if self.chuck_code_id:
+ product_id.tool_material_stock_moves(self.chuck_code_id)
- # 创建功能刀具列表记录
+ # ============================创建功能刀具列表、安全库存记录===============================
# 封装功能刀具数据
desc_2 = self.get_desc_2(stock_lot, functional_tool_assembly)
# 创建功能刀具列表记录
@@ -376,9 +385,11 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
'coarse_middle_thin': self.after_assembly_coarse_middle_thin,
}, record_1)
+ # =====================修改功能刀具组装单、机床换刀申请、CAM工单程序用刀计划的状态==============
+ # 封装功能刀具数据
+ desc_1 = self.get_desc_1(stock_lot)
# 修改功能刀具组装单信息
functional_tool_assembly.write(desc_1)
-
if functional_tool_assembly.sf_machine_table_tool_changing_apply_id:
# 修改机床换刀申请的状态
self.env['sf.machine.table.tool.changing.apply'].sudo().search([
@@ -422,72 +433,6 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 将刀具组装入库单的状态更改为就绪
picking_id.action_confirm()
- def create_assemble_warehouse_receipt(self, functional_tool_assembly):
- """
- 创建功能刀具批次/序列号记录
- """
- product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
-
- stock_lot = self.env['stock.lot'].create({
- 'name': self.get_stock_lot_name(),
- 'product_id': product_id.id,
- 'company_id': self.env.company.id
- })
- # 创建功能刀具该批次/序列号 库存移动和移动历史
- self.create_stock_quant(product_id, stock_lot, functional_tool_assembly)
-
- return stock_lot
-
- def create_stock_quant(self, product_id, stock_lot, functional_tool_assembly):
- """
- 创建功能刀具该批次/序列号 库存移动和移动历史
- """
- # 获取位置对象
- stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
- location_inventory_id = self.env['stock.location'].search([('name', '=', 'Production')])
-
- # 创建库存移动
- stock_move_id = self.env['stock.move'].create({
- 'name': '功能刀具组装出库',
- 'product_id': product_id.id,
- 'location_id': location_inventory_id.id,
- 'location_dest_id': stock_location_id.id,
- 'product_uom_qty': 1.00,
- 'state': 'done'
- })
-
- # 创建移动历史
- stock_move_line_id = self.env['stock.move.line'].create({
- 'product_id': product_id.id,
- 'functional_tool_name_id': functional_tool_assembly.id,
- 'lot_id': stock_lot.id,
- 'move_id': stock_move_id.id,
- 'install_tool_time': fields.Datetime.now(),
- 'qty_done': 1.0,
- 'state': 'done'
- })
- return stock_move_id, stock_move_line_id
-
- def get_stock_lot_name(self):
- """
- 生成功能刀具序列号
- """
- code = 'JKM-T-' + str(self.functional_tool_type_id.code) + '-' + str(
- self.after_assembly_functional_tool_diameter) + '-'
- new_time = fields.Date.today()
- code += str(new_time) + '-'
- stock_lot_id = self.env['stock.lot'].sudo().search(
- [('name', 'like', new_time), ('product_id.name', '=', '功能刀具')],
- limit=1,
- order="id desc"
- )
- if not stock_lot_id:
- num = "%03d" % 1
- else:
- m = int(stock_lot_id.name[-3:]) + 1
- num = "%03d" % m
- return code + str(num)
-
def get_desc_1(self, stock_lot):
return {
'barcode_id': stock_lot.id,
@@ -552,3 +497,90 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
'cut_number': self.cut_number,
'current_location_id': stock_lot.quant_ids.location_id.ids[-1],
}
+
+
+class ProductProduct(models.Model):
+ _inherit = 'product.product'
+
+ def create_assemble_warehouse_receipt(self, tool_assembly_order_id, functional_tool_assembly):
+ """
+ 创建功能刀具批次/序列号记录
+ """
+ product_id = self.env['product.product'].search([('name', '=', '功能刀具')])
+
+ stock_lot = self.env['stock.lot'].create({
+ 'name': self.get_stock_lot_name(tool_assembly_order_id),
+ 'product_id': product_id.id,
+ 'company_id': self.env.company.id
+ })
+ # 获取位置对象
+ location_inventory_id = self.env['stock.location'].search([('name', '=', 'Production')])
+ stock_location_id = self.env['stock.location'].search([('name', '=', '组装后')])
+ # 创建功能刀具该批次/序列号 库存移动和移动历史
+ stock_lot.create_stock_quant(location_inventory_id, stock_location_id, functional_tool_assembly.id)
+
+ return stock_lot
+
+ def get_stock_lot_name(self, tool_assembly_order_id):
+ """
+ 生成功能刀具序列号
+ """
+ tool_assembly_order = self.env['sf.functional.tool.assembly.order'].search(
+ [('id', '=', tool_assembly_order_id)])
+ code = 'JKM-T-' + str(tool_assembly_order.after_assembly_functional_tool_type_id.code) + '-' + str(
+ tool_assembly_order.after_assembly_functional_tool_diameter) + '-'
+ new_time = fields.Date.today()
+ code += str(new_time) + '-'
+ stock_lot_id = self.env['stock.lot'].sudo().search(
+ [('name', 'like', new_time), ('product_id.name', '=', '功能刀具')],
+ limit=1,
+ order="id desc"
+ )
+ if not stock_lot_id:
+ num = "%03d" % 1
+ else:
+ m = int(stock_lot_id.name[-3:]) + 1
+ num = "%03d" % m
+ return code + str(num)
+
+ def tool_material_stock_moves(self, tool_material):
+ """
+ 对刀具物料进行库存移动到 刀具组装位置
+ """
+ # 获取位置对象
+ location_inventory_id = tool_material.quant_ids.location_id[-1]
+ print(location_inventory_id)
+ stock_location_id = self.env['stock.location'].search([('name', '=', '刀具组装位置')])
+ # 创建功能刀具该批次/序列号 库存移动和移动历史
+ tool_material.create_stock_quant(location_inventory_id, stock_location_id, None)
+
+
+class StockLot(models.Model):
+ _inherit = 'stock.lot'
+
+ def create_stock_quant(self, location_inventory_id, stock_location_id, functional_tool_assembly_id):
+ """
+ 对功能刀具组装过程的功能刀具和刀具物料进行库存移动,以及创建移动历史
+ """
+
+ # 创建库存移动记录
+ stock_move_id = self.env['stock.move'].create({
+ 'name': '功能刀具组装',
+ 'product_id': self.product_id.id,
+ 'location_id': location_inventory_id.id,
+ 'location_dest_id': stock_location_id.id,
+ 'product_uom_qty': 1.00,
+ 'state': 'done'
+ })
+
+ # 创建移动历史记录
+ stock_move_line_id = self.env['stock.move.line'].create({
+ 'product_id': self.product_id.id,
+ 'functional_tool_name_id': functional_tool_assembly_id,
+ 'lot_id': self.id,
+ 'move_id': stock_move_id.id,
+ 'install_tool_time': fields.Datetime.now(),
+ 'qty_done': 1.0,
+ 'state': 'done'
+ })
+ return stock_move_id, stock_move_line_id
From de04d452b39de56e14812d9d532e81d609cf1407 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Tue, 28 Nov 2023 16:28:48 +0800
Subject: [PATCH 14/14] =?UTF-8?q?1=E4=BC=98=E5=8C=96=E5=8A=9F=E8=83=BD?=
=?UTF-8?q?=E5=88=80=E5=85=B7=E7=BB=84=E8=A3=85=E5=8D=95=E7=9A=84=E5=88=80?=
=?UTF-8?q?=E5=85=B7=E7=89=A9=E6=96=99=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6?=
=?UTF-8?q?=EF=BC=8C=E5=8F=96=E6=B6=88=E5=8A=9F=E8=83=BD=E5=88=80=E5=85=B7?=
=?UTF-8?q?=E5=88=97=E8=A1=A8=E7=9A=84=E8=87=AA=E5=8A=A8=E8=AE=A1=E7=AE=97?=
=?UTF-8?q?=E5=BA=93=E5=AD=98=E7=9A=84=E6=96=B9=E6=B3=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_tool_management/models/base.py | 24 ++++++++++++------------
sf_tool_management/wizard/wizard.py | 18 ++++++++++++------
2 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/sf_tool_management/models/base.py b/sf_tool_management/models/base.py
index 99a7f3d9..c14aa16f 100644
--- a/sf_tool_management/models/base.py
+++ b/sf_tool_management/models/base.py
@@ -25,7 +25,7 @@ class FunctionalCuttingToolEntity(models.Model):
tool_loading_length = fields.Float(string='装刀长(mm)', readonly=True)
functional_tool_length = fields.Float(string='伸出长(mm)', readonly=True)
effective_length = fields.Float(string='有效长(mm)', readonly=True)
- tool_room_num = fields.Integer(string='刀具房数量', readonly=True, compute='_compute_location_num')
+ tool_room_num = fields.Integer(string='刀具房数量', readonly=True)
line_edge_knife_library_num = fields.Integer(string='线边刀库数量', readonly=True)
machine_knife_library_num = fields.Integer(string='机内刀库数量', readonly=True)
max_lifetime_value = fields.Integer(string='最大寿命值(min)', readonly=True)
@@ -36,16 +36,16 @@ class FunctionalCuttingToolEntity(models.Model):
current_location_id = fields.Many2one('stock.location', string='当前位置', readonly=True)
image = fields.Binary('图片', readonly=True)
- @api.depends('current_location_id')
- def _compute_location_num(self):
- """
- 计算库存位置数量
- """
- for obj in self:
- if obj.current_location_id.name in ('组装后', '刀具房'):
- obj.tool_room_num = 1
- obj.line_edge_knife_library_num = 0
- obj.machine_knife_library_num = 0
+ # @api.depends('current_location_id')
+ # def _compute_location_num(self):
+ # """
+ # 计算库存位置数量
+ # """
+ # for obj in self:
+ # if obj.current_location_id.name in ('组装后', '刀具房'):
+ # obj.tool_room_num = 1
+ # obj.line_edge_knife_library_num = 0
+ # obj.machine_knife_library_num = 0
@api.model
def _read_group_mrs_cutting_tool_type_id(self, categories, domain, order):
@@ -491,7 +491,7 @@ class CAMWorkOrderProgramKnifePlan(models.Model):
class FunctionalToolAssembly(models.Model):
_name = 'sf.functional.tool.assembly'
- _description = '功能刀具组装单'
+ _description = '功能刀具组装'
_order = 'use_tool_time asc'
@api.depends('functional_tool_name')
diff --git a/sf_tool_management/wizard/wizard.py b/sf_tool_management/wizard/wizard.py
index 649d6b86..2c81cb31 100644
--- a/sf_tool_management/wizard/wizard.py
+++ b/sf_tool_management/wizard/wizard.py
@@ -183,7 +183,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 整体式刀具型号
integral_code_id = fields.Many2one('stock.lot', string='整体式刀具序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '整体式刀具'),
- ('quant_ids.location_id.name', 'in', ['刀具房'])])
+ ('quant_ids.location_id.name', 'in', ['刀具房']),
+ ('quant_ids.quantity', '>', 0)])
cutting_tool_integral_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='整体式刀具型号',
readonly=True)
integral_name = fields.Char('整体式刀具名称', readonly=True)
@@ -192,7 +193,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 刀片型号
blade_code_id = fields.Many2one('stock.lot', '刀片序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '刀片'),
- ('quant_ids.location_id.name', 'in', ['刀具房'])])
+ ('quant_ids.location_id.name', 'in', ['刀具房']),
+ ('quant_ids.quantity', '>', 0)])
cutting_tool_blade_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀片型号', readonly=True)
blade_name = fields.Char('刀片名称', readonly=True)
sf_tool_brand_id_2 = fields.Many2one('sf.machine.brand', '刀片品牌', readonly=True)
@@ -200,7 +202,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 刀杆型号
bar_code_id = fields.Many2one('stock.lot', '刀杆序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '刀杆'),
- ('quant_ids.location_id.name', 'in', ['刀具房'])])
+ ('quant_ids.location_id.name', 'in', ['刀具房']),
+ ('quant_ids.quantity', '>', 0)])
cutting_tool_cutterbar_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀杆型号',
readonly=True)
bar_name = fields.Char('刀杆名称', readonly=True)
@@ -209,7 +212,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 刀盘型号
pad_code_id = fields.Many2one('stock.lot', '刀盘序列号',
domain=[('product_id.cutting_tool_material_id.name', '=', '刀盘'),
- ('quant_ids.location_id.name', 'in', ['刀具房'])])
+ ('quant_ids.location_id.name', 'in', ['刀具房']),
+ ('quant_ids.quantity', '>', 0)])
cutting_tool_cutterpad_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀盘型号',
readonly=True)
pad_name = fields.Char('刀盘名称', readonly=True)
@@ -218,7 +222,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 刀柄型号
handle_code_id = fields.Many2one('stock.lot', '刀柄序列号', required=True,
domain=[('product_id.cutting_tool_material_id.name', '=', '刀柄'),
- ('quant_ids.location_id.name', 'in', ['刀具房'])])
+ ('quant_ids.location_id.name', 'in', ['刀具房']),
+ ('quant_ids.quantity', '>', 0)])
cutting_tool_cutterhandle_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='刀柄型号',
readonly=True)
handle_name = fields.Char('刀柄名称', readonly=True)
@@ -227,7 +232,8 @@ class FunctionalToolAssemblyOrder(models.TransientModel):
# 夹头型号
chuck_code_id = fields.Many2one('stock.lot', '夹头序列号', required=True,
domain=[('product_id.cutting_tool_material_id.name', '=', '夹头'),
- ('quant_ids.location_id.name', 'in', ['刀具房'])])
+ ('quant_ids.location_id.name', 'in', ['刀具房']),
+ ('quant_ids.quantity', '>', 0)])
cutting_tool_cutterhead_model_id = fields.Many2one('sf.cutting_tool.standard.library', string='夹头型号',
readonly=True)
chuck_name = fields.Char('夹头名称', readonly=True, compute='_compute_auto_fill')