1、序列号模型对象添加rfid字段且rfid仅在产品为刀柄时展示,序列号模型添加规格字段,且添加自动根据对应产品类型不同计算出其值,产品为夹具时看板展示其规格的值;2、在采购入库流程,录入序列号的过程界面添加录入rfid字段,当产品是刀柄时需录入刀柄的rfid,并在验证通过后刀柄的序列号中带有rfid码;
This commit is contained in:
@@ -424,6 +424,8 @@ class Sf_stock_move_line(models.Model):
|
||||
# lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
|
||||
lot_qr_code = fields.Binary(string='二维码', compute='_compute_lot_qr_code', store=True)
|
||||
|
||||
rfid = fields.Char('Rfid')
|
||||
|
||||
def action_revert_inventory(self):
|
||||
# 检查用户是否有执行操作的权限
|
||||
if not self.env.user.has_group('sf_warehouse.group_sf_stock_user'):
|
||||
@@ -742,6 +744,12 @@ class SfStockPicking(models.Model):
|
||||
if line.current_location_id:
|
||||
line.current_location_id.product_sn_id = False
|
||||
line.current_location_id.location_status = '空闲'
|
||||
|
||||
for move in self.move_ids:
|
||||
if move and move.product_id.cutting_tool_material_id.name in '刀柄':
|
||||
for item in move.move_line_nosuggest_ids:
|
||||
if item:
|
||||
self.env['stock.lot'].search([('name', '=', item.lot_name)]).write({'rfid': item.rfid})
|
||||
return res
|
||||
|
||||
# def print_all_barcode(self):
|
||||
@@ -932,7 +940,24 @@ class SfStockScrap(models.Model):
|
||||
|
||||
class CustomStockMove(models.Model):
|
||||
_name = 'stock.move'
|
||||
_inherit = ['stock.move', 'printing.utils']
|
||||
_inherit = ['stock.move', 'printing.utils', 'barcodes.barcode_events_mixin']
|
||||
|
||||
def on_barcode_scanned(self, barcode):
|
||||
"""
|
||||
采购入库扫码绑定Rfid码
|
||||
"""
|
||||
for record in self:
|
||||
if record:
|
||||
if '刀柄' in record.product_id.cutting_tool_material_id.name:
|
||||
for move_line_nosuggest_id in record.move_line_nosuggest_ids:
|
||||
if move_line_nosuggest_id.rfid:
|
||||
if move_line_nosuggest_id.rfid == barcode:
|
||||
raise ValidationError('该刀柄的rfid已经录入,请勿重复录入!!!')
|
||||
else:
|
||||
move_line_nosuggest_id.sudo().rfid = barcode
|
||||
break
|
||||
else:
|
||||
raise ValidationError('该产品不是刀柄!!!')
|
||||
|
||||
def action_assign_serial_show_details(self):
|
||||
# 首先执行原有逻辑
|
||||
|
||||
Reference in New Issue
Block a user