Commit Graph
11 Commits
Author SHA1 Message Date
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
Joseph Caburnay 4d59d3d1f3 [REF][FIX] coupon,sale_coupon: move mail_template_sale_coupon
mail_template_sale_coupon is specific to sale_coupon so we are moving
it back to sale_coupon module. Additionally, we add a way of selecting
a mail template when generating coupons for customers.
2020-11-03 10:48:04 +00:00
Joseph Caburnay ef05ca2812 [REF] sale_coupon: rename/move files to prepare coupon module
An initial step to prepare the creation of coupon module. The main goal
is to just move the logic from sale_coupon to coupon. To come up with
less diff as possible, this rename/move step is beneficial for this
purpose.
2020-05-08 14:25:54 +00:00
Nicolas Martinelli b91085e5ca [FIX] sale_coupon: validity duration of coupons
- Create a Promotion Program with
  'Applicability' set to 'Apply On Next Order'
  'Promo Code Usage' set to 'Use a code', set a code (not required,
  only for easiness)
- Create a SO, use the code and validate
- In the Promotion Programs, open the coupon list

The Expiration Date is set to tomorrow.

The Expiration Date is not useful in this case, and it is computed only
because the default value of `validity_duration` is 1. However, the user
is not able to change it since `maximum_use_number` is used for
programs instead.

We set a default value to zero to avoid any confusing computation.

opw-2210794

closes odoo/odoo#47779

X-original-commit: 44e71f9192d8711cbaeac0088db55c3ff26813a1
Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
2020-03-17 09:59:23 +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
mgh-odoo bb87d3f674 [IMP] sale_coupon: refactor the coupon stages and usability improvement
Fix the layout of logo to the printed coupon.

The traceability of the coupons is not clear. for Ex. coupon is send or not?
should I resend? so updated the stages of the coupon

Now the stages will be like
 -pending(previously reserved) -- hidden by default
 -Valid
 -Sent : updated when mail is sent to customer
 -used
 -expired
 -cancelled : hidden by default(added button to cancel the new coupon)

Cron added to expire coupon automatically.

PS: model sale.coupon do not inherit the thread so instead of message_post
change the state 'sent' from mail_compose_message.

Task-ID: 2027296
Closes #34620
2020-01-31 12:46:17 +00:00
Romain DerieandPratima Gupta e87cec8c49 [IMP] sale_coupon: allow discount on multiple specific products
Before this commit, a discount could only target the whole order, the cheapeast
product or a specific product.

With this commit, it becomes possible to select multiple specific products.
This will ease some realistic ecommerce flows.

For instance, one might create a promotion targetting all his bikes by simply
adding all bikes products into the specific products field. This is easily done
with the many2many widget on the form view.

task-33737

closes odoo/odoo#35500

Signed-off-by: Jérémy Kersten (jke) <jke@openerp.com>


Co-authored-by: Pratima Gupta <pgu@odoo.com>
Co-authored-by: Romain Derie <rde@odoo.com>
2019-08-13 09:21:52 +00:00
Romain Derie 779e47caf3 [FIX] sale_coupon: finish renaming products from b62ebab58
Commit b62ebab58 refactored "all the brol" but left half the occurences
untouched.
It was therefore hard to read and understand the tests as the same items would
be referenced with 2 names.
2019-08-13 09:21:52 +00:00
Thibault Delavallée a7ac71ed44 [FIX][IMP] various: perform small cleanup of mail templates
Notably
 * remove cdata and fix html code when necessary;
 * re-order fields declaration to have globally the same order in various
   template definition;
 * remove unnecessary reply-to, make user signature and auto delete fields
   explicit when necessary;
 * improve some name to ease template ordering and understanding in the
   template list view;

Related to task 1972615
Linked to PR #32872

Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2019-04-23 14:26:50 +00:00
Thibault Delavallée 0b74c9ab6e [FIX][IMP] various: improve recipients computation in mail templates
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
2019-04-23 14:26:50 +00:00
Jeremy Kersten ac5469646c [MRG] sale_coupon: prepare move to community repo 2019-04-01 10:41:55 +02:00