[FW][FIX] mail: prevent traceback on editing attachment of scheduled mail
Steps to reproduce
- open a record from Contacts app
- from chatter, click
send mail, open full mail composer - add a attachment
- schedule a message, by clicking '▼' on send message
- Again from chatter, click on edit the same message
- try to add another attachment
Observation: A traceback is received
Issue:
Currently, onFileUploaded function attempts to get res_ids from data,
https://github.com/odoo/odoo/blob/69828835c926485ec80ed92e14dd11fbc6c1caaa/addons/mail/static/src/core/web/mail_composer_attachment_selector.js#L25-L30
but in case message is scheduled, which is stored in mail.scheduled.message ,when editing it we do not have res_ids
https://github.com/odoo/odoo/blob/69828835c926485ec80ed92e14dd11fbc6c1caaa/addons/mail/wizard/mail_compose_message.py#L120
instead we have res_id field,
https://github.com/odoo/odoo/blob/69828835c926485ec80ed92e14dd11fbc6c1caaa/addons/mail/models/mail_scheduled_message.py#L46
hence a traceback is received when trying to json parse a undefined value.
Fix:
Adapt the onFileUploaded function to consider both, res_ids and res_id
opw-4839926
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr
Forward-Port-Of: odoo/odoo#212960
@aksi-odoo @tde-banana-odoo this PR targets master and is the last of the forward-port chain containing:
- odoo/odoo#215304
- odoo/odoo#215280
- odoo/odoo#215260
To merge the full chain, use
@robodoo r+
More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port
@robodoo r+
