19.0 vanilla

This commit is contained in:
Ernad Husremovic 2026-03-09 09:32:12 +01:00
parent 79f83631d5
commit 73afc09215
6267 changed files with 1534193 additions and 1130106 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="loyalty_card_view_tree_inherit_website_sale_loyalty" model="ir.ui.view">
<field name="name">loyalty.card.view.tree.inherit.website.sale.loyalty</field>
<field name="name">loyalty.card.view.list.inherit.website.sale.loyalty</field>
<field name="model">loyalty.card</field>
<field name="inherit_id" ref="loyalty.loyalty_card_view_tree"/>
<field name="arch" type="xml">

View file

@ -1,26 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="menu_loyalty" name="Loyalty"
parent="website_sale.menu_ecommerce" sequence="4"
groups="sales_team.group_sale_manager"/>
<menuitem
id="menu_discount_loyalty_type_config"
action="loyalty.loyalty_program_discount_loyalty_action"
name="Discount &amp; Loyalty"
parent="website_sale_loyalty.menu_loyalty"
groups="sales_team.group_sale_manager"
sequence="50"
/>
<menuitem
id="menu_gift_ewallet_type_config"
action="loyalty.loyalty_program_gift_ewallet_action"
name="Gift cards &amp; eWallet"
parent="website_sale_loyalty.menu_loyalty"
groups="sales_team.group_sale_manager"
sequence="51"
/>
<record id="loyalty_program_view_form_inherit_website_sale_loyalty" model="ir.ui.view">
<field name="name">loyalty.program.view.form.inherit.website.sale.loyalty</field>
@ -34,19 +13,29 @@
<attribute name="invisible">0</attribute>
</xpath>
<xpath expr="//div[@id='o_loyalty_program_availabilities']" position="inside">
<span class="d-inline-block">
<field name="ecommerce_ok" class="w-auto me-0"/>
<label for="ecommerce_ok" string="Website" class="me-3"/>
<span class="d-inline-flex text-break">
<field name="ecommerce_ok"/>
<label for="ecommerce_ok" string="Website"/>
</span>
</xpath>
<xpath expr="//div[@id='o_loyalty_program_availabilities']" position="after">
<field name="website_id" attrs="{'invisible': [('ecommerce_ok', '=', False)]}" options="{'no_create': True}" groups="website.group_multi_website" placeholder="All websites"/>
<field name="website_id" invisible="not ecommerce_ok" options="{'no_create': True}" groups="website.group_multi_website" placeholder="All websites"/>
</xpath>
<div id="trigger_products" position="inside">
<div
invisible="not show_non_published_product_warning"
class="alert alert-warning mt-1"
role="alert"
>
To be able to top up eWallet from the portal, eWallet products must be
published.
</div>
</div>
</field>
</record>
<record id="loyalty_program_view_tree_inherit_website_sale_loyalty" model="ir.ui.view">
<field name="name">loyalty.program.view.tree.inherit.website.sale.loyalty</field>
<field name="name">loyalty.program.view.list.inherit.website.sale.loyalty</field>
<field name="model">loyalty.program</field>
<field name="inherit_id" ref="loyalty.loyalty_program_view_tree"/>
<field name="arch" type="xml">
@ -54,7 +43,7 @@
<field name="website_id" options="{'no_create': True}" groups="website.group_multi_website"/>
</field>
<field name="company_id" position="after">
<button name="action_program_share" string="Share" type="object" icon="fa-share-alt" attrs="{ 'invisible' : [('program_type', '!=', 'promo_code')]}"/>
<button name="action_program_share" string="Share" type="object" icon="fa-share-alt" invisible="program_type != 'promo_code'"/>
</field>
</field>
</record>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="res_config_settings_view_form_inherit_website_sale_loyalty" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.website.sale.loyalty</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_loyalty']" position="after">
<div class="content-group">
<div class="mt8" attrs="{'invisible': [('module_loyalty', '=', False)]}">
<button name="%(loyalty.loyalty_program_discount_loyalty_action)d" icon="fa-arrow-right" type="action" string="Loyalty Programs" class="btn-link"/>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View file

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="snippet_options" inherit_id="website.snippet_options" name="Coupon Snippet Options">
<xpath expr="." position="inside">
<div data-selector="main:has(.oe_website_sale .wizard)" data-page-options="true" groups="website.group_website_designer" data-no-check="true">
<we-checkbox string="Show Discount in Subtotal"
data-customize-website-views="website_sale_loyalty.cart_discount"
data-no-preview="true"
data-reload="/"/>
</div>
</xpath>
</template>
</odoo>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="menu_loyalty"
name="Loyalty"
parent="website_sale.menu_ecommerce"
groups="sales_team.group_sale_manager"
sequence="4">
<menuitem id="menu_discount_loyalty_type_config"
action="loyalty.loyalty_program_discount_loyalty_action"/>
<menuitem id="menu_gift_ewallet_type_config"
action="loyalty.loyalty_program_gift_ewallet_action"/>
</menuitem>
</odoo>

View file

@ -8,76 +8,137 @@
</template>
<template id="modify_code_form" inherit_id="website_sale.total" name="Loyalty, coupon, gift card">
<xpath expr="//div[@id='cart_total']//table/tr[last()]" position="after">
<xpath expr="//div[contains(@t-attf-class, 'o_cart_total')]//table/tr[last()]" position="after">
<tr t-if="not hide_promotions" class="oe_website_sale_gift_card">
<td colspan="3" class="text-center text-xl-end border-0">
<td colspan="3" class="text-center text-xl-end border-0 p-0">
<span class=''>
<t t-if="request.params.get('code_not_available')">
<div class="alert alert-danger text-start mt16" role="alert">
<div class="alert alert-danger text-start small" role="alert">
Invalid or expired promo code.
</div>
</t>
<t t-if="promo_code_error">
<div class="alert alert-danger text-start mt16" role="alert">
<t t-esc="promo_code_error"/>
</div>
</t>
<t t-if="website_sale_order and promo_code_success">
<div class="alert alert-success text-start mt16" role="alert">
You have successfully applied the following code: <strong t-esc="promo_code_success"/>
<t t-if="website_sale_order.get_promo_code_error(delete=False)">
<div class="alert alert-danger text-start small" role="alert">
<t t-out="website_sale_order.get_promo_code_error()"/>
</div>
</t>
<t t-if="website_sale_order">
<t t-foreach="website_sale_order._get_claimable_rewards().items()" t-as="coupon_reward">
<t t-foreach="coupon_reward[1]" t-as="reward">
<t t-if="website_sale_order.get_promo_code_success_message(delete=False)">
<div class="alert alert-success text-start small" role="alert">
You have successfully applied the following code: <strong t-out="website_sale_order.get_promo_code_success_message()"/>
</div>
</t>
<t t-foreach="website_sale_order._get_claimable_and_showable_rewards().items()" t-as="coupon_reward">
<t t-set="coupon" t-value="coupon_reward[0]"/>
<t t-set="rewards" t-value="coupon_reward[1]"/>
<t t-set="is_loyalty" t-value="rewards[0].program_id.program_type == 'loyalty'"/>
<div
t-if="is_loyalty"
class="alert alert-primary d-flex justify-content-between align-items-center mb-0 p-2 rounded-bottom-0"
role="alert"
>
<strong class="text-start small" t-out="coupon_reward[0].point_name"/>
<strong
class="small"
name="o_loyalty_points"
t-out="website_sale_order._get_real_points_for_coupon(coupon)"
/>
</div>
<t t-foreach="rewards" t-as="reward">
<form t-att-action="'/shop/claimreward%s' % (redirect and '?r=' + redirect or '')"
method="post" name="claim_reward">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<input type="hidden" name="reward" t-att-value="reward.id"/>
<div class="alert alert-success text-start mt16" role="alert">
<div class="d-flex flex-row">
<input type="hidden" name="reward_id" t-att-value="reward.id"/>
<input type="hidden" name="code" t-att-value="coupon.code"/>
<div t-attf-class="{{'border border-primary-subtle border-top-0 p-2 text-start' if is_loyalty else 'alert alert-primary p-2 text-start'}} {{'rounded-bottom mb-3' if is_loyalty and reward_last else ''}}">
<div class="d-flex gap-2 align-items-center">
<div class="flex-grow-1 text-break">
<strong t-esc="reward.description"/>
<div t-if="reward.reward_type == 'product'"
class="mt-1 pe-3"
>
<select
t-if="reward.multi_product"
class="o_select w-100 form-select form-select-sm css_attribute_select"
name="product_id"
>
<option
t-foreach="reward.reward_product_ids"
t-as="product"
t-att-value="product.id"
>
<t t-out="product.display_name"/>
</option>
</select>
<t t-else="">
<t t-esc="reward.reward_product_ids.display_name"/>
<t t-set="program" t-value="reward.program_id"/>
<t t-set="points" t-value="coupon._format_points(website_sale_order._get_real_points_for_coupon(coupon))"/>
<t t-if="program.program_type not in ['ewallet', 'promo_code', 'loyalty'] and (program.trigger == 'with_code' or (program.trigger == 'auto' and program.applies_on == 'future'))">
<t t-if="program.program_type == 'gift_card'">
<strong class="small">
<t t-out="reward.description"/>
-
<t t-out="points"/>
</strong>
</t>
</div>
<div t-if="reward.program_id.portal_visible">
<t t-set="coupon" t-value="coupon_reward[0]"/>
<t t-if="not reward.program_id.is_nominative">
<span t-out="coupon._format_points(website_sale_order._get_real_points_for_coupon(coupon))"/>
<t t-elif="program.program_type == 'coupons'">
<strong class="small">
Coupons -
<t t-out="reward.description"/>
</strong>
</t>
<t t-else="">
<span>You have <t t-out="coupon._format_points(website_sale_order._get_real_points_for_coupon(coupon))"/></span>
<span t-if="reward.program_id.program_type == 'ewallet'"> in your ewallet</span>
<t t-if="reward.program_id.program_type != 'ewallet'">
<t t-elif="program.trigger == 'auto' and program.applies_on == 'future'">
<strong class="small" t-out="reward.description"/>
</t>
<div class="d-md-block small">
<span t-if="coupon and not coupon.program_id.is_nominative">
Code:
<t t-out="coupon.code[-4:].rjust(14, '&#8902;')"/>
</span>
<t t-if="coupon.expiration_date">
<br/>
<span>Costs <t t-out="coupon._format_points(reward.required_points)"/></span>
<span>
Expired Date:
<t t-out="coupon.expiration_date"/>
</span>
</t>
</t>
</div>
</div>
</t>
<t t-elif="program.program_type == 'promo_code'">
<strong class="small" t-out="reward.description"/>
</t>
<t t-else="">
<div
t-if="program.program_type == 'ewallet'"
class="d-flex justify-content-between align-items-center h-100 me-2"
>
<strong class="small" t-out="reward.description"/>
<strong class="small" t-out="points"/>
</div>
<strong
t-else=""
class="small"
t-out="reward.description"
/>
<div t-if="program.portal_visible">
<t t-if="not program.is_nominative">
<span t-out="points"/>
</t>
<small
t-elif="program.program_type != 'ewallet'"
t-out="coupon._format_points(reward.required_points)"
/>
</div>
</t>
<select
t-if="reward.multi_product"
class="o_select w-100 form-select form-select-sm css_attribute_select"
name="product_id"
>
<option
t-foreach="reward.reward_product_ids"
t-as="product"
t-att-value="product.id"
>
<t t-out="product.display_name"/>
</option>
</select>
</div>
<div class="justify-content-end">
<a class="btn btn-primary a-submit" href="#" role="button">
<t t-if="reward.program_id.program_type == 'ewallet'">Pay with eWallet</t>
<div class="d-flex align-items-center">
<button
type="submit"
class="btn btn-sm btn-primary"
name="o_loyalty_claim"
>
<t t-if="(reward.program_id.trigger == 'with_code' and reward.program_id.program_type != 'promo_code') or (reward.program_id.trigger == 'auto' and reward.program_id.applies_on == 'future')">
Use
</t>
<t t-else="">Claim</t>
</a>
</button>
</div>
</div>
</div>
@ -91,14 +152,8 @@
</xpath>
</template>
<template id="website_sale_coupon_cart_hide_qty" inherit_id="website_sale.cart_lines">
<xpath expr="//del" position="attributes">
<attribute name="t-if">not line.is_reward_line</attribute>
</xpath>
</template>
<template id="layout" inherit_id="website.layout">
<body position="inside">
<xpath expr="//*[@id='wrapwrap']" position="inside">
<t t-set="coupon_error" t-value="request.params.get('coupon_error')"/>
<t t-set="pending_coupon_code" t-value="request.session.get('pending_coupon_code')"/>
<t t-if="coupon_error and pending_coupon_code">
@ -111,11 +166,11 @@
<div t-if="notify_coupon" class="d-none coupon-message coupon-info-message">
<span class="coupon-message-content">The following promo code was applied on your order: <t t-out="notify_coupon"/></span>
</div>
</body>
</xpath>
</template>
<template id="cart_discount" name="Show Discount in Subtotal" active="False" inherit_id="website_sale.total">
<xpath expr="//tr[@id='order_total_untaxed']" position="before">
<xpath expr="//tr[@name='o_order_total_untaxed']" position="before">
<tr t-if="website_sale_order and website_sale_order.reward_amount">
<td class="text-end border-0 text-muted" title="Discounted amount">Discount:</td>
<td class="text-xl-end border-0 text-muted">
@ -131,37 +186,40 @@
</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.get_promo_code_error(delete=False)"/>
</xpath>
<xpath expr="//a" position="replace">
<a href="#" class="show_coupon">Discount code or gift card</a>
<xpath expr="//t[@t-set='force_coupon']" position="after">
<t t-set="_placeholder">Discount code or gift card</t>
</xpath>
</template>
<template id="cart_summary" name="Payment" inherit_id="website_sale.cart_summary">
<!-- `tax_excluded` line price -->
<xpath expr="//table[@id='cart_products']/tbody/tr/td[hasclass('td-price')]/child::*" position="attributes">
<attribute name="t-att-data-reward-type">line.reward_id.reward_type</attribute>
</xpath>
<!-- `tax_included` line price -->
<xpath expr="//table[@id='cart_products']/tbody/tr/td[hasclass('td-price')]/*[2]" position="attributes">
<template id="cart_summary" name="Payment" inherit_id="website_sale.cart_product_price">
<xpath expr="//span" position="attributes">
<attribute name="t-att-data-reward-type">line.reward_id.reward_type</attribute>
</xpath>
</template>
<template id="cart_line_product_no_link" inherit_id="website_sale.cart_line_product_link">
<xpath expr="//a" position="replace">
<t t-if="line.is_reward_line">
<strong t-field="line.name"/>
<t t-call="sale_loyalty.used_gift_card"/>
</t>
<t t-else="">$0</t>
<template
id="website_sale_loyalty.cart_lines_quantity"
inherit_id="website_sale.cart_lines_quantity"
name="Shopping Cart Lines"
>
<xpath expr="//t[@t-set='should_show_quantity_selector']" position="after">
<!-- Keep customers from changing the quantity for free product .-->
<t
t-set="should_show_quantity_selector"
t-value="should_show_quantity_selector and not line.reward_id.reward_type == 'product'"
/>
</xpath>
</template>
<template id="cart_summary_inherit_website_gift_card_sale" inherit_id="website_sale.cart_summary">
<xpath expr="//td[hasclass('td-product_name')]/div/strong" position="after">
<template id="cart_line_product_no_link" inherit_id="website_sale.cart_lines">
<xpath expr="//div[@name='o_wsale_cart_line_button_container']" position="before">
<t t-if="line.is_reward_line" t-call="sale_loyalty.used_gift_card"/>
</xpath>
</template>
<template id="cart_summary_inherit_website_gift_card_sale" inherit_id="website_sale.cart_summary_content">
<xpath expr="//td[@name='website_sale_cart_summary_product_name']/span" position="after">
<t t-call="sale_loyalty.used_gift_card"/>
</xpath>
</template>