[FIX] base, mail: properly annotate Partner.find_or_create

In 6e25a510b3 `find_or_create` was
modified to return a recordset rather than just an id. This made it
incompatible with the RPC protocol and it was not annotated to
downgrade the return value back to an id.

Fixes odoo/odoo#54466

closes odoo/odoo#54476

X-original-commit: a7e3894e20207b714cebefa908be090967866791
Signed-off-by: Xavier Morel (xmo) <xmo@odoo.com>
This commit is contained in:
Xavier Morel
2020-07-15 07:36:23 +00:00
parent 5a9cf0f357
commit 470fb905a9
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -39,6 +39,7 @@ class Partner(models.Model):
for r in self}
@api.model
@api.returns('self', lambda value: value.id)
def find_or_create(self, email, assert_valid_email=False):
""" Override to use the email_normalized field. """
if not email:
+1
View File
@@ -806,6 +806,7 @@ class Partner(models.Model):
return super(Partner, self)._name_search(name, args, operator=operator, limit=limit, name_get_uid=name_get_uid)
@api.model
@api.returns('self', lambda value: value.id)
def find_or_create(self, email, assert_valid_email=False):
""" Find a partner with the given ``email`` or use :py:method:`~.name_create`
to create a new one.