1、优化货位

This commit is contained in:
yuxianghui
2024-05-30 17:26:28 +08:00
parent 1d4aaa40cd
commit 7d6fb4f0e3
2 changed files with 18 additions and 11 deletions

View File

@@ -826,15 +826,20 @@ class Sf_stock_move_line(models.Model):
obj = self.env['sf.shelf.location'].search([('name', '=', obj = self.env['sf.shelf.location'].search([('name', '=',
self.destination_location_id.name)]) self.destination_location_id.name)])
if record.lot_id: if record.lot_id:
shelf_location_obj = self.env['sf.shelf.location'].search( if record.product_id.tracking == 'serial':
[('product_sn_id', '=', record.lot_id.id)]) shelf_location_obj = self.env['sf.shelf.location'].search(
if shelf_location_obj: [('product_sn_id', '=', record.lot_id.id)])
shelf_location_obj.product_sn_id = False if shelf_location_obj:
if obj: shelf_location_obj.product_sn_id = False
obj.product_sn_id = record.lot_id.id if obj:
else: obj.product_sn_id = record.lot_id.id
if obj: else:
obj.product_sn_id = record.lot_id.id if obj:
obj.product_sn_id = record.lot_id.id
elif record.product_id.tracking == 'lot':
obj.product_sn_ids |= record.lot_id
if not obj.product_id:
obj.product_id = record.product_id.id
else: else:
if obj: if obj:
obj.product_id = record.product_id.id obj.product_id = record.product_id.id

View File

@@ -170,8 +170,10 @@
<field name="shelf_id" readonly="1"/> <field name="shelf_id" readonly="1"/>
<field name="location_id" readonly="1"/> <field name="location_id" readonly="1"/>
<field name="product_id"/> <field name="product_id"/>
<field name="product_sn_id" options="{'no_create': True}"/> <field name="product_sn_id" options="{'no_create': True}"
<field name="product_sn_ids" readonly="1"> attrs="{'invisible': [('product_sn_ids', '!=', [])]}"/>
<field name="product_sn_ids" readonly="1"
attrs="{'invisible': [('product_sn_ids', '=', [])]}">
<tree> <tree>
<field name="name"/> <field name="name"/>
<field name="product_qty"/> <field name="product_qty"/>