[FIX] base: same vat with empty string vat

If partner.vat is an empty string, python evaluates it as falsy and doesn't check the remaining of the line. This makes the framework to send ["", ""] as values for the many2one to the browser instead of false.
By forcing to have True or False, this is not a problem anymore as bool() will be False, and False will result in the correct value in the read.

closes odoo/odoo#35807

Signed-off-by: Quentin De Paoli (qdp) <qdp@openerp.com>
This commit is contained in:
wan
2019-08-19 11:35:40 +00:00
parent 6f55fd65da
commit 9f22d7a445
+1 -1
View File
@@ -273,7 +273,7 @@ class Partner(models.Model):
domain = [('vat', '=', partner.vat)]
if partner_id:
domain += [('id', '!=', partner_id), '!', ('id', 'child_of', partner_id)]
partner.same_vat_partner_id = partner.vat and not partner.parent_id and self.env['res.partner'].search(domain, limit=1)
partner.same_vat_partner_id = bool(partner.vat) and not partner.parent_id and self.env['res.partner'].search(domain, limit=1)
@api.depends(lambda self: self._display_address_depends())
def _compute_contact_address(self):