Skip to content
Snippets Groups Projects
Commit 55d7b9d3 authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[FIX] phone_validation: assign mobile_blacklisted and phone_blacklisted


Make sure to assign a value to the computed fields
`mobile_blacklisted` and `phone_blacklisted`
in their compute method for all record included in `self`

Otherwise, not assigning a value for one record included
in `self` can result in a cache missing error.

```
Traceback (most recent call last):
  File "/tmp/tmp3l14ain7/migrations/base/tests/test_mock_crawl.py", line 143, in crawl_menu
    self.mock_action(action_vals)
  File "/tmp/tmp3l14ain7/migrations/base/tests/test_mock_crawl.py", line 212, in mock_action
    mock_method(model, view, fields_list, domain, group_by)
  File "/tmp/tmp3l14ain7/migrations/base/tests/test_mock_crawl.py", line 238, in mock_view_form
    [data] = record.read(fields_list)
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 3001, in read
    return self._read_format(fnames=fields, load=load)
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 3021, in _read_format
    vals[name] = convert(record[name], record, use_name_get)
  File "/home/odoo/src/odoo/14.0/odoo/models.py", line 5620, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/home/odoo/src/odoo/14.0/odoo/fields.py", line 980, in __get__
    raise ValueError("Compute method failed to assign %s.%s" % (record, self.name))
ValueError: Compute method failed to assign crm.lead(974,).phone_blacklisted
```

closes odoo/odoo#59827

Signed-off-by: default avatarDenis Ledoux (dle) <dle@odoo.com>
parent 36bb56a5
Branches
Tags
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment