Initial commit: Sale packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:49 +02:00
commit 14e3d26998
6469 changed files with 2479670 additions and 0 deletions

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="loyalty_card_view_form_inherit_sale_loyalty" model="ir.ui.view">
<field name="name">loyalty.card.view.form.inherit.sale.loyalty</field>
<field name="model">loyalty.card</field>
<field name="inherit_id" ref="loyalty.loyalty_card_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='partner_id']" position="after">
<field name="order_id" readonly="1" attrs="{'invisible': [('order_id', '=', False)]}" />
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="loyalty_program_view_form_inherit_sale_loyalty" model="ir.ui.view">
<field name="name">loyalty.program.view.form.inherit.sale.loyalty</field>
<field name="model">loyalty.program</field>
<field name="inherit_id" ref="loyalty.loyalty_program_view_form"/>
<field name="arch" type="xml">
<xpath expr="//label[@for='available_on']" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
<xpath expr="//div[@id='o_loyalty_program_availabilities']" position="attributes">
<attribute name="invisible">0</attribute>
</xpath>
<xpath expr="//div[@id='o_loyalty_program_availabilities']" position="inside">
<span class="d-inline-block">
<field name="sale_ok" class="w-auto me-0"/>
<label for="sale_ok" class="me-3"/>
</span>
</xpath>
</field>
</record>
<menuitem
id="menu_discount_loyalty_type_config"
action="loyalty.loyalty_program_discount_loyalty_action"
name="Discount &amp; Loyalty"
parent="sale.product_menu_catalog"
groups="sales_team.group_sale_manager"
sequence="40"
/>
<menuitem
id="menu_gift_ewallet_type_config"
action="loyalty.loyalty_program_gift_ewallet_action"
name="Gift cards &amp; eWallet"
parent="sale.product_menu_catalog"
groups="sales_team.group_sale_manager"
sequence="50"
/>
</odoo>

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="sale_order_view_form_inherit_sale_loyalty" model="ir.ui.view">
<field name="name">sale.order.view.form.inherit.sale.loyalty</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="priority">10</field>
<field name="arch" type="xml">
<xpath expr="//group[@name='note_group']" position="before">
<div class="oe_right">
<button name="%(sale_loyalty.sale_loyalty_coupon_wizard_action)d" class="btn btn-secondary"
string="Coupon Code" type="action" groups="base.group_user" states="draft,sent,sale"/>
<button name="action_open_reward_wizard" class="btn btn-secondary"
string="Promotions" type="object" groups="base.group_user" states="draft,sent,sale"
help="Update current promotional lines and select new rewards if applicable."/>
</div>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,61 @@
<?xml version="1.0" ?>
<odoo>
<template id="sale_loyalty.used_gift_card">
<div class="text-muted d-md-block small"
t-if="line.coupon_id and line.order_id != line.coupon_id.order_id and not line.coupon_id.program_id.is_nominative">
<span>
Code:
<t t-esc="line.coupon_id.code[-4:].rjust(14, '&#8902;')"/>
</span>
<t t-if="line.coupon_id.expiration_date">
<br/>
<span>
Expired Date:
<t t-esc="line.coupon_id.expiration_date"/>
</span>
</t>
</div>
</template>
<template id="sale_order_portal_content_inherit" name="Gift Card Products Portal" inherit_id="sale.sale_order_portal_content">
<xpath expr="//section[@id='details']//td[@id='product_name']/*[last()]" position="after">
<t t-if="line.coupon_id and line.coupon_id.program_id.program_type == 'gift_card'" t-call="sale_loyalty.used_gift_card"/>
</xpath>
<xpath expr="//div[@id='total']" position="after">
<t t-call="sale_loyalty.sale_purchased_gift_card">
<t t-set="order" t-value="sale_order"/>
<t t-set="hide_intro" t-value="1"/>
</t>
</xpath>
</template>
<template id="sale_purchased_gift_card">
<t t-set="gift_cards" t-value="order.coupon_point_ids.filtered(lambda pe: pe.coupon_id.program_id.program_type == 'gift_card').coupon_id"/>
<div class="card mt-3 " t-if="gift_cards and order.state in ('sale', 'done')">
<div class="card-body">
<span t-if="not hide_intro">You will find below your gift cards code. An email has been sent with it. You can use it starting right now.</span>
<table class="table text-center table-borderless">
<thead>
<tr>
<th class="fw-normal">Gift Card Code</th>
</tr>
</thead>
<tbody>
<t t-foreach="range(len(gift_cards))" t-as="gift_card_idx">
<t t-set="gift_card" t-value="gift_cards[gift_card_idx]"/>
<td class="o_purchased_gift_card">
Gift #<t t-esc="gift_card_idx + 1"/>
(<span t-esc="gift_card._format_points(order._get_real_points_for_coupon(gift_card, post_confirm=True))"/>)
<strong t-esc="gift_card.code"/>
<button class="btn btn-sm btn-secondary copy-to-clipboard" t-att-data-clipboard-text="gift_card.code">
<span class="fa fa-clipboard"/> Copy
</button>
</td>
</t>
</tbody>
</table>
</div>
</div>
</template>
</odoo>