Purpose: use more email_formatted when possible, clean and simplify
email_from, email_to and partner_to computation.
Next step is to try to extract some common patterns in tools or methods in
order to simplify template creation and customization.
Related to task 1972615
Linked to PR #32872
Currently when in payment is configure in automatic invoice mode,
customers don't receive anything.
If they want to see their invoice, they have to log into their portal
account.
Task #1866497Closes#25864
Purpose
* use the new notification template allowing to display the payment button
only in emails;
* reorder the fields definition to ease the reading;
* slightly clean the email body using a maximum of div and br tags as it
seems better integrated with Odoo edition capabilities;
This commit is linked to task ID 1860049 and PR #25824.
formataddr (from the email python library) writes email_from as '"name" <email>'
in the email_from field of the mail.compose.message record.
When the mail is rendered, onchange_template_id is triggered.
This then overwrites the values of email_from among other fields.
What happens is that it uses the email_from field from the template to render
the email_from, bypassing what was put by formataddr before.
What happens in some cases is that it is rendered as 'name <email>'
(note the quotes have been stripped away).
If name contains arbitrary symbols, e.g. name = 'pépé [company] <pdg>, ohlala',
then getaddresses which is supposed to parse the (name, email) pairs gets thrown
off (in particular, <pdg> will be interpreted as an email address, and many
other problems with the various special symbols).
It then gives these wrong elements as email addresses, which will usually crash
when getting non-ascii symbols (i.e. these strings don't respect the relevant
RFC for email addresses).
Closes:
https://github.com/odoo/odoo/issues/23502https://github.com/odoo/odoo/pull/2311823118
opw 815202
opw 1824243
All those templates are basically the same except some bug fixes that
were not propagated about company. Let us use just the one we just
defined in the mail module.
In this commit we change notification templates used to render
notification emails from jinja-based mail.template to pure QWeb
templates.
There are several reasons to do so
* those are not real mail.template records. Indeed they cannot be used
outside of the notification process as some values are computed
and not available on the mail.message record used to render the
template;
* we do not really need other fields than body. Indeed fields like
subject, email_from or email_to are computed from the notification
process;
* we do not want people to update the mail.template without knowing
the consequences, especially for fields like recipients that may
broke the mail gateway;
* using the html editor easily break the mail.template as it is very
custom and very to break without really realizing it.
It also simplifies template management as it lessens number of mail
template people have in their list view of mail.template. It avoids
mixing technical and functional templates.
We move to QWeb templates as those are not too hard to customize and
allow to perform body rendering which is what we really need when
notifying people of a new message.
This commit does not change the functional purpose and layout of the
templates. Behavior should be the same before and after this commit.
This commit adds a page view for invoices on the customer portal. Layout
is based on the invoice report to closely match what is already done in
Odoo. It replaces the old controller that returned only the pdf.
Customers should now be able to receive both.
Future commits will improve invoice page view notably in account_payment
while adding payment options in account customer portal.
* rename some files according to guidelines;
* clean template name to clean their ordering and ease template browsing;
* use html type for mail templates body instead of cdata;
* clean html for mail templates introduced at 96da10de6cc20486b3e37fd4c6c88eb61cbb919c;
No horse has been harmed and no functional change performed.