Date: Fri, 19 Apr 2024 08:33:04 +0800
Subject: [PATCH 18/20] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=A7=E5=93=81?=
=?UTF-8?q?=E6=9D=A1=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_manufacturing/models/mrp_production.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index e45a2960..d9839ae4 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -156,7 +156,7 @@ class MrpProduction(models.Model):
'embryo_height': cnc.product_id.bom_ids.bom_line_ids.product_id.height,
'embryo_width': cnc.product_id.bom_ids.bom_line_ids.product_id.width,
'order_no': cnc.origin,
- 'model_order_no': cnc.product_id.default_code.rsplit(' -', 1)[0],
+ 'model_order_no': cnc.product_id.default_code,
'user': cnc.env.user.name,
'programme_way': programme_way,
'model_file': '' if not cnc.product_id.model_file else base64.b64encode(
From 5f2600c96f4f074864acbbb310fbdda2865fb837 Mon Sep 17 00:00:00 2001
From: "jinling.yang"
Date: Fri, 19 Apr 2024 08:34:41 +0800
Subject: [PATCH 19/20] =?UTF-8?q?=E9=87=8A=E6=94=BE=E6=B3=A8=E9=87=8A?=
=?UTF-8?q?=E4=BB=A3=E7=A0=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_sale/models/quick_easy_order.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sf_sale/models/quick_easy_order.py b/sf_sale/models/quick_easy_order.py
index ed52d9de..1ece6b86 100644
--- a/sf_sale/models/quick_easy_order.py
+++ b/sf_sale/models/quick_easy_order.py
@@ -8,8 +8,8 @@ from datetime import datetime
import requests
from odoo import http
from odoo.http import request
-# from OCC.Extend.DataExchange import read_step_file
-# from OCC.Extend.DataExchange import write_stl_file
+from OCC.Extend.DataExchange import read_step_file
+from OCC.Extend.DataExchange import write_stl_file
from odoo import models, fields, api
from odoo.modules import get_resource_path
from odoo.exceptions import ValidationError, UserError
From b43c3496a1d70e2b19e0f8258871c6facd6d295f Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Fri, 19 Apr 2024 10:49:48 +0800
Subject: [PATCH 20/20] =?UTF-8?q?1=E3=80=81=E8=B4=A7=E4=BD=8D=E7=9C=8B?=
=?UTF-8?q?=E6=9D=BF=E6=A8=A1=E5=9E=8B=E6=B7=BB=E5=8A=A0=E8=B4=A7=E4=BD=8D?=
=?UTF-8?q?=E5=8F=98=E6=9B=B4=E5=BC=B9=E7=AA=97=E6=A8=A1=E5=9D=97=E5=8F=8A?=
=?UTF-8?q?=E5=85=B6=E5=8A=9F=E8=83=BD=E6=8C=89=E9=92=AE=EF=BC=8C=E5=AE=9E?=
=?UTF-8?q?=E7=8E=B0=E4=BA=A7=E5=93=81=E5=9C=A8=E5=90=8C=E5=BA=93=E5=8C=BA?=
=?UTF-8?q?=E7=9A=84=E5=86=85=E9=83=A8=E8=B4=A7=E4=BD=8D=E7=A7=BB=E5=8A=A8?=
=?UTF-8?q?=EF=BC=9B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_warehouse/__init__.py | 1 +
sf_warehouse/__manifest__.py | 1 +
sf_warehouse/models/model.py | 5 --
sf_warehouse/security/ir.model.access.csv | 3 ++
sf_warehouse/views/shelf_location.xml | 22 +++++---
sf_warehouse/wizard/__init__.py | 1 +
sf_warehouse/wizard/wizard.py | 64 +++++++++++++++++++++++
sf_warehouse/wizard/wizard_view.xml | 49 +++++++++++++++++
8 files changed, 135 insertions(+), 11 deletions(-)
create mode 100644 sf_warehouse/wizard/__init__.py
create mode 100644 sf_warehouse/wizard/wizard.py
create mode 100644 sf_warehouse/wizard/wizard_view.xml
diff --git a/sf_warehouse/__init__.py b/sf_warehouse/__init__.py
index c081ee06..c9ba0265 100644
--- a/sf_warehouse/__init__.py
+++ b/sf_warehouse/__init__.py
@@ -1,2 +1,3 @@
# -*-coding:utf-8-*-
from . import models
+from . import wizard
diff --git a/sf_warehouse/__manifest__.py b/sf_warehouse/__manifest__.py
index 04051b06..b409c7ce 100644
--- a/sf_warehouse/__manifest__.py
+++ b/sf_warehouse/__manifest__.py
@@ -15,6 +15,7 @@
'data/ir_cron_data.xml',
'security/sf_stock_security.xml',
'security/ir.model.access.csv',
+ 'wizard/wizard_view.xml',
'views/view.xml',
'views/shelf_location.xml',
'views/change_stock_move_views.xml',
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index 98a4b513..50469284 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -829,11 +829,6 @@ class Sf_stock_move_line(models.Model):
for record in self:
obj = self.env['sf.shelf.location'].search([('name', '=',
self.destination_location_id.name)])
- # if obj.product_id and obj.product_id != record.product_id:
- # # 判断货位产品和将入到该货位的产品是否是同一种
- # raise ValidationError(
- # '【%s】产品和【%s】货位的【%s】产品不同,请重新选择【%s】产品的货位!!!' %
- # (record.product_id, obj.name, obj.product_id, record.product_id))
if record.lot_id:
shelf_location_obj = self.env['sf.shelf.location'].search(
[('product_sn_id', '=', record.lot_id.id)])
diff --git a/sf_warehouse/security/ir.model.access.csv b/sf_warehouse/security/ir.model.access.csv
index db246adc..a5b3b2fa 100644
--- a/sf_warehouse/security/ir.model.access.csv
+++ b/sf_warehouse/security/ir.model.access.csv
@@ -132,6 +132,9 @@ access_sf_cutting_tool_material_group_sf_stock_manager,sf_cutting_tool_material_
access_sf_cutting_tool_standard_library_group_sf_stock_manager,sf_cutting_tool_standard_library_group_sf_stock_manager,sf_base.model_sf_cutting_tool_standard_library,sf_warehouse.group_sf_stock_manager,1,0,1,0
access_sf_tool_materials_basic_parameters_group_sf_stock_manager,sf_tool_materials_basic_parameters_group_sf_stock_manager,sf_base.model_sf_tool_materials_basic_parameters,sf_warehouse.group_sf_stock_manager,1,0,1,0
+access_sf_shelf_location_wizard_group_plan_dispatch,sf_shelf_location_wizard_group_plan_dispatch,model_sf_shelf_location_wizard,sf_base.group_plan_dispatch,1,0,0,0
+access_sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,sf_shelf_location_wizard_group_sf_stock_user_group_sf_stock_user,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_user,1,0,0,0
+access_sf_shelf_location_wizard_group_sf_stock_manager,sf_shelf_location_wizard_group_sf_stock_manager,model_sf_shelf_location_wizard,sf_warehouse.group_sf_stock_manager,1,1,1,0
diff --git a/sf_warehouse/views/shelf_location.xml b/sf_warehouse/views/shelf_location.xml
index ff8f54b2..a0e1a5c1 100644
--- a/sf_warehouse/views/shelf_location.xml
+++ b/sf_warehouse/views/shelf_location.xml
@@ -128,7 +128,17 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/sf_warehouse/wizard/__init__.py b/sf_warehouse/wizard/__init__.py
new file mode 100644
index 00000000..20a7f5c4
--- /dev/null
+++ b/sf_warehouse/wizard/__init__.py
@@ -0,0 +1 @@
+from . import wizard
\ No newline at end of file
diff --git a/sf_warehouse/wizard/wizard.py b/sf_warehouse/wizard/wizard.py
new file mode 100644
index 00000000..7961819b
--- /dev/null
+++ b/sf_warehouse/wizard/wizard.py
@@ -0,0 +1,64 @@
+from odoo import fields, models, api
+from odoo.exceptions import UserError, ValidationError
+
+
+class ShelfLocationWizard(models.TransientModel):
+ _name = 'sf.shelf.location.wizard'
+ _description = '货位变更'
+
+ name = fields.Char('')
+
+ current_location_id = fields.Many2one('stock.location', string='所属库区', readonly=True)
+
+ current_shelf_id = fields.Many2one('sf.shelf', string='当前货架', readonly=True)
+ current_barcode = fields.Char('当前货位编码', readonly=True)
+ current_name = fields.Char('当前货位名称', readonly=True)
+ current_product_id = fields.Many2one('product.product', string='产品', readonly=True)
+
+ destination_shelf_id = fields.Many2one('sf.shelf', string='目标货架', compute='_compute_destination_name')
+ destination_barcode_id = fields.Many2one('sf.shelf.location', string='目标货位编码', required=True,
+ domain="")
+ destination_name = fields.Char('目标货位名称', compute='_compute_destination_name')
+
+ def return_domain(self):
+ val = [('location_status', '=', '空闲')]
+ if self.current_product_id:
+ val = ['|', ('location_status', '=', '空闲'), ('product_id', '=', self.current_product_id)]
+ if self.destination_shelf_id:
+ val.append(('shelf_id', '=', self.destination_shelf_id))
+ return "%s" % val
+
+ @api.depends('destination_barcode_id')
+ def _compute_destination_name(self):
+ if self.destination_barcode_id:
+ self.destination_name = self.destination_barcode_id.name
+ self.destination_shelf_id = self.destination_barcode_id.shelf_id.id
+ else:
+ self.destination_name = ''
+ self.destination_shelf_id = False
+
+ #
+ # @api.onchange('destination_barcode_id')
+ # def _onchange_destination_shelf_id(self):
+ # if self.destination_barcode_id:
+ # self.destination_shelf_id = self.destination_barcode_id.shelf_id.id
+
+ def confirm_the_change(self):
+ shelf_location = self.env['sf.shelf.location'].sudo().search([('barcode', '=', self.current_barcode)])
+ # 变更货位
+ if self.destination_barcode_id and shelf_location:
+ if self.destination_barcode_id.product_id and self.destination_barcode_id.product_id == shelf_location.current_product_id and not self.destination_barcode_id.product_sn_id:
+ self.destination_barcode_id.product_num += shelf_location.product_num
+ else:
+ self.destination_barcode_id.product_sn_id = shelf_location.product_sn_id.id
+ self.destination_barcode_id.product_id = shelf_location.product_id.id
+ self.destination_barcode_id.product_num = shelf_location.product_num
+
+ shelf_location.product_sn_id = False
+ shelf_location.product_id = False
+ shelf_location.product_num = 0
+ else:
+ raise ValidationError('目标货位出错,请联系管理员!')
+
+ # 关闭弹出窗口
+ return {'type': 'ir.actions.act_window_close'}
diff --git a/sf_warehouse/wizard/wizard_view.xml b/sf_warehouse/wizard/wizard_view.xml
new file mode 100644
index 00000000..1bb95e15
--- /dev/null
+++ b/sf_warehouse/wizard/wizard_view.xml
@@ -0,0 +1,49 @@
+
+
+
+ 货位变更
+ sf.shelf.location.wizard
+
+
+
+
+
+
+ 货位变更
+ ir.actions.act_window
+ sf.shelf.location.wizard
+ form
+
+ new
+
+
\ No newline at end of file