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('请选择目标货位编码!')