1、序列号模型添加Rfid字段的重复校验;功能刀具模型优化搜索视图的字段;优功能刀具组装流程的值

This commit is contained in:
yuxianghui
2024-05-16 09:41:57 +08:00
parent 002c5c06b4
commit 1c441d388f
4 changed files with 25 additions and 30 deletions

View File

@@ -425,6 +425,18 @@ class ProductionLot(models.Model):
# 'target': 'self',
# }
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get('rfid'):
lots = self.env['stock.lot'].search([('rfid', '=', vals['rfid'])])
if lots:
for lot in lots:
raise ValidationError('Rfid【%s】已被序列号为【%s】的【%s】产品占用!' % (
lot.rfid, lot.name, lot.product_id.name))
records = super(ProductionLot, self).create(vals_list)
return records
class StockPicking(models.Model):
_inherit = 'stock.picking'