[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:
@@ -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:
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user