Commit Graph
43 Commits
Author SHA1 Message Date
Thibault Delavallée 28b4ba4049 [IMP] mail, various: allow to link multiple reports to templates
RATIONALE

Improve usage of composer in comment or email mode: support batch-posting in
comment, support more configuration from templates, improve global model.

SPECIFICATIONS

Update report_template field on template model to be a many2many field instead
of a many2one. It allows to attach multiple dynamic reports to a given template
instead of being limited to a single one.

Name should now come from the report itself, which should be considered as
complete by itself. Template cannot override report naming anymore.

Task-2868153 (Mail: Allow multi reports in mail templates)

Part-of: odoo/odoo#99482
2023-01-17 20:58:40 +01:00
Dossogne Bertrand 7c4da16b59 [IMP] mail, various: improve mail template usability
Allow our users to modify mail template more easily

- make the list accessible from the settings
- give them a link to update relevant views to update header/footer
- make the list and form of templates more readable
- add a description on templates, allowing to describe their usage

In order to better filter templates, a new category field is added that
is computed based on active flag, description being set and the template
having an xml ID. Master templates are active, with a description and an
xml ID.

Update master data to add description on some templates.

task-2944770

closes odoo/odoo#101730

X-original-commit: dfa867343ee8842f3f127ac62584fd471b41dde1
Related: odoo/enterprise#32079
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-10-04 09:55:46 +02:00
Florian Charlier 332bfade6e [FIX] mail: adjust emails design
Improve the design of SO/PO/INV mails together with the other changes of the
release, i.e. fixes a few imprecisions introduced by odoo/odoo#82167.

In particular, these changes enforce
* a responsive, mobile friendly layout tested on many devices and OS
* more generally, a consistent styling. Note that some redundancy in directives
 is required for compatibility across email clients.

Translation files are included.

Task-2751139
Follow-up of Task-2712450
See odoo/enterprise#25154

closes odoo/odoo#86494

X-original-commit: 4914127b428802d2ff2e15351238a3ffef24b9cc
Related: odoo/enterprise#25306
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2022-03-16 13:16:46 +01:00
Thibault Delavallée bf6c805b66 [FIX] mail, *: add signature in email layouts only if requested and set
* = account, purchase, sale

Purpose of this commit is to add signature only if really asked. A variable
is available for that purpose (``email_add_signature``, recently renamed from
``add_sign``). We also correctly check signature is not void or pseudo-void
using tool ``is_html_empty``. Indeed editor may generates pseudo-void content
like ``<p><br /></p>``.

As signature is not added when a template is used (see composer code) we ensure
it is defined in mail templates used in "Send by email" flows. Indeed we cannot
know if a template already has a signature or not. To avoid having twice a
signature no signature is added in email notification layout when a template
is involved.

Continuation of odoo/odoo#76418 .

Task-2712450 (Mail/Sale: Improve 'Pay Now' notification template)

Part-of: odoo/odoo#82167
2022-01-31 17:47:33 +00:00
Nicolas Bayet 4813f42997 [IMP] mail,*: replace jinja with qweb
Jinja as a templating engine was problematic in differents respect:
- introduce external dependency to Odoo (less controll)
- add another templating mechanism in the stack
- specific feature in qweb cannot be reused
- difficulty in rendering easily editable templates
- more knowledge required with no betterment

By replacing jinja with qweb we can now build tools to edit a qweb
that will work with the previously jinja encoded document
(essentially `mail.template` records).

There is a catch however. Some email fields (eg. email_to) used jinja
syntax for rendering dynamic variables (ie. ${object.something} and
${object.something_that_should_not_be_escaped | safe}).

We still want user to use dynamic variables for some char fields (eg.
subject, from, to, ...). We made a new rendering engine called
"inline_template" that will render an expression enclosed by `{{` and
`}}`.

To be able to edit the templates from the backend interface, a
plugin to the Odoo editor has been made for seamlessly edit the
document.

This qweb plugin includes:
- make dynamic variables (eg. `<t t-out="variable"/>`) not editable
  (for preventing the user to shoot himself in the foot)
- group and hide related logical branching (ie. t-if, t-elif, and t-else)
  in order to see only one at once
- a floating select input to switch visibility of a particular logical
  branching

Task-27033

X-original-commit: odoo/odoo@68182baff4
Part-of: odoo/odoo#77377
2021-09-28 23:42:54 +00:00
Thibault Delavallée eadf1270ed [MOV][IMP] purchase(_stock), (sale_)stock: reorganize qweb / jinja templates used for mailing
PURPOSE

