OCA / calendar

GNU Affero General Public License v3.0
24 stars 94 forks source link

[16.0][FIX] resource_booking: Avoid the error if a message is written from portal. #126

Closed victoralmau closed 6 months ago

victoralmau commented 6 months ago

Avoid the error if a message is written from portal.

Related to https://github.com/OCA/calendar/commit/8528dc74e3fa23ee2b82806f28745ceaee2dba18

Example use case:

An error is displayed

File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 2093, in message_post
    self._notify_thread(new_message, msg_values, **notif_kwargs)
  File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 2471, in _notify_thread
    self._notify_thread_by_email(message, recipients_data, msg_vals=msg_vals, **kwargs)
  File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 2557, in _notify_thread_by_email
    recipients_groups_data = self._notify_get_recipients_classify(partners_data, model_name, msg_vals=msg_vals)
  File "/opt/odoo/auto/addons/mail/models/mail_thread.py", line 2957, in _notify_get_recipients_classify
    groups = self._notify_get_recipients_groups(msg_vals=local_msg_vals)
  File "/opt/odoo/auto/addons/portal/models/mail_thread.py", line 33, in _notify_get_recipients_groups
    local_msg_vals['pid'] = customer.id
  File "/opt/odoo/custom/src/odoo/odoo/fields.py", line 5092, in __get__
    raise ValueError("Expected singleton: %s" % record)
ValueError: Expected singleton: res.partner(X, Y)

Please @pedrobaeza and @carolinafernandez-tecnativa can you review it?

@Tecnativa TT41745

OCA-git-bot commented 6 months ago

Hi @ows-cloud, @pedrobaeza, some modules you are maintaining are being modified, check this out!

pedrobaeza commented 6 months ago

Which is the error? Stacktrace always, please.

victoralmau commented 6 months ago

Stacktrace added

OCA-git-bot commented 6 months ago

Hey, thanks for contributing! Proceeding to merge this for you. Prepared branch 16.0-ocabot-merge-pr-126-by-pedrobaeza-bump-patch, awaiting test results.

OCA-git-bot commented 6 months ago

Congratulations, your PR was merged at a7e12a2cf1cc7e574c11ebd95b1996c5f7dd6696. Thanks a lot for contributing to OCA. ❤️