Merge pull request #3144 from expsa/Esraa-ensan-sale_tasks

stop mobile constrain
This commit is contained in:
Esraa-Exp 2025-05-11 20:35:23 +02:00 committed by GitHub
commit 1e755821d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 7 deletions

View File

@ -199,13 +199,13 @@ class Partner(models.Model):
if existing_id: if existing_id:
raise ValidationError(_("ID number must be unique.")) raise ValidationError(_("ID number must be unique."))
@api.constrains('mobile') # @api.constrains('mobile')
def _check_mobile_format(self): # def _check_mobile_format(self):
print("Test constraint running!") # print("Test constraint running!")
for record in self: # for record in self:
print("Checking mobile format: %s", record.mobile) # print("Checking mobile format: %s", record.mobile)
if record.mobile and (len(record.mobile) != 10 or not record.mobile.isdigit()): # if record.mobile and (len(record.mobile) != 10 or not record.mobile.isdigit()):
raise ValidationError(_("Mobile number must be exactly 10 digits.")) # raise ValidationError(_("Mobile number must be exactly 10 digits."))
# Optional: Add SQL constraints for uniqueness # Optional: Add SQL constraints for uniqueness