Skip to content
Snippets Groups Projects
Commit feb07b02 authored by Nasreddin (bon)'s avatar Nasreddin (bon)
Browse files

[FIX] base: Fix condition on selection field always evaluating to True


Part/Fix of commit #e5796429

Issue

	The condition `default_type not in self._fields['type'].selection`
	always evaluate to True as the selection is list of (key, value)
	tuples.

Solution

	Replace the tuples by a list of possible values.

opw-2256905

closes odoo/odoo#52501

X-original-commit: 1b21c674
Signed-off-by: default avatarNicolas Martinelli (nim) <nim@odoo.com>
Signed-off-by: default avatarbon-odoo <nboulif@users.noreply.github.com>
parent 95b74f40
No related branches found
No related tags found
No related merge requests found
......@@ -715,7 +715,7 @@ class Partner(models.Model):
a name, the name will have the email value.
If 'force_email' key in context: must find the email address. """
default_type = self._context.get('default_type')
if default_type and default_type not in self._fields['type'].selection:
if default_type and default_type not in self._fields['type'].get_values(self.env):
context = dict(self._context)
context.pop('default_type')
self = self.with_context(context)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment