From 51628c081a14f132480f58ae5f656ceb1486bff4 Mon Sep 17 00:00:00 2001
From: yuxianghui <3437689193@qq.com>
Date: Thu, 19 Sep 2024 17:27:02 +0800
Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E7=A6=81=E7=94=A8=E8=B6=85=E7=BA=A7?=
=?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E4=B9=8B=E5=A4=96=E7=9A=84=E8=A7=92?=
=?UTF-8?q?=E8=89=B2=E9=80=9A=E8=BF=87=E5=BA=93=E5=AD=98=E6=A6=82=E8=A7=88?=
=?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=88=B0=E8=B0=83=E6=8B=A8=E5=8D=95=E7=95=8C?=
=?UTF-8?q?=E9=9D=A2=E7=9A=84=E8=B0=83=E6=8B=A8=E5=8D=95=E5=88=9B=E5=BB=BA?=
=?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=8C=E9=9A=90=E8=97=8F=E5=88=B6=E9=80=A0?=
=?UTF-8?q?=E4=BD=9C=E4=B8=9A=E7=B1=BB=E5=9E=8B=E7=9A=84=E5=8D=95=E6=8D=AE?=
=?UTF-8?q?=EF=BC=9B2=E3=80=81=E4=BC=98=E5=8C=96=E7=A7=BB=E5=8A=A8?=
=?UTF-8?q?=E5=8E=86=E5=8F=B2=E8=AE=B0=E5=BD=95=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sf_warehouse/models/model.py | 13 ++++++-------
sf_warehouse/views/view.xml | 1 +
sf_warehouse/wizard/wizard.py | 6 ++++--
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py
index d3f9c585..97ef47e5 100644
--- a/sf_warehouse/models/model.py
+++ b/sf_warehouse/models/model.py
@@ -931,13 +931,6 @@ class SfStockMoveLine(models.Model):
if not record.destination_location_id.product_id:
record.destination_location_id.product_id = record.product_id.id
- @api.model_create_multi
- def create(self, vals_list):
-
- records = super(SfStockMoveLine, self).create(vals_list)
- self.put_shelf_location(records)
- return records
-
class SfStockPicking(models.Model):
_inherit = 'stock.picking'
@@ -1122,6 +1115,12 @@ class SfPickingType(models.Model):
'sf_warehouse.group_sf_stock_manager'
)
+ def _get_action(self, action_xmlid):
+ action = super(SfPickingType, self)._get_action(action_xmlid)
+ if not self.env.user.has_group('base.group_system'):
+ action['context']['create'] = False
+ return action
+
class CustomStockMove(models.Model):
_name = 'stock.move'
diff --git a/sf_warehouse/views/view.xml b/sf_warehouse/views/view.xml
index fadaa58f..10be546c 100644
--- a/sf_warehouse/views/view.xml
+++ b/sf_warehouse/views/view.xml
@@ -4,6 +4,7 @@
{'search_default_groupby_code':1}
+ [('name', '!=', '制造')]
diff --git a/sf_warehouse/wizard/wizard.py b/sf_warehouse/wizard/wizard.py
index 62ed5771..a6fd68d4 100644
--- a/sf_warehouse/wizard/wizard.py
+++ b/sf_warehouse/wizard/wizard.py
@@ -77,18 +77,20 @@ class ShelfLocationWizard(models.TransientModel):
def confirm_the_change(self):
if self.destination_barcode_id:
+ stocks = []
if self.lot_id:
self.current_barcode_id.product_sn_id = False
self.destination_barcode_id.product_sn_id = self.lot_id.id
- self.create_stock_moves(self.lot_id, 1)
+ stocks = self.create_stock_moves(self.lot_id, 1)
elif self.current_product_sn_ids:
for current_product_sn_id in self.current_product_sn_ids:
- self.create_stock_moves(current_product_sn_id.lot_id, current_product_sn_id.qty_num)
+ stocks = self.create_stock_moves(current_product_sn_id.lot_id, current_product_sn_id.qty_num)
current_product_sn_id.write({
'qty_num': 0
})
else:
raise ValidationError('没有需要变更的批次/序列号!')
+ self.env['stock.move.line'].sudo().put_shelf_location(stocks[-1])
else:
raise ValidationError('请选择目标货位编码!')