空料架名称去重校验

This commit is contained in:
jinling.yang
2024-05-29 17:56:22 +08:00
parent a1bea537bb
commit c437c185a4
3 changed files with 11 additions and 4 deletions

View File

@@ -1335,6 +1335,13 @@ class WorkPieceDelivery(models.Model):
obj = super(WorkPieceDelivery, self).create(vals)
return obj
@api.constrains('name')
def _check_name(self):
if self.type == '运送空料架':
wd = self.sudo().search([('name', '=', self.name), ('id', '!=', self.id)])
if wd:
raise ValidationError("该名称已存在")
def action_delivery_history(self):
return {
'name': _('配送历史'),