summaryrefslogtreecommitdiff
path: root/addons/website_sale_coupon/views
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/website_sale_coupon/views
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/website_sale_coupon/views')
-rw-r--r--addons/website_sale_coupon/views/res_config_settings_views.xml21
-rw-r--r--addons/website_sale_coupon/views/sale_coupon_program_views.xml32
-rw-r--r--addons/website_sale_coupon/views/website_sale_templates.xml121
3 files changed, 174 insertions, 0 deletions
diff --git a/addons/website_sale_coupon/views/res_config_settings_views.xml b/addons/website_sale_coupon/views/res_config_settings_views.xml
new file mode 100644
index 00000000..ae0837b6
--- /dev/null
+++ b/addons/website_sale_coupon/views/res_config_settings_views.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+
+ <record id="res_config_settings_view_form" model="ir.ui.view">
+ <field name="name">res.config.settings.view.form.inherit.website.sale.coupon</field>
+ <field name="model">res.config.settings</field>
+ <field name="inherit_id" ref="website.res_config_settings_view_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="//div[@id='website_sale_coupon']" position="after">
+ <div class="content-group">
+ <div class="mt8" attrs="{'invisible': [('module_sale_coupon', '=', False)]}">
+ <button name="%(coupon.coupon_program_action_promo_program)d" icon="fa-arrow-right" type="action" string="Promotion Programs" class="btn-link"/>
+ </div>
+ <div class="mt8" attrs="{'invisible': [('module_sale_coupon', '=', False)]}">
+ <button name="%(coupon.coupon_program_action_coupon_program)d" icon="fa-arrow-right" type="action" string="Coupon Programs" class="btn-link"/>
+ </div>
+ </div>
+ </xpath>
+ </field>
+ </record>
+</odoo>
diff --git a/addons/website_sale_coupon/views/sale_coupon_program_views.xml b/addons/website_sale_coupon/views/sale_coupon_program_views.xml
new file mode 100644
index 00000000..06ce21f5
--- /dev/null
+++ b/addons/website_sale_coupon/views/sale_coupon_program_views.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+
+ <menuitem action="coupon.coupon_program_action_promo_program" id="menu_promotion_type_config" name="Promotion Programs" parent="website_sale.menu_catalog" groups="sales_team.group_sale_manager" sequence="50"/>
+ <menuitem id="menu_coupon_type_config" action="coupon.coupon_program_action_coupon_program" name="Coupon Programs" parent="website_sale.menu_catalog" groups="sales_team.group_sale_manager" sequence="51"/>
+
+ <record model="ir.ui.view" id="sale_coupon_program_view_form_common_website">
+ <field name="name">coupon.program.common.form</field>
+ <field name="model">coupon.program</field>
+ <field name="inherit_id" ref="coupon.coupon_program_view_form_common"/>
+ <field name="arch" type="xml">
+ <group name="validity" position="inside">
+ <label for="website_id" groups="website.group_multi_website"/>
+ <div>
+ <field name="website_id" options="{'no_create': True}" groups="website.group_multi_website"/>
+ </div>
+ </group>
+ </field>
+ </record>
+
+ <record id="sale_coupon_program_view_tree_website" model="ir.ui.view">
+ <field name="name">coupon.program.tree</field>
+ <field name="model">coupon.program</field>
+ <field name="inherit_id" ref="coupon.coupon_program_view_tree"/>
+ <field name="arch" type="xml">
+ <field name="name" position="after">
+ <field name="website_id" groups="website.group_multi_website"/>
+ </field>
+ </field>
+ </record>
+
+</odoo> \ No newline at end of file
diff --git a/addons/website_sale_coupon/views/website_sale_templates.xml b/addons/website_sale_coupon/views/website_sale_templates.xml
new file mode 100644
index 00000000..5d67838f
--- /dev/null
+++ b/addons/website_sale_coupon/views/website_sale_templates.xml
@@ -0,0 +1,121 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+
+<template id="assets_tests" name="Website Sale Coupon Assets Tests" inherit_id="web.assets_tests">
+ <xpath expr="." position="inside">
+ <script type="text/javascript" src="/website_sale_coupon/static/tests/tours/website_sale_coupon.js"></script>
+ </xpath>
+</template>
+<template id="website_sale_coupon_cart_summary_show_img" inherit_id="website_sale.cart_summary">
+ <xpath expr="//td[hasclass('td-img')]/span" position="attributes">
+ <attribute name="t-if">not line.is_reward_line or not line.sudo().product_id.image_128</attribute>
+ </xpath>
+ <xpath expr="//td[hasclass('td-img')]/span" position="after">
+ <span t-if="line.is_reward_line and line.sudo().product_id.image_128">
+ <img t-att-src="image_data_uri(line.sudo().product_id.image_128)" class="img o_image_64_max rounded"/>
+ </span>
+ </xpath>
+</template>
+<template id="website_sale_coupon_cart_hide_qty" inherit_id="website_sale.cart_lines">
+ <xpath expr="//td[hasclass('td-img')]/span" position="replace">
+ <t t-if="line.is_reward_line and line.sudo().product_id.image_128">
+ <span>
+ <img t-att-src="image_data_uri(line.sudo().product_id.image_128)" class="img o_image_64_max rounded" t-att-alt="line.name_short"/>
+ </span>
+ </t>
+ <t t-else="">
+ <t>$0</t>
+ </t>
+ </xpath>
+ <xpath expr="//td[hasclass('td-qty')]/div" position="attributes">
+ <attribute name="t-att-style">line.is_reward_line and "display:none;"</attribute>
+ </xpath>
+ <xpath expr="//table[@id='cart_products']/tbody//tr//td[hasclass('td-product_name')]//div" position="attributes">
+ <!-- Can't xpath "//table[@id='cart_products']/tbody//tr" since optional_product already xpath that one.
+ There will be the same xpath attribute class on the same element. Last installed module will only be taken into account -->
+ <attribute name="t-att-class">'reward_product' if line.is_reward_line else None</attribute>
+ </xpath>
+ <xpath expr="//td[hasclass('td-qty')]/div" position="after">
+ <t t-if="line.is_reward_line">
+ <span class="js_quantity text-muted" t-esc="int(line.product_uom_qty)"/>
+ </t>
+ </xpath>
+ <xpath expr="//del" position="attributes">
+ <attribute name="t-if">not line.is_reward_line</attribute>
+ </xpath>
+</template>
+<template id="cart_popover" inherit_id="website_sale.cart_popover" name="Cart Popover">
+ <xpath expr="//div[hasclass('cart_line')]/div[1]/span" position="replace">
+ <t t-if="line.is_reward_line and line.sudo().product_id.image_128">
+ <span>
+ <img t-att-src="image_data_uri(line.sudo().product_id.image_128)" class="img o_image_64_max rounded" t-att-alt="line.name_short"/>
+ </span>
+ </t>
+ <t t-else="">
+ <t>$0</t>
+ </t>
+ </xpath>
+</template>
+<template id="sale_coupon_result" inherit_id="website_sale.coupon_form">
+ <xpath expr="//form[@name='coupon_code']" position="after">
+ <t t-if="website_sale_order and website_sale_order.applied_coupon_ids">
+ <t t-foreach="website_sale_order.applied_coupon_ids" t-as="coupon">
+ <div class="alert alert-success text-left mt16" role="alert">
+ You have successfully applied following promo code: <strong t-esc="coupon.code"/>
+ </div>
+ </t>
+ </t>
+ <t t-if="website_sale_order and website_sale_order.promo_code">
+ <div class="alert alert-success text-left mt16" role="alert">
+ You have successfully applied following promo code: <strong t-esc="website_sale_order.promo_code"/>
+ </div>
+ </t>
+ <t t-if="website_sale_order and website_sale_order.generated_coupon_ids">
+ <t t-foreach="website_sale_order.generated_coupon_ids.filtered(lambda c: c.state != 'expired')" t-as="coupon">
+ <div class="alert alert-success text-left mt16" role="alert">
+ Your reward <strong t-esc="coupon.discount_line_product_id.name"/> is available on a next order with this promo code: <strong t-esc="coupon.code"/>
+ </div>
+ </t>
+ </t>
+ <t t-if="request.params.get('code_not_available')">
+ <div class="alert alert-danger text-left mt16" role="alert">
+ Invalid or expired promo code.
+ </div>
+ </t>
+ <t t-if="website_sale_order.get_promo_code_error(delete=False)">
+ <div class="alert alert-danger text-left mt16" role="alert">
+ <t t-esc="website_sale_order.get_promo_code_error()"/>
+ </div>
+ </t>
+ </xpath>
+ <xpath expr="//t[@name='code_not_available']" position="replace"/>
+</template>
+
+<template id="cart_discount" name="Show Discount in Subtotal" customize_show="True" active="False" inherit_id="website_sale.total">
+ <xpath expr="//tr[@id='order_total_untaxed']" position="before">
+ <tr t-if="website_sale_order and website_sale_order.reward_amount">
+ <td class="text-right border-0 text-muted" title="Discounted amount">Discount:</td>
+ <td class="text-xl-right border-0 text-muted">
+ <span t-field="website_sale_order.reward_amount" style="white-space: nowrap;"
+ class="monetary_field"
+ t-options='{
+ "widget": "monetary",
+ "display_currency": website_sale_order.currency_id,
+ }'/>
+ </td>
+ </tr>
+ </xpath>
+</template>
+
+<template id="reduction_coupon_code" inherit_id="website_sale.reduction_code">
+ <xpath expr="//t[@t-set='force_coupon']" position="replace">
+ <t t-set='force_coupon' t-value="website_sale_order.pricelist_id.code or request.params.get('code_not_available') or website_sale_order.promo_code or website_sale_order.generated_coupon_ids or website_sale_order.applied_coupon_ids or website_sale_order.get_promo_code_error(delete=False)"/>
+ </xpath>
+</template>
+
+<template id="cart_summary" name="Payment" inherit_id="website_sale.cart_summary">
+ <xpath expr="//table[@id='cart_products']/tbody/tr/td[hasclass('td-price')]/child::*" position="attributes">
+ <attribute name="t-att-style">'display: None;' if free_shipping_lines and line in free_shipping_lines else ''</attribute>
+ </xpath>
+</template>
+</odoo>