Clean organization of templates in odoo apps: mail.template records in data,
qweb templates (views) used directly in code, notably using post with view.
Purpose is to ease future improvements in posting based on templates.

SPECIFICATIONS

  * move those templates in their own file to ease their discovering and
    maintenance;
  * put them into data (as those are not views even if it contains qweb)
  * guidelines are now :

    -> Qweb templates should be in data/mail_templates.xml;
    -> mail.template records should be in data/mail_template_data.xml;

  * put their declaration in no update when not done if template has no
    technical code or complex dependency on underlying code;
  * move found mail data (mail.message.subtype or mail.activity.type) records
    in a mail_data file that should contain only "core" records linked to mail;

LINKS

Task ID-2375767
COM PR odoo/odoo#61814
ENT PR odoo/enterprise#14775
UPG PR odoo/upgrade#19366
2020-11-25 12:31:09 +00:00
yhu-odoo c531cb0591 [FIX] stock, mrp, purchase: improvement and fix bugs
In stock:
1. remove string of action_show_details button, only show icon
2. late filer have been megered with planning issues filer,
update the name. (also in mrp)
3. add width to json_lead_days_popover field to show it properly
4. change inventory adjustment empty screen image.

In purchase:
1. in reminder mail, show "undefined" when no date. This will
only be shown in preview. When no date, we won't send reminder mail to
the vendor.
2. remove old book icon for document in setting.
3. check if there is date_planned when craete a confirm date url
4. RFQs late filter now show all late RFQs with in state "draft",
"sent", and "to approve".
5. improve the the words in KIP and empty screen and list view

Task 2298950
PR #55155

closes odoo/odoo#55740

Related: odoo/enterprise#12344
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
2020-08-11 12:22:22 +00:00
Fabien Pinckaers ccfc54113d [IMP] purchase: Improve reminder mail usability
Some change to imporve reminder mail usability:

1. Scheduled date on POL of the PO form now is always editable.
2. Improve tooltip for the reminder email
3. don't show number of days when reminder email not checked on
   both PO and partner form.
4. only show "confirm receipt date" button in debug model
5. In the mail, format date by partner.lang
6. Add button to send preview reminder mail
7. On default, receipt_reminder_email on res.partner is False
8. merge expected_date with date_planned (done by FP)

Task 2265912
PR #52693
2020-06-09 13:59:10 +00:00
yhu-odoo 181c7d82e3 [IMP] purchase: send reminder mail to vendor
1. automatically send a reminder mail to vendor to confirm the receipt
date. If confirmed, (confirmed by vendor) will be added next to the
receipt date. If not, vendor can update the date on the portal website.
An warning activity will be set for the purchase representative for this
update.

2. Vendor can also comfirm recieption of the PO when we 'send PO by mail'.
If confirm, (confirmed by vendor) will be added next to the confirmation
date. An filter is added in the PO search view to show all unconfirmed
PO.

Task 2230811
PR #49921

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
2020-05-27 08:20:17 +00:00
mcm-odooandThibault Delavallée de1743ab12 [REF] mail, various: remove user_signature field from mail.template
RATIONALE

Mail template model holds a field telling odoo mail engine to automatically
add the current user's signature to the body. Its use depends on the use
case

  * using the template in the composer on a single record: it is displayed
    in the rendered template in the composer, meaning people could change it.
    This behavior is interesting as it allows to see the email content;
  * using the template in the composer in mass mail mode: it is not displayed
    as only the raw jinja is displayed. It is therefore not obvious that it
    will be appended to the body of the mail. People could add it manually and
    have 2 signatures as a result;

A mechanism automatically adding a signature to sent emails when posting a
message is already implemented and is based on template existence. If a
template has been used when posting, no signature is added in sent emails.
Otherwise it is automatically added. This behavior should not change.

Behavior will therefore be

  * use a template -> specify signature usage in it manually through jinja;
  * do not use a template -> signature added in sent emails;

SPECIFICATIONS

Remove user_signature.

Update template body accordingly. In customer oriented templates that are using
it and do not already contain it, manually add a call to user.signature within
the jinja code. When set to False, just remove its declaration.

Quickly clean some signature integration.

LINKS

Task ID 2089252
Community PR odoo/odoo#39482
Enterprise PR odoo/enterprise#6459
Upgrade PR odoo/upgrate#761

