Commit Graph
60 Commits
Author SHA1 Message Date
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
Antoine Vandevenne (anv)andVictor Feyens 573ed74c12 [REF] payment, *: refactor online payments API
This commit replaces the old online payments API of the `payment`
module with the new one and adapts to it all the implementing modules.

See the merge commit for more details.

task-2085989
task-2119838
task-2165982
task-2289255

Co-authored-by: Victor Feyens <vfe@odoo.com>
2021-03-30 09:25:51 +02:00
Thibault Delavallée e3fd1cd91e [MOV][IMP] sale(_coupon), pos_coupon: 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#1936
2020-11-25 12:31:09 +00:00
Thibault Delavallée 12ef8b6312 [MOV] sale: split data to separate mail data from other data
It is simpler to have data split by main model or application like we
already do for models and views. It allows to easily have an overview
of data a module holds.

As we will work on mail related data like adding activities or tweaking
subtypes and templates, having them all in a single file and not lost
between other data helps finding and working with it.

This commit only moves code. No functional change should occur.
2018-02-21 16:52:15 +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
Christophe Simonis 10128fa7e8 [MERGE] forward port branch saas-16 up to dc2a6c6cd2 2017-10-20 19:27:04 +02:00
Christophe Simonis 5ea0f55d65 [MERGE] forward port branch saas-15 up to bee0c11ef7 2017-10-20 17:57:21 +02:00
Christophe Simonis bee0c11ef7 [MERGE] forward port branch saas-14 up to f3ac68ed29 2017-10-20 17:24:15 +02:00
Christophe Simonis f3ac68ed29 [MERGE] forward port branch 10.0 up to e2532f855f 2017-10-20 16:09:28 +02:00
Lucas Perais (lpe) af6baac9c7 [FIX] account, sale: fix notification templates inline style
Before this commit, Sale order and invoice notification email templates broke when doing any action on them (duplicating, open preview etc...)
This is because the model is saved during those operation, and the css style gets converted to inline style.
The table tag present in those templates, was wrongly associated with the bootstrap rule for tables, collapsing their border, hence the break of the templates.

After this commit, we force the borders not to collapse, and the templates don't break

OPW 774323
2017-10-20 09:09:04 +02:00
Thibault Delavallée 2d4c8103f9 [IMP] sale, website_quote: improve email link and wording computation
The 'View', 'Accept and Sign', 'Pay Online' buttons are now correctly
computed based on the sales settings or the online quote settings.
Indeed it is now possible to sign and/or pay quotations without having
website_quote module installed.
2017-09-06 10:49:02 +02:00
Denis Vermylen 7dd6225f0b [IMP] mail, account, sale: improve sales order mail link
Mail now can handles a generic access_token in /mail/view route. Mail does
not do anything with it. Addons can override the controller and add their
specific management of this token according to some specific business
logic.

Sale order emails now contains the access token to grant access from the
notification email url without logging in. Sale portal now allow customers
to log in using an access token without having to use Online Quote. If
the user doesn't have an account yet and signup is allowed (B2C) an extra
parameter is added to the url to link the correct partner to the user upon
signup. If the user already has an account an extra parameter is added to
auto-fill the user's login if he wants to login from that session.

Account is also updated to prepare accepting access tokens. However the
complete implementation of accounting customer portal will be done in
another task coming soon.
2017-07-06 12:53:39 +02:00
Denis Vermylen 232a44a31d [FIX] sale: missing variable in 'Send by email' template
doc_name was accidentally removed at 5a6f03a1ce.

Shame.
2017-07-04 15:40:54 +02:00
Prakash Prajapati 72d0a439dd [IMP] sale: rename Pro-Forma into Pro-Foma Invoice
Purpose
=======

pro-forma concept is not easy, it is an adjective in english, it should be "Pro-Forma Invoice" to avoid confuision

Rename it everywhere (report, form, settings)

Specification
=============

In Sales/Settings, Sales/Quotations and in the report (.pdf)
2017-06-20 11:14:25 +02:00
Hiral Bhavsar 5a6f03a1ce [IMP] sale, website_quote: improve wording in sent emails
Correctly display 'Pay online' or 'View online' depending on payment
required option. Also correctly set the URL that comes from the
get_access_action method.
2017-05-15 14:17:19 +02:00
Laurent Smet e80238042c [REF] report: remove the report module
The content of the report module is now dispatched in
the 'base' and the 'web' modules.
2017-05-08 09:23:12 +02:00
Christophe Simonis bf7de4d32f [MERGE] forward port branch saas-15 up to 3f6bb0f544 2017-05-02 18:53:44 +02:00
Christophe Simonis 3f6bb0f544 [MERGE] forward port branch saas-14 up to 6441ea28b3 2017-05-02 18:25:31 +02:00
Christophe Simonis 6441ea28b3 [MERGE] forward port branch 10.0 up to cc7ae17bd5 2017-05-02 18:12:09 +02:00
Goffin Simon e645d38ce1 [FIX] sale: Wrong access_name button in Sales Order - Send by Email
When the online SO was already confirmed and paid, the button "Accept and pay"
was displayed instead of "View".

opw:728306
2017-05-02 15:04:19 +02:00
Thibault Delavallée b49da62365 [IMP] sale: improve link in quotations email
Currently the link is always the website link once website_portal or
website_quote is installed. However it is better to use the generic
/mail/view controller that chooses the right redirection depending on
the user trying to access the document.

This commit also fixes redirection in website_quote that is always
redirecting to the front-end. Classic users should land on the backend.
Indeed seeing the front-end page is rarely interesting for them.
2017-04-25 14:10:54 +02:00
Denis Ledoux 1279f82e12 [FIX] sale: sales order email template without portal_sale
When disabling the customer portal
in the general settings
(or uninstalling the `portal_sale` module directly),
the model `sale.order` no longer has a method
`get_signup_url`, and it therefore leads
to the fail of the email template rendering which is
still referencing this method.

Besides, the `access_url` is actually used only if
`is_online` is True,
(see the `% if is_online:` few lines later)
and in this case `get_signup_url`
was not used at all.

Therefore, we can assume `None` is a good alternative,
as the resul of `get_signup_url` was actually no longer
used.

opw-710481
2017-03-06 13:28:14 +01:00
Christophe Simonis 68176d80ad [MERGE] forward port branch saas-14 up to eddefc9948 2017-03-01 16:49:15 +01:00
Christophe Simonis 85368d7f86 [MERGE] forward port branch 10.0 up to 387b2acfcb 2017-02-23 20:15:38 +01:00
Nicolas Martinelli 7a03f9ce93 [FIX] web, sale, account: company logo
The notification mail template of a SO and an Invoice displays the logo
of the company. However, the logo is always the logo of the superuser's
company.

When accessing the logo from an email client, the UID is not defined.
Therefore, we fall back on the superuser, and display the logo of his
company.

We add the support of a `company` key in the kwargs, so we can force the
company from which we retrieve the logo. Note that this key was used
elsewhere, such as:

addons/web/static/src/js/web_client.js

opw-705420
2017-02-14 12:14:23 +01:00
Denis Ledoux 41ffb5032b [FIX] mail, sale, account: company used in notification emails
The `user` variable in the mail templates is the `self.env.user`,
https://github.com/odoo/odoo/blob/10.0/addons/mail/models/mail_template.py#L370

which will always be the administrator in the use case
of a notification email
https://github.com/odoo/odoo/blob/10.0/addons/mail/models/res_partner.py#L151-L156

Using `user.company_id` to determine the company of the sales order
or the invoice is therefore wrong, as it will always be the administrator
company, which can be different than the order/invoice company.

opw-706267
2017-02-13 15:18:23 +01:00
mmo 33b09d0d5e [IMP] generic: Open external links in a new tab by default
Purpose
=======

External links in the data sometimes open in the same tab, the users loses times as he has to come back (and looses the context).

Specification
=============

Any external links in data (planners, settings) should open in new tabs.
2017-02-10 14:29:29 +01:00
Mansi Gandhi c3cf05af3e [IMP] sale,account: Move pro-forma to sales and make it a quote report
Purpose
=======

we use to make proforma invoice to get payment before the creation of the real invoice. In the current odoo, the proforma state is too late. Because you have to confirm the SO to generate the draft invoice and so the proforma. But, if you do that, you have generated a subscription or a delivery order in the mean time. A proforma is actually a quote. In old ERP they used to make proforma to send a quote  and don't generate invoice number.

Specification
=============

- Remove everything related to Proforma from accounting
    - Remove the configuration of pro-forma from account setting
    - Invoice form, remove "Pro-froma" button, stage, report title
