loyalty/views/loyalty_reward_views.xml

168 lines
10 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="loyalty_reward_view_form" model="ir.ui.view">
<field name="name">loyalty.reward.view.form</field>
<field name="model">loyalty.reward</field>
<field name="arch" type="xml">
<form>
<field name="program_type" invisible="1"/>
<field name="user_has_debug" invisible="1"/>
<field name="multi_product" invisible="1"/>
<field name="reward_product_uom_id" invisible="1"/>
<field name="reward_product_ids" invisible="1"/>
<field name="all_discount_product_ids" invisible="1"/>
<sheet>
<group>
<group string="Reward" name="reward_type_group">
<field name="reward_type" widget="selection" force_save="1" readonly="program_type == 'buy_x_get_y'"/>
<label for="discount" invisible="reward_type != 'discount'"/>
<div class="d-flex flex-row" invisible="reward_type != 'discount'">
<field name="discount" class="oe_inline me-1"/>
<field name="discount_mode" no_label="1" class="w-auto me-1"/>
<span>on</span>
</div>
<label for="discount_applicability" string="" invisible="reward_type != 'discount'"/>
<field name="discount_applicability" nolabel="1" widget="radio" invisible="reward_type != 'discount'"/>
</group>
<group string="Among" invisible="reward_type != 'product'">
<field name="reward_product_qty" string="Quantity rewarded"/>
<field name="reward_product_id" required="reward_type == 'product' and not reward_product_ids"/>
<field name="reward_product_tag_id" required="reward_type == 'product' and not reward_product_ids"/>
</group>
<group string="Discount" invisible="reward_type != 'discount'">
<field name="discount_max_amount"/>
<field name="discount_product_domain" groups="base.group_no_one" widget="domain" options="{'model': 'product.product', 'in_dialog': true}" invisible="discount_applicability != 'specific'"/>
<field name="discount_product_ids" widget="many2many_tags" invisible="discount_applicability != 'specific'"/>
<field name="discount_product_category_id" invisible="discount_applicability != 'specific'"/>
<field name="discount_product_tag_id" invisible="discount_applicability != 'specific'"/>
</group>
</group>
<group string="Points" invisible="not user_has_debug and program_type not in ('loyalty', 'buy_x_get_y')">
<group>
<label for="required_points" string="In exchange of"/>
<div class="o_row">
<field name="required_points" class="oe_edit_only col-2 oe_inline text-center pe-2"/>
<field name="point_name" no_label="1"/>
<span invisible="not clear_wallet"> (or more)</span>
</div>
<label for="clear_wallet" string="Clear all promo point(s)" invisible="not user_has_debug and program_type in ('loyalty', 'buy_x_get_y')"/>
<div class="o_row" invisible="not user_has_debug and program_type in ('loyalty', 'buy_x_get_y')">
<field name="clear_wallet"/>
</div>
</group>
</group>
<group>
<field name="description" string="Description on order"/>
<field name="discount_line_product_id" string="Discount product" groups="base.group_no_one"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="loyalty_reward_view_kanban" model="ir.ui.view">
<field name="name">loyalty.reward.view.kanban</field>
<field name="model">loyalty.reward</field>
<field name="arch" type="xml">
<kanban>
<field name="program_id" invisible="1"/>
<field name="company_id"/>
<field name="currency_id"/>
<field name="description"/>
<field name="reward_type"/>
<field name="discount"/>
<field name="discount_mode"/>
<field name="discount_applicability"/>
<field name="discount_product_domain"/>
<field name="discount_product_category_id"/>
<field name="discount_product_tag_id"/>
<field name="discount_max_amount"/>
<field name="discount_line_product_id"/>
<field name="reward_product_id"/>
<field name="reward_product_ids"/>
<field name="all_discount_product_ids"/>
<field name="reward_product_tag_id"/>
<field name="multi_product"/>
<field name="reward_product_qty"/>
<field name="reward_product_uom_id"/>
<field name="required_points"/>
<field name="point_name"/>
<field name="clear_wallet"/>
<field name="program_type"/>
<field name="user_has_debug"/>
<templates>
<t t-name="kanban-box">
<div class="oe_kanban_global_click_edit mx-0 d-flex flex-row">
<div class="o_loyalty_kanban_card_left mw-75 flex-grow-1" name="reward_info">
<t t-if="record.reward_type.raw_value === 'discount'">
<t t-if="record.discount">
<a><field name="discount"/><field name="discount_mode"/> discount <t t-if="record.discount_max_amount.raw_value > 0">( Max <field name="discount_max_amount"/> )</t></a>
</t>
<t t-if="record.discount_applicability.raw_value === 'specific'">
<br/>
<br/>
<span class="fw-bold text-decoration-underline">Applied to:</span>
<t t-if="record.discount_product_ids.raw_value.length > 0">
<div class="d-flex"><i class="fa fa-cube fa-fw" title="Products"/> <field name="discount_product_ids" widget="many2many_tags" class="d-inline"/></div>
</t>
<t t-if="record.discount_product_category_id.raw_value">
<div class="d-flex"><i class="fa fa-cubes fa-fw" title="Product Categories"/> <field name="discount_product_category_id" class="d-inline"/></div>
</t>
<t t-if="record.discount_product_tag_id.raw_value">
<div class="d-flex"><i class="fa fa-tags fa-fw" title="Product Tags"/> <field name="discount_product_tag_id" class="d-inline"/></div>
</t>
<t t-if="record.discount_product_domain.raw_value &amp;&amp; record.discount_product_domain.raw_value !== '[]'" groups="base.group_no_one">
<div class="d-flex"><i class="fa fa-search fa-fw" title="Product Domain"/> <field name="discount_product_domain" class="d-inline"/></div>
</t>
</t>
<t t-elif="record.discount_applicability.raw_value === 'cheapest'">
on the cheapest product
<br/>
</t>
<t t-elif="record.discount_applicability.raw_value === 'order'">
on your order
<br/>
</t>
</t>
<t t-elif="record.reward_type.raw_value === 'product'">
<a>Free product</a>
<br/>
<br/>
<t t-if="record.reward_product_id.raw_value">
<div class="d-flex"><i class="fa fa-cube fa-fw" title="Product Domain"/><field name="reward_product_id"/> <t t-if="record.reward_product_qty.raw_value > 1"><span> x </span><field name="reward_product_qty"/></t></div>
</t>
<t t-if="record.reward_product_tag_id.raw_value">
<div class="d-flex"><i class="fa fa-tags fa-fw" title="Product Tags"/> <field name="reward_product_tag_id" class="d-inline"/></div>
</t>
</t>
</div>
<div class="o_loyalty_kanban_card_right" invisible="not user_has_debug and program_type not in ('loyalty', 'buy_x_get_y')">
<p class="text-muted">
<span class="fw-bold text-decoration-underline">In exchange of</span>
<br/>
<t t-if="record.clear_wallet.raw_value">
all <field name="point_name"/> (if at least <field name="required_points"/> <field name="point_name"/>)
</t>
<t t-else="">
<field name="required_points"/> <field name="point_name"/>
</t>
</p>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
</odoo>