-
-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2847 from ForgeFlow/14.0-update-apriori-coupon
[14.0][UPD] apriori + analysis
- Loading branch information
Showing
9 changed files
with
243 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
openupgrade_scripts/scripts/coupon/14.0.1.0/noupdate_changes.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<odoo> | ||
<record id="expire_coupon_cron" model="ir.cron"> | ||
<field name="model_id" ref="coupon.model_coupon_coupon"/> | ||
</record> | ||
<record id="mail_template_sale_coupon" model="mail.template"> | ||
<field name="body_html" type="html"> | ||
<table border="0" cellpadding="0" cellspacing="0" style="width:100%; margin:0px auto;"> | ||
<tbody> | ||
<tr> | ||
<td valign="top" style="text-align: center; font-size: 14px;"> | ||
% if object.partner_id.name: | ||
Congratulations ${object.partner_id.name},<br/> | ||
% endif | ||
|
||
Here is your reward from ${object.program_id.company_id.name}.<br/> | ||
|
||
% if object.program_id.reward_type == 'discount': | ||
% if object.program_id.discount_type == 'fixed_amount': | ||
<span style="font-size: 50px; color: #875A7B; font-weight: bold;"> | ||
${'%s' % format_amount(object.program_id.discount_fixed_amount, object.program_id.currency_id)} | ||
</span><br/> | ||
<strong style="font-size: 24px;">off on your next order</strong><br/> | ||
%else | ||
<span style="font-size: 50px; color: #875A7B; font-weight: bold;"> | ||
${object.program_id.discount_percentage} % | ||
</span> | ||
% if object.program_id.discount_apply_on == 'specific_products' | ||
<br/> | ||
% if len(object.program_id.discount_specific_product_ids) != 1 | ||
% set display_specific_products = True | ||
<strong style="font-size: 24px;"> | ||
on some products* | ||
</strong> | ||
% else | ||
<strong style="font-size: 24px;"> | ||
${'on %s' % object.program_id.discount_specific_product_ids.name} | ||
</strong> | ||
% endif | ||
% elif object.program_id.discount_apply_on == 'cheapest_product': | ||
<br/><strong style="font-size: 24px;"> | ||
off on the cheapest product | ||
</strong> | ||
% else | ||
<br/><strong style="font-size: 24px;"> | ||
off on your next order | ||
</strong> | ||
% endif | ||
<br/> | ||
% endif | ||
% elif object.program_id.reward_type == 'product': | ||
<span style="font-size: 36px; color: #875A7B; font-weight: bold;"> | ||
${'get %s free %s' % (object.program_id.reward_product_quantity, object.program_id.reward_product_id.name)} | ||
</span><br/> | ||
<strong style="font-size: 24px;">on your next order</strong><br/> | ||
% elif object.program_id.reward_type == 'free_shipping': | ||
<span style="font-size: 36px; color: #875A7B; font-weight: bold;"> | ||
get free shipping | ||
</span><br/> | ||
<strong style="font-size: 24px;">on your next order</strong><br/> | ||
% endif | ||
</td> | ||
</tr> | ||
<tr style="margin-top: 16px"> | ||
<td valign="top" style="text-align: center; font-size: 14px;"> | ||
Use this promo code | ||
% if object.expiration_date: | ||
before ${object.expiration_date} | ||
% endif | ||
<p style="margin-top: 16px;"><strong style="padding: 16px 8px 16px 8px; border-radius: 3px; background-color: #F1F1F1;"> | ||
${object.code} | ||
</strong></p> | ||
% if object.program_id.rule_min_quantity not in [0, 1] | ||
<span style="font-size: 14px;"> | ||
Minimum purchase of ${object.program_id.rule_min_quantity} products | ||
</span><br/> | ||
% endif | ||
% if object.program_id.rule_minimum_amount != 0.00 | ||
<span style="font-size: 14px;"> | ||
Valid for purchase above ${object.program_id.company_id.currency_id.symbol}${'%0.2f' % object.program_id.rule_minimum_amount |float} | ||
</span><br/> | ||
% endif | ||
% if display_specific_products | ||
<span> | ||
*Valid for following products: ${', '.join(object.program_id.discount_specific_product_ids.mapped('name'))} | ||
</span><br/> | ||
% endif | ||
<br/> | ||
Thank you, | ||
% if object.order_id.user_id.signature: | ||
<br/> | ||
${object.order_id.user_id.signature | safe} | ||
% endif | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</field> | ||
<field name="model_id" ref="coupon.model_coupon_coupon"/> | ||
</record> | ||
</odoo> |
23 changes: 23 additions & 0 deletions
23
openupgrade_scripts/scripts/coupon/14.0.1.0/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2021 ForgeFlow S.L. <https://www.forgeflow.com> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
from openupgradelib import openupgrade | ||
|
||
to_install = [ | ||
"sale_coupon", | ||
] | ||
|
||
|
||
def install_new_modules(cr): | ||
sql = """ | ||
UPDATE ir_module_module | ||
SET state='to install' | ||
WHERE name = {} AND state='uninstalled' | ||
""".format( | ||
tuple(to_install), | ||
) | ||
openupgrade.logged_query(cr, sql) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
install_new_modules(env.cr) |
Oops, something went wrong.