summaryrefslogtreecommitdiff
path: root/addons/website_sale_slides/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_slides/views
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/website_sale_slides/views')
-rw-r--r--addons/website_sale_slides/views/assets.xml12
-rw-r--r--addons/website_sale_slides/views/slide_channel_views.xml46
-rw-r--r--addons/website_sale_slides/views/website_slides_menu_views.xml8
-rw-r--r--addons/website_sale_slides/views/website_slides_templates.xml166
4 files changed, 232 insertions, 0 deletions
diff --git a/addons/website_sale_slides/views/assets.xml b/addons/website_sale_slides/views/assets.xml
new file mode 100644
index 00000000..0aad00a5
--- /dev/null
+++ b/addons/website_sale_slides/views/assets.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" ?>
+<odoo>
+ <data>
+ <template id="assets_frontend" inherit_id="website.assets_frontend" name="Buy course on quiz">
+ <xpath expr="//script[last()]" position="after">
+ <script type="text/javascript" src="/website_sale_slides/static/src/js/slides_course_quiz.js"/>
+ <script type="text/javascript" src="/website_sale_slides/static/src/js/slides_course_join.js"/>
+ <script type="text/javascript" src="/website_sale_slides/static/src/js/slides_course_unsubscribe.js"/>
+ </xpath>
+ </template>
+ </data>
+</odoo>
diff --git a/addons/website_sale_slides/views/slide_channel_views.xml b/addons/website_sale_slides/views/slide_channel_views.xml
new file mode 100644
index 00000000..88a3f4ff
--- /dev/null
+++ b/addons/website_sale_slides/views/slide_channel_views.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo><data>
+ <record id="slide_channel_view_form" model="ir.ui.view">
+ <field name="name">slide.channel.view.form.inherit.sale</field>
+ <field name="model">slide.channel</field>
+ <field name="inherit_id" ref="website_slides.view_slide_channel_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='enroll']" position="after">
+ <field name="product_id"
+ attrs="{'invisible': [('enroll', '!=', 'payment')], 'required': [('enroll', '=', 'payment')]}"
+ context="{'default_type': 'service', 'default_invoice_policy': 'order', 'default_purchase_ok': False, 'default_sale_ok': True, 'default_website_published': True}"/>
+ </xpath>
+ <xpath expr="//button[@name='action_redirect_to_members']" position="after">
+ <button name="action_view_sales"
+ type="object"
+ icon="fa-signal"
+ class="oe_stat_button"
+ attrs="{'invisible': [('enroll', '!=', 'payment')]}"
+ groups="sales_team.group_sale_salesman">
+ <field name="product_sale_revenues" string="Sales" widget="statinfo"/>
+ </button>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="slide_channel_view_kanban" model="ir.ui.view">
+ <field name="name">slide.channel.view.kanban.inherit.sale</field>
+ <field name="model">slide.channel</field>
+ <field name="inherit_id" ref="website_slides.slide_channel_view_kanban"/>
+ <field name="arch" type="xml">
+ <xpath expr="//field[@name='website_published']" position="before">
+ <field name="enroll"/>
+ </xpath>
+ <xpath expr="//div[@name='info_total_time']" position="after">
+ <div class="d-flex" attrs="{'invisible': [('enroll', '!=', 'payment')]}">
+ <span class="mr-auto"><label for="product_sale_revenues" class="mb0">Sales</label></span>
+ <field name="product_sale_revenues" widget="monetary" options="{'currency_field': 'currency_id'}"/>
+ <field name="currency_id" attrs="{'invisible': True}"/>
+ </div>
+ </xpath>
+ <xpath expr="//a[@name='action_channel_invite']" position="attributes">
+ <attribute name="attrs">{'invisible': [('enroll', '=', 'payment')]}</attribute>
+ </xpath>
+ </field>
+ </record>
+</data></odoo>
diff --git a/addons/website_sale_slides/views/website_slides_menu_views.xml b/addons/website_sale_slides/views/website_slides_menu_views.xml
new file mode 100644
index 00000000..cb11ed28
--- /dev/null
+++ b/addons/website_sale_slides/views/website_slides_menu_views.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <menuitem name="Revenues"
+ id="website_slides_menu_report_revenues"
+ parent="website_slides.website_slides_menu_report"
+ sequence="3"
+ action="sale_report_action_slides"/>
+</odoo>
diff --git a/addons/website_sale_slides/views/website_slides_templates.xml b/addons/website_sale_slides/views/website_slides_templates.xml
new file mode 100644
index 00000000..6d3e5bd3
--- /dev/null
+++ b/addons/website_sale_slides/views/website_slides_templates.xml
@@ -0,0 +1,166 @@
+<?xml version="1.0" ?>
+<odoo><data>
+
+<!-- LESSON -->
+<template id="lesson_content_quiz" inherit_id="website_slides.lesson_content_quiz">
+ <xpath expr="//div[hasclass('o_wslides_js_lesson_quiz')]" position="attributes">
+ <attribute name="t-att-data-price">product_info['price'] if product_info else None</attribute>
+ <attribute name="t-att-data-currency-name">product_info['currency_id'].name if product_info else None</attribute>
+ <attribute name="t-att-data-currency-symbol">product_info['currency_id'].symbol if product_info else None</attribute>
+ <attribute name="t-att-data-has-discounted-price">product_info['has_discounted_price'] if product_info else None</attribute>
+ <attribute name="t-att-data-product-id">slide.channel_id.product_id.id if slide.channel_id.product_id else None</attribute>
+ <attribute name="t-att-data-list-price">product_info['list_price'] if product_info else None</attribute>
+ </xpath>
+</template>
+
+<template name="Buy Course To Download Resource" id="slide_aside_training_category_buy_course" inherit_id="website_slides.slide_aside_training_category">
+ <xpath expr="//div[hasclass('o_wslides_js_course_join')]" position="inside">
+ <li t-elif="aside_slide.channel_id.enroll == 'payment'" class="text-decoration-none small">
+ <i class="fa fa-download mr-1"/>
+ <t t-call="website_sale_slides.course_buy_course_link">
+ <t t-set="slide" t-value="aside_slide"/>
+ </t>
+ </li>
+ </xpath>
+</template>
+
+<template name="Buy Course To Download Resource Slide Detail" id="slide_content_detailed_buy_course" inherit_id="website_slides.slide_content_detailed">
+ <xpath expr="//div[hasclass('o_wslides_js_course_join')]" position="inside">
+ <span t-elif="slide.channel_id.enroll == 'payment'" class="text-muted mr-auto border-left pl-3">
+ <t t-call="website_sale_slides.course_buy_course_link"/>
+ </span>
+ </xpath>
+</template>
+
+<!-- Tweak "preview" badge: display Free Preview if payment-based course -->
+<template id="course_slides_list_slide"
+ name="Slide template for a training channel (Sale)"
+ inherit_id="website_slides.course_slides_list_slide">
+ <xpath expr="//a[@t-if='channel.can_upload']/span/span" position="replace">
+ <span t-if="channel.enroll == 'payment'">Free Preview</span>
+ <span t-else="">Preview</span>
+ </xpath>
+ <xpath expr="//t[@t-elif='slide.is_preview and not channel.is_member']/span/span" position="replace">
+ <span t-if="channel.enroll == 'payment'">Free Preview</span>
+ <span t-else="">Preview</span>
+ </xpath>
+</template>
+
+<!-- FULLSCREEN -->
+<template id="slide_fullscreen" inherit_id="website_slides.slide_fullscreen">
+ <xpath expr="//div[hasclass('o_wslides_fs_main')]" position="attributes">
+ <attribute name="t-att-data-price">product_info['price'] if product_info else None</attribute>
+ <attribute name="t-att-data-currency-name">product_info['currency_id'].name if product_info else None</attribute>
+ <attribute name="t-att-data-currency-symbol">product_info['currency_id'].symbol if product_info else None</attribute>
+ <attribute name="t-att-data-has-discounted-price">product_info['has_discounted_price'] if product_info else None</attribute>
+ <attribute name="t-att-data-product-id">slide.channel_id.product_id.id if product_info else None</attribute>
+ <attribute name="t-att-data-list-price">product_info['list_price'] if product_info else None</attribute>
+ </xpath>
+</template>
+
+<template name="Buy Course To Download Resource Fullscreen" id="slide_fullscreen_sidebar_category_buy_course" inherit_id="website_slides.slide_fullscreen_sidebar_category">
+ <xpath expr="//div[hasclass('o_wslides_js_course_join')]" position="inside">
+ <li t-elif="slide.channel_id.enroll == 'payment'" class="o_wslides_fs_slide_link mb-1">
+ <i class="fa fa-download mr-1"/>
+ <t t-call="website_sale_slides.course_buy_course_link"/>
+ </li>
+ </xpath>
+</template>
+
+<!-- COURSE -->
+<template name="Documentation Course Content: add Buy Button in nav" id="course_slides_cards_buy_course" inherit_id="website_slides.course_slides_cards">
+ <xpath expr="//nav[hasclass('navbar')]" position="before">
+ <div class="col-12 col-md-4 col-lg-3"
+ t-if="(not channel.is_member or channel.can_upload) and channel.enroll == 'payment'">
+ <div class="bg-white px-3 py-2 border-left border-right">
+ <div class="o_wslides_sidebar_top d-flex justify-content-between">
+ <div class="o_wslides_js_course_join flex-grow-1">
+ <t t-call="website_sale_slides.course_buy_course_button" />
+ </div>
+ <button t-attf-class="btn d-md-none bg-white ml-1 border #{'align-self-end' if channel.is_member else 'align-self-start alert'}" type="button" data-toggle="collapse" data-target="#o_wslides_sidebar_collapse" aria-expanded="false" aria-controls="o_wslides_sidebar_collapse">More info</button>
+ </div>
+ <div id="o_wslides_sidebar_collapse" class="collapse d-md-block">
+ <table class="table table-sm mt-3">
+ <tbody>
+ <tr>
+ <th class="border-top-0">Last Update</th>
+ <td class="border-top-0"><t t-esc="channel.slide_last_update" t-options="{'widget': 'date'}"/></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
+ </xpath>
+</template>
+
+<template name="Course Sidebar (infos, CTA)" id='course_sidebar' inherit_id="website_slides.course_sidebar">
+ <!-- Channel main template: override button to join channel -->
+ <xpath expr="//div[hasclass('o_wslides_js_course_join')]" position="inside">
+ <t t-if="(not channel.is_member or channel.can_publish) and channel.enroll == 'payment'">
+ <t t-call="website_sale_slides.course_buy_course_button" />
+ </t>
+ </xpath>
+</template>
+
+<!-- TOOLS -->
+<template name="Buy Course Link" id="course_buy_course_link">
+ <a t-att-href="'/shop/cart/update?product_id=%s' % slide.channel_id.product_id.id">
+ Buy Course
+ </a>
+ to download resources
+</template>
+
+<template name="Buy Course Button" id="course_buy_course_button">
+ <t t-if="channel.product_id.website_published">
+ <div t-attf-class="text-center d-flex align-items-center text-center pb-1 #{'justify-content-between' if product_info['has_discounted_price'] else 'justify-content-around'}">
+ <div class="css_editable_mode_hidden">
+ <!-- real price -->
+ <div class="oe_price font-weight-bold text-nowrap h2 my-2"
+ t-esc="product_info['price']"
+ t-options="{'widget': 'monetary', 'display_currency': product_info['currency_id']}"/>
+ <span itemprop="price" style="display:none;" t-esc="product_info['price']"/>
+ <span itemprop="priceCurrency" style="display:none;" t-esc="product_info['currency_id'].name"/>
+ <!-- original discounted price, if any -->
+ <del t-att-class="'text-600 text-nowrap oe_default_price %s' % ('' if product_info['has_discounted_price'] else 'd-none')"
+ t-esc="product_info['list_price']"
+ t-options="{'widget': 'monetary', 'display_currency': product_info['currency_id']}"/>
+ </div>
+ <div class="css_non_editable_mode_hidden decimal_precision oe_price font-weight-bold text-nowrap h2 my-2"
+ t-att-data-precision="str(product_info['currency_id'].decimal_places)">
+ <span t-field="channel.product_id.list_price" t-options="{'widget': 'monetary', 'display_currency': product_info['currency_id']}"/>
+ </div>
+ </div>
+ <div class="oe_website_sale">
+ <div class="add_to_cart_button">
+ <form action="/shop/cart/update" method="POST">
+ <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" />
+ <input type="hidden" class="product_id" name="product_id" t-att-value="channel.product_id.id"/>
+ <input type="hidden" class="product_template_id" name="product_template_id" t-att-value="channel.product_id.id"/>
+ <a id="add_to_cart" role="button" class="btn btn-primary btn-block js_check_product o_js_add_to_cart a-submit" href="#">
+ <i class="fa fa-shopping-cart"></i> Add to Cart
+ </a>
+ <div id="product_option_block"/>
+ </form>
+ </div>
+ <div class="buy_now_button"/>
+ </div>
+ </t>
+ <t t-else="">
+ <div class="alert my-0 bg-200 text-center">
+ Course Not Buyable
+ </div>
+ </t>
+</template>
+
+<template name="Allow Buy Now" id="course_option_buy_course_now" inherit_id="website_sale_slides.course_buy_course_button" active="False" customize_show="True">
+ <xpath expr="//div[hasclass('buy_now_button')]" position="inside">
+ <div style="margin-top:5px;">
+ <a role="button" class="btn btn-outline-primary btn-block post_link" t-att-href="'/shop/cart/update?product_id=%s&amp;express=1' % channel.product_id.id">
+ <i class="fa fa-bolt"></i> Buy Now
+ </a>
+ </div>
+ </xpath>
+</template>
+
+</data></odoo>