Arnaud Joset cbff2f508f [FIX] google_calendar: avoid cachemiss error when record has been deleted between write and patch
In some cases, the module can patch an event but if it is deleted, some write will fails.

This fix prevent the following traceback:

```py
Traceback (most recent call last):
  File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1057, in __get__
    value = env.cache.get(record, self)
  File "/home/odoo/src/odoo/15.0/odoo/api.py", line 889, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'calendar.event(30350266,).attendee_ids'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/15.0/odoo/api.py", line 886, in get
    return field_cache[record._ids[0]]
KeyError: 30350266

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1057, in __get__
    value = env.cache.get(record, self)
  File "/home/odoo/src/odoo/15.0/odoo/api.py", line 889, in get
    raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: 'calendar.event(30350266,).show_as'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/google_sync.py", line 43, in called_after
    func(self.with_env(env), *args, **kwargs)
  File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/google_sync.py", line 234, in _google_patch
    self.need_sync = False
  File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1217, in __set__
    records.write({self.name: write_value})
  File "/home/odoo/src/odoo/15.0/addons/google_calendar/models/calendar.py", line 55, in write
    res = super(Meeting, self.with_context(dont_notify=notify_context)).write(values)
  File "/home/odoo/src/odoo/15.0/addons/calendar/models/calendar_event.py", line 491, in write
    previous_attendees = self.attendee_ids
  File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 3389, in __get__
    return super().__get__(records, owner)
  File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 2603, in __get__
    return super().__get__(records, owner)
  File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1083, in __get__
    recs._fetch_field(self)
  File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3276, in _fetch_field
    self._read(fnames)
  File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3346, in _read
    self.check_access_rule('read')
  File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3553, in check_access_rule
    invalid = self - self._filter_access_rules_python(operation)
  File "/home/odoo/src/odoo/15.0/odoo/models.py", line 3608, in _filter_access_rules_python
    return self.sudo().filtered_domain(dom or [])
  File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5511, in filtered_domain
    data = rec.mapped(key)
  File "/home/odoo/src/odoo/15.0/odoo/models.py", line 5436, in mapped
    recs = recs._fields[name].mapped(recs)
  File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1176, in mapped
    self.__get__(first(remaining), type(remaining))
  File "/home/odoo/src/odoo/15.0/odoo/fields.py", line 1087, in __get__
    raise MissingError("\n".join([
odoo.exceptions.MissingError: Record does not exist or has been deleted.
(Record: calendar.event(30350266,), User: XXX)
```

X-original-commit: 2f0c9ca75de616da61e327259d03a8831b8e159b
Part-of: odoo/odoo#83040
2022-01-20 08:21:58 +00:00
…
…
…
2021-11-04 10:21:58 +00:00
2021-10-07 17:59:53 +00:00
2022-01-14 15:44:52 +00:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%