Related: odoo/enterprise#6459
Related: odoo/upgrade#761
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Co-authored-by: Michaël Mattiello <mcm@odoo.com>
Co-authored-by: Thibault Delavallée <tde@odoo.com>
2020-02-11 14:01:13 +00:00
Arnaud Baes bf4a8b3de8 [IMP] purchase: Email sent from PO sent by the current user.
When an email was sent from a PO, the sender was by default the user who created the PO.
The sender is now replaced by the current user.

TaskID: 1934477

closes odoo/odoo#30660
2019-01-29 15:04:59 +00:00
Darshil Trivedi 19e62fa7c3 [IMP] purchase: clean mail template
Usability change:
- Remove amount from RFQ template
- Remove origin from both templates
- Modify last sentence to a proper English
- Add partner reference in PO template

Technically remove the conidtion on object state in
order to guess if it's a RFQ or a PO since the check
is already made in python and it exists a template
for the RFQ and a template for PO.

This commit is related to task ID 1835441
2018-08-28 15:36:27 +02:00
Shubham Johar d0d0ba0d25 [IMP] purchase: make templates more modern and updated with Odoo guidelines
In this commit we improve templates used in purchase. Purpose of this commit
is to have templates that embed or use standard Odoo email layouts to make
them look modern and have a common style across all emails.

Main guidelines

 * better use of div / p / br to try to lessen layout issues, especially
   when updating templates using the editor;
 * correctly sequence the templates fields definition;
 * correctly set templates values notably auto_delete and user_signature
   fields to avoid confusion;
 * correctly layout the email content using light notification email. It
   can either propagate the layout choice through various send mail methods
   or directly embed the styling in the templates for more technical or
   complex templates;
 * use email_formatted computed field when possible to avoid having hand-made
   from / to addresses;
 * fix various typos and improve subjects when necessary;

Content of emails is not necessarily updated as the purpose of this task is
about styling, not content itself.