- Add proforma configuration option in sales setting under "Quotation and Sales" section
- In quote/sale, add Pro-forma under Print
- A pro-forma is a quote, but the title of the report is Pro-Forma and not Quotation
- button (secondary) on quotation form "SEND PRO-FORMA" to send proforma by mail attached with related report.
   - button
   - mail template
   - when preparing a quotation this button is visible but if even one invoice this should be invisible (as confirming SO doesn't generate invoice currently)
2017-02-08 17:11:07 +01:00
Kinjal Mehta b0185e15cc [FIX] all: fix some common typos
Sale Order --> Sales Order
Sale Report --> Sales Report
Sale Team -> Sales Team
Payment Term --> Payment Terms
2016-12-22 13:29:38 +01:00
Fabien Pinckaers 170299e8e5 [FIX] sale: usability of email: signature more visible 2016-12-20 20:52:59 +01:00
Christophe Simonis 0b846861b6 [MERGE] forward port branch 10.0 up to 5dc1c57 2016-12-01 17:05:08 +01:00
Nicolas Lempereur 54d091448b [FIX] sale, website_portal_sale: see portal button
With a9bd9ab1 the access action was refined depending on the user.

But when sending a mail about a sale order, this lead to an issue since
a mail template is rendered with the current user and not the mail
recipients.

So in the case of a sale order, the recipient could not have a button
leading to /my/orders/{order_id} whilst he should have, because the
user used to render the mail was the sender (which was an employee and
not a share user).

This commit adds a context key "force_website" which force the action to
an available /my/orders even if the sender is not a share user.

opw-691040
2016-11-23 09:32:18 +01:00
Fabien Pinckaers 41cebc4637 [IMP] sale: quotation email template small fix 2016-11-17 13:42:42 +01:00
Christophe Simonis 8847519621 [MERGE] forward port branch 10.0 up to 0acd63d 2016-10-12 17:10:49 +02:00
Thibault Delavallée 3ff2f81194 [IMP][MOV] portal_sale, sale, account: move portal stuff into right addon
* [MOV] sale and invoice portal related code from portal_sale to
   website_portal_sale. Security rules and website related stuff should
   indeed be located in website_portal_sale.
 * [MOV] sale and invoice standard code to sale and account. Adding customer
   as follower is a standard feature for sale orders and invoices.
 * [IMP] website_portal_sale does not depend from portal_sale anymore but sale
   and other portal / website addons
2016-10-12 15:11:27 +02:00
Thibault Delavallée aa5051f885 [FIX] sale: fix report name when sending by email, no more lasting _ 2016-10-12 14:38:39 +02:00
qsm-odoo fb363b572b [FIX] *: adapt odoo interface violet
Change color #a24689 to #875A7B

Commit https://github.com/odoo/enterprise/commit/8ac1c19fac7615fecd51e670f798d13158a4e53c
changed the odoo interface violet by changing the main LESS variable
but forgot there was many direct occurences in XML/HTML/... (for
example for the mobile browser color).

Even if it's community the odoo interface violet is used at many places
(module description, XML demo data, ...).
2016-10-05 10:29:00 +02:00
Thibault Delavallée 4a016f6180 [FIX] account, sale: effectively hide internal content in chatter using o_mail_notification summary
We use summary instead of class as classes are often stripped by gmail or even odoo.
Summary is a commonly kept attribute so it is used in the mail gateway to hide
what is considered as internal content and should not be rendered in the chatter.
2016-09-09 18:17:34 +02:00
Christophe Simonis 1a77d9d02a [MERGE] forward port branch saas-12 up to 476cb5a0 2016-09-03 23:57:57 +02:00
Thibault Delavallée eb440baab2 [FIX] sale: send email quotations to contact, not invoice address 2016-08-31 17:49:45 +02:00
Thibault Delavallée 97425bfe3f [REF] various: make mako mail templates more xml compliant
As we will soon improve the sanitizer we will be able to sanitize email
templates body. However this implies some cleaning in the templates to
be sure mako is not considered as invalid html / xml and therefore removed
from the template body.
2016-08-30 15:54:55 +02:00
Yannick Tivisse 9a51855008 [FIX] account,sale: Correct management of notifications to portal users
[FIX] sale: Don't display 'View quotation' button on email if no website
If the website module is not installed, the button 'View Quotation' will lead to the backend chatter page, which is not very useful in our case.
As the quotation is already attached in the mail as a pdf, just don't display the button if the website module is not installed

[FIX] account,sale: Don't send notif template to portal customers if no website

[FIX] account: Don't display 'View Invoice' button on email if no website
If the website module is not installed, the button 'View Invoice' will lead to the backend chatter page, which is not very useful in our case.
As the invoice is already attached in the mail as a pdf, just don't display the button if the website module is not installed

[FIX] website_sale: override get_access_action to redirect to my/invoices
2016-08-30 10:17:38 +02:00
Fabien Pinckaers 8eb63b2f06 [IMP] sale, account: custom email when invoice/quotation, not simple messages 2016-07-18 00:16:32 +02:00
Fabien Pinckaers 8cb4252d44 [IMP] sale: better email template for quotations 2016-07-17 23:49:23 +02:00
Fabien Pinckaers 9fbe082b2b [IMP] web_editor: css regular spacing between <p> to avoid bad layout
for email previews (e.g. sale order)
[IMP] improved email template for SO, with added signature
2016-07-17 01:02:06 +02:00
Christophe Simonis 6c8141a1df [MERGE] forward port of branch saas-10 up to 2483327 2016-04-01 16:15:35 +02:00
Christophe Simonis ddb0fb2739 [MERGE] forward port of branch saas-9 up to 59d3f63 2016-03-24 16:53:45 +01:00
Fabien Pinckaers 97e2d35292 [FIX] english typo: amounting 00 --> amounting in 00 2016-03-21 20:48:39 -07:00