1、采购入库,选取目标货位去重校验优化;2、添加功能刀具自动计算当前目标货位的值;
This commit is contained in:
@@ -45,7 +45,8 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
string='状态', store=True, default='正常')
|
string='状态', store=True, default='正常')
|
||||||
current_location_id = fields.Many2one('stock.location', string='当前位置', compute='_compute_current_location_id',
|
current_location_id = fields.Many2one('stock.location', string='当前位置', compute='_compute_current_location_id',
|
||||||
store=True)
|
store=True)
|
||||||
current_shelf_location_id = fields.Many2one('sf.shelf.location', string='当前货位', readonly=True)
|
current_shelf_location_id = fields.Many2one('sf.shelf.location', string='当前货位',
|
||||||
|
compute='_compute_current_location_id', store=True)
|
||||||
current_location = fields.Selection(
|
current_location = fields.Selection(
|
||||||
[('组装后', '组装后'), ('刀具房', '刀具房'), ('线边刀库', '线边刀库'), ('机内刀库', '机内刀库')],
|
[('组装后', '组装后'), ('刀具房', '刀具房'), ('线边刀库', '线边刀库'), ('机内刀库', '机内刀库')],
|
||||||
string='位置', compute='_compute_current_location_id', store=True)
|
string='位置', compute='_compute_current_location_id', store=True)
|
||||||
@@ -85,6 +86,10 @@ class FunctionalCuttingToolEntity(models.Model):
|
|||||||
if quant_id.inventory_quantity_auto_apply > 0:
|
if quant_id.inventory_quantity_auto_apply > 0:
|
||||||
record.current_location_id = quant_id.location_id
|
record.current_location_id = quant_id.location_id
|
||||||
if quant_id.location_id.name == '制造前':
|
if quant_id.location_id.name == '制造前':
|
||||||
|
shelf_location_id = self.env['sf.shelf.location'].sudo().search([
|
||||||
|
('product_sn_id', '=', record.barcode_id.id)])
|
||||||
|
if shelf_location_id:
|
||||||
|
record.current_shelf_location_id = shelf_location_id.id
|
||||||
if not record.current_shelf_location_id:
|
if not record.current_shelf_location_id:
|
||||||
record.current_location = '机内刀库'
|
record.current_location = '机内刀库'
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -888,12 +888,11 @@ class SfStockMoveLine(models.Model):
|
|||||||
def _check_destination_location_id(self):
|
def _check_destination_location_id(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
if item:
|
if item:
|
||||||
i = 0
|
|
||||||
barcode = item.destination_location_id.barcode
|
barcode = item.destination_location_id.barcode
|
||||||
for line in item.picking_id.move_line_ids_without_package:
|
for line in item.picking_id.move_line_ids_without_package:
|
||||||
if barcode and barcode == line.destination_location_id.barcode:
|
if line.destination_location_id:
|
||||||
i += 1
|
if (barcode and barcode == line.destination_location_id.barcode
|
||||||
if i > 1:
|
and item.product_id != line.product_id):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
'【%s】货位已经被占用,请重新选择!!!' % item.destination_location_id.barcode)
|
'【%s】货位已经被占用,请重新选择!!!' % item.destination_location_id.barcode)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user