This commit is linked to task ID 1843151 (and 1868112) and to PR #25346
(and #25889).
2018-07-24 15:33:22 +02:00
Thibault Delavallée a2403b0695 [REF] purchase: clean send by email templates
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.
2018-07-19 17:14:33 +02:00
Christophe Simonis aba8c2b8fb [MERGE] forward port branch 11.0 up to 1b272a2050 2018-06-05 16:27:49 +02:00
len-odoo 42aff92a4e [FIX] account, purchase, sale: properly quote the name of the email sender
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/23502
https://github.com/odoo/odoo/pull/2311823118

opw 815202
opw 1824243
2018-06-01 13:06:09 +02:00
Christophe Simonis 3ab25b60bc [MERGE] forward port branch saas-15 up to cae950e826 2018-04-23 17:59:59 +02:00
Christophe Simonis 6b94555af0 [MERGE] forward port branch saas-14 up to dd18811e6c 2018-04-23 16:00:32 +02:00
Nicolas Lempereur dd18811e6c [FIX] purchase: use PO company for PO notification
In 41ffb503 the "Invoice Notification Email"  and "Sale Order
Notification Email" were modified so the company used was the one of
the object if available or the sender otherwise.

This had not been done for the "Purchase Order Notification Email" which
was added in saas-14 which might be unexpected.

Also as in 7a03f9ce9 specify the company when displaying the logo.

opw-1838112
closes #24344
2018-04-23 15:31:52 +02:00
Goffin Simon 4ac10f20c4 [FIX] account, purchase, sale: Wrong company displayed in the footer
Steps to reproduce the bug:

- Set a multi company environment with two company A and B
- Set user admin in company A
- Set user demo in company B
- Create a PO with user demo
- Send a RFQ

Bug:

The company of the admin user was displayed in the footer of the email.

The function _notify called on res.parter model is called in sudo by
the function _notify on mail.message model.

The function render_template on mail.template model uses the user defined
on self.env to render the template. So the user admin was always used.

opw:1835647
2018-04-23 09:33:22 +02:00
Christophe Simonis e0345a4a3f [MERGE] forward port branch 11.0 up to 2835d29979 2018-03-20 11:45:11 +01:00
Christophe Simonis 4715d7e35a [MERGE] forward port branch saas-15 up to 0d55241185 2018-03-19 19:29:58 +01:00
Christophe Simonis 82effcca83 [MERGE] forward port branch 10.0 up to caf6b4a7c7 2018-03-19 18:25:41 +01:00
jem-odoo 622b70ee3e [FIX] purchase: wrong condition in mail template
Before checking the first element of
'partner_id.child_ids', rather check that
the partner and not the object has children,
to avoid crashes when the partner of the PO
is a company.
opw-1826359
2018-03-19 15:13:33 +00:00
Christophe Simonis 36945a5853 [MERGE] forward port branch 11.0 up to c2e878e34c 2018-03-01 19:43:25 +01:00
Christophe Simonis 9d25cc3429 [FIX] *: correcly format amounts in mail templates 2018-02-28 19:01:35 +01:00
Thibault Delavallée 885e7fcda9 [REF] various: use secondary notification template
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.
2018-01-29 16:56:04 +01:00
Thibault Delavallée 0f301bec25 [REF] mail: move email notification templates to QWeb
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.
2018-01-29 16:48:23 +01:00
Nicolas Martinelli ee8e3d6940 [FIX] account, l10n_be_invoice_bba, purchase, repair, sale: format_amount
Use `format_amount` in the mail templates in order to format as a
regular amount (with rounding and symbol).

opw-805370
2018-01-25 11:00:35 +01:00
Fabien Pinckaers 752e4f566b [IMP] purchase: RfQ email layout improved 2016-12-22 17:30:34 +01:00
Fabien Pinckaers a86babf447 [FIX] purchase: missing signature on RFQ's emails 2016-12-22 17:30:34 +01:00
Denis Vermylen (dve) ba3d3582bc [MIG] purchase: Migrate to new API 2016-08-05 14:04:37 +02:00
Fabien Pinckaers 6ff1c28fb3 [IMP] purchase: improved email template 2016-07-17 23:55:30 +02:00
Fabien Pinckaers 97e2d35292 [FIX] english typo: amounting 00 --> amounting in 00 2016-03-21 20:48:39 -07:00
Ravi Gohil 7eab8e26d3 [MIGR] base: migrate base/res to the new API
- `ir.property`, improve API of method `get_by_record`
- `res.bank`, `res.partner.bank`
- `res.company`
- `res.config`, `res.config.installer`, `res.config.settings`, fix usage of methods `get_default_`
- `res.country`, `res.country.group`, `res.country.state`
- `res.currency`, `res.currency.rate`
- `res.font`
- `res.lang`
- `res.partner`, `res.partner.category`, `res.partner.title`
- `res.request.link`
- `res.groups`, `res.users`, `res.users.log`, change password wizard
2016-02-23 12:06:25 +01:00
Julien Legros e5e7c4c121 [MERGE] forward port of branch 9.0 up to 6872aae 2016-01-25 11:26:27 +01:00
Nicolas Lempereur b395ade078 [IMP] *: unnecessary safe filter for subject template
With 6dde919 email subject field are not autoescaped by default, thus
using safe is not necessary.

closes #10547
2016-01-20 14:14:38 +01:00
Daniel Dico d8e5cdec7d [FIX] fix various Lucida misspellings
closes #9997
2015-12-10 09:55:22 +01:00
Christophe Simonis 4022493c0b [MERGE] forward port of branch 9.0 up to da2b88b 2015-12-09 16:44:05 +01:00
Thibault Delavallée da2b88bbbe [FIX] sale and others: email_from of templates 2015-12-09 09:59:04 +01:00
Thibault Delavallée 7fe9d58b0d [IMP] invoice, sale, purchase: template update
Templates used to send invoice / quotation / PO by email are cleaned. Custom
style is removed. Content is simplified.

For sale, only one template is kept through the various addons. Previously to
this commit there are 3 templates: standard, portal and online quote. Those
template are similar except the link to get the sale order. Now the base template
contains some logic that should be sufficient to cover all cases. This breaks
the modular approach but is easier to use for users. As templates are still mako
it is not possible to use inheritance. So having a base template knowing some bits
of overriding modules is necessary if we want to avoid having the same template
duplicated.
2015-11-02 11:51:09 +01:00
Yannick Tivisse 757ababa68 [FIX] account,sale,purchase: Take country format address in email templates
In qweb reports, the address is displayed according the standards of the
country where it belongs. In the email templates, the company address was
always displayed in the same way, no matter the country of the address.
2015-09-30 16:45:22 +02:00
mdi-odoo 620bf116d8 [IMP] sale, purchase: the return of mail.template (Sale order, and purchase RFQ)
These templates were deleted with c04065abd8 but there xml_id were still used in the code. Mail template are good for people, so we make them come back from the dead ...
2015-09-08 16:57:51 +02:00