Skip to content
Snippets Groups Projects
Commit 32754ebc authored by Touati Djamel (otd)'s avatar Touati Djamel (otd)
Browse files

[FIX] base: allow removing the contact barcode


Steps to reproduce the bug:
- Go to any Contact > Sales and Purchase tab
- Edit > Change the barcode, and click Save
- Then click Edit, and try to erase (empty) the barcode > save

Problem:
A validation error is triggered, the constraint will check if other partners do not have the same barcode
but as it is empty there will be several other partners

Solution:
When the barcode is empty, no need to check if other partners have the same

opw-2753291

closes odoo/odoo#84411

Signed-off-by: default avatarWilliam Henrotin (whe) <whe@odoo.com>
parent 6013ba1e
Branches
Tags
No related merge requests found
......@@ -398,7 +398,7 @@ class Partner(models.Model):
@api.constrains('barcode')
def _check_barcode_unicity(self):
if self.env['res.partner'].search_count([('barcode', '=', self.barcode)]) > 1:
if self.barcode and self.env['res.partner'].search_count([('barcode', '=', self.barcode)]) > 1:
raise ValidationError('An other user already has this barcode')
def _update_fields_values(self, fields):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment