mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-27 17:52:01 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<record id="product_template_form_view" model="ir.ui.view">
|
||||
<field name="name">product.template.inherit.website.sale.slides</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="sale.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="service_tracking" position="attributes">
|
||||
<attribute name="invisible" remove="1" separator="or"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -7,15 +7,24 @@
|
|||
<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_detailed_type': 'course', 'default_invoice_policy': 'order', 'default_purchase_ok': False, 'default_sale_ok': True, 'default_website_published': True}"/>
|
||||
invisible="enroll != 'payment'"
|
||||
required="enroll == 'payment'"
|
||||
context="{
|
||||
'default_type': 'service',
|
||||
'default_service_tracking': 'course',
|
||||
'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-usd"
|
||||
class="oe_stat_button"
|
||||
attrs="{'invisible': [('enroll', '!=', 'payment')]}"
|
||||
invisible="enroll != 'payment'"
|
||||
groups="sales_team.group_sale_salesman">
|
||||
<field name="product_sale_revenues" string="Sales" widget="statinfo"/>
|
||||
</button>
|
||||
|
|
@ -24,12 +33,12 @@
|
|||
</record>
|
||||
|
||||
<record id="slide_channel_view_tree_report" model="ir.ui.view">
|
||||
<field name="name">slide.channel.view.tree.report.inherit.sale_slides</field>
|
||||
<field name="name">slide.channel.view.list.report.inherit.sale_slides</field>
|
||||
<field name="model">slide.channel</field>
|
||||
<field name="inherit_id" ref="website_slides.slide_channel_view_tree_report"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="members_done_count" position="after">
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="members_completed_count" position="after">
|
||||
<field name="currency_id" column_invisible="True"/>
|
||||
<field name="product_sale_revenues" string="Total Revenues" sum="Total Revenues" widget="monetary"/>
|
||||
</field>
|
||||
</field>
|
||||
|
|
@ -40,11 +49,11 @@
|
|||
<field name="model">slide.channel</field>
|
||||
<field name="inherit_id" ref="website_slides.slide_channel_view_kanban"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='info_total_time']" position="after">
|
||||
<div class="d-flex" attrs="{'invisible': [('enroll', '!=', 'payment')]}">
|
||||
<span class="me-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}"/>
|
||||
<xpath expr="//div[@name='info_avg_rating']" position="after">
|
||||
<div class="d-flex" invisible="enroll != 'payment'">
|
||||
<label for="product_sale_revenues" class="mb0 me-auto">Sales</label>
|
||||
<field class="text-nowrap" name="product_sale_revenues" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="currency_id" invisible="True"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
|
|
@ -57,8 +66,16 @@
|
|||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='allow_comment']" position="after">
|
||||
<field name="enroll" widget="radio" options="{'horizontal': true}" string="Enroll Policy"/>
|
||||
<field name="product_id" attrs="{'invisible': [('enroll', '!=', 'payment')], 'required': [('enroll', '=', 'payment')]}"
|
||||
context="{'default_detailed_type': 'course', 'default_invoice_policy': 'order', 'default_purchase_ok': False, 'default_sale_ok': True, 'default_website_published': True}"/>
|
||||
<field name="product_id" invisible="enroll != 'payment'" required="enroll == 'payment'"
|
||||
context="{
|
||||
'default_type': 'service',
|
||||
'default_service_tracking': 'course',
|
||||
'default_invoice_policy': 'order',
|
||||
'default_purchase_ok': False,
|
||||
'default_sale_ok': True,
|
||||
'default_website_published': True,
|
||||
}"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<template id="snippet_options" inherit_id="website.snippet_options" name="Slides Snippet Options">
|
||||
<xpath expr="." position="inside">
|
||||
<div data-selector="main:has(.o_wslides_course_header)" data-page-options="true" groups="website.group_website_designer" data-no-check="true" string="Course Page">
|
||||
<we-checkbox string="Buy Now Button"
|
||||
data-customize-website-views="website_sale_slides.course_option_buy_course_now"
|
||||
data-no-preview="true"
|
||||
data-reload="/"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -3,7 +3,9 @@
|
|||
|
||||
<template id="website_sale_confirmation_slide" inherit_id="website_sale.confirmation">
|
||||
<xpath expr="//div[@id='oe_structure_website_sale_confirmation_2']" position="after">
|
||||
<t t-if="any(product.detailed_type == 'course' for product in order.order_line.product_id)" t-call="website_sale_slides.course_purchased_confirmation_message"/>
|
||||
<t t-if="any(
|
||||
product.service_tracking == 'course' for product in order.order_line.product_id
|
||||
)" t-call="website_sale_slides.course_purchased_confirmation_message"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
|
@ -16,15 +18,14 @@
|
|||
</div>
|
||||
<div class="mt-2">
|
||||
<t t-foreach="order.order_line" t-as="line">
|
||||
<t t-set="signup_token" t-value="order.partner_id.signup_prepare() and order.partner_id.signup_token"/>
|
||||
<div t-foreach="line.product_id.channel_ids" t-as="course" class="row mx-0 my-2 border">
|
||||
<t t-set="slide_url" t-valuef="/web/login?token=#{signup_token}&redirect=/slides/#{slug(course)}"/>
|
||||
<div class="col-5 d-flex justify-content-center my-auto">
|
||||
<span t-if="course.image_1920" t-field="course.image_1920" t-options="{'widget': 'image', 'class': 'my-2'}"/>
|
||||
<img t-else="" class="img img-fluid my-2" src="/website_slides/static/src/img/channel-training-default.jpg"/>
|
||||
</div>
|
||||
<t t-set="invitation_link" t-value="course_memberships[course].invitation_link if course in course_memberships else ''"/>
|
||||
<div class="col-7">
|
||||
<a t-att-href="slide_url"><h3 t-out="course.name" class="m-2"/></a>
|
||||
<a t-att-href="invitation_link"><h3 t-out="course.name" class="m-2"/></a>
|
||||
<div t-out="course.description_short" class="fw-light o_wslides_desc_truncate_2 ms-2"/>
|
||||
<div class="fw-light ms-2 mt-2">
|
||||
<t t-out="course.total_time" t-options="{'widget': 'duration', 'unit': 'hour', 'round': 'minute'}"/>
|
||||
|
|
@ -32,8 +33,7 @@
|
|||
<t t-if="course.total_time"> - </t><t t-out="course.total_slides"/> step(s)
|
||||
</t>
|
||||
</div>
|
||||
|
||||
<a role="button" class="btn btn-primary ms-2 my-2" t-att-href="slide_url">
|
||||
<a role="button" class="btn btn-primary ms-2 my-2" t-attf-class="btn btn-primary ms-2 my-2 #{'disabled' if not invitation_link else ''}" t-att-href="invitation_link">
|
||||
Start Learning
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -43,13 +43,13 @@
|
|||
</template>
|
||||
|
||||
<template id="cart_summary_inherit_website_sale_slides"
|
||||
inherit_id="website_sale.cart_summary"
|
||||
inherit_id="website_sale.cart_summary_content"
|
||||
name="Course Cart right column">
|
||||
<xpath expr="//td[hasclass('td-product_name')]/div/strong" position="after">
|
||||
<xpath expr="//td[@name='website_sale_cart_summary_product_name']/span" position="after">
|
||||
<div t-if="line.product_id.channel_ids"
|
||||
t-foreach="line.product_id.channel_ids.filtered(lambda course: course.enroll == 'payment')"
|
||||
t-as="course"
|
||||
t-esc="course.name"/>
|
||||
t-out="course.name"/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
<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-currency-name">product_info['currency'].name if product_info else None</attribute>
|
||||
<attribute name="t-att-data-currency-symbol">product_info['currency'].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>
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
</template>
|
||||
|
||||
<template name="Buy Course To Access Resources or Interact Slide Detail" id="slide_content_detailed_buy_course" inherit_id="website_slides.slide_content_detailed">
|
||||
<xpath expr="//div[hasclass('o_wslides_js_course_join') and hasclass('o_wslides_no_access')]" position="inside">
|
||||
<xpath expr="//div[hasclass('o_wslides_js_course_join') and hasclass('o_wslides_no_access')] //div[@t-else='']" position="before">
|
||||
<span t-elif="slide.channel_id.enroll == 'payment'" class="text-muted me-auto border-start ps-3">
|
||||
<t t-call="website_sale_slides.course_buy_course_link">
|
||||
<t t-set="for_resources" t-value="1"/>
|
||||
|
|
@ -58,8 +58,8 @@
|
|||
<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-currency-name">product_info['currency'].name if product_info else None</attribute>
|
||||
<attribute name="t-att-data-currency-symbol">product_info['currency'].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>
|
||||
|
|
@ -83,7 +83,7 @@
|
|||
<div t-if="channel.enroll == 'payment' and not channel.product_id.is_published"
|
||||
class="alert alert-info" role="alert" groups="website_slides.group_website_slides_officer">
|
||||
This course cannot be bought because its linked product
|
||||
<a t-attf-href="/web#id=#{channel.product_id.product_tmpl_id.id}&view_type=form&model=#{channel.product_id.product_tmpl_id._name}&action=website_sale.product_template_action_website"
|
||||
<a t-attf-href="/odoo/action-website_sale.product_template_action_website/{{channel.product_id.product_tmpl_id.id}}"
|
||||
class="alert-link" t-out="channel.product_id.name"/>
|
||||
is not published.
|
||||
</div>
|
||||
|
|
@ -101,8 +101,27 @@
|
|||
|
||||
<!-- TOOLS -->
|
||||
<template name="Buy Course Link" id="course_buy_course_link">
|
||||
<a class="post_link" t-att-href="'/shop/cart/update?product_id=%s' % slide.channel_id.product_id.id">
|
||||
Join this Course</a><t t-if="for_resources"> to access resources</t>
|
||||
<form class="oe_website_sale">
|
||||
<input
|
||||
type="hidden"
|
||||
name="product_template_id"
|
||||
t-att-value="slide.channel_id.product_id.product_tmpl_id.id"
|
||||
/>
|
||||
<input
|
||||
type="hidden"
|
||||
class="product_id"
|
||||
name="product_id"
|
||||
t-att-value="slide.channel_id.product_id.id"
|
||||
/>
|
||||
<a
|
||||
id="add_to_cart"
|
||||
role="button"
|
||||
class="btn btn-primary d-block"
|
||||
>
|
||||
Join this Course
|
||||
</a>
|
||||
<t t-if="for_resources"> to access resources</t>
|
||||
</form>
|
||||
</template>
|
||||
|
||||
<template name="Buy Course Button" id="course_buy_course_button">
|
||||
|
|
@ -111,33 +130,68 @@
|
|||
<div class="css_editable_mode_hidden">
|
||||
<!-- real price -->
|
||||
<div t-attf-class="oe_price fw-bold text-nowrap my-2 #{'h4' if len(str(product_info['price'])) > 10 else 'h2'}"
|
||||
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"/>
|
||||
t-out="product_info['price']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': product_info['currency']}"/>
|
||||
<span itemprop="price" style="display:none;" t-out="product_info['price']"/>
|
||||
<span itemprop="priceCurrency" style="display:none;" t-out="product_info['currency'].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']}"/>
|
||||
t-out="product_info['list_price']"
|
||||
t-options="{'widget': 'monetary', 'display_currency': product_info['currency']}"/>
|
||||
</div>
|
||||
<div class="css_non_editable_mode_hidden decimal_precision oe_price fw-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']}"/>
|
||||
t-att-data-precision="str(product_info['currency'].decimal_places)">
|
||||
<span t-field="channel.product_id.list_price" t-options="{'widget': 'monetary', 'display_currency': product_info['currency']}"/>
|
||||
</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"/>
|
||||
<a id="add_to_cart" role="button" href="#"
|
||||
class="btn btn-primary d-block js_check_product o_js_add_to_cart a-submit"
|
||||
data-animation-selector=".o_wslides_course_pict">
|
||||
<i class="fa fa-shopping-cart"></i> Add to Cart
|
||||
</a>
|
||||
<div id="product_option_block"/>
|
||||
</form>
|
||||
</div>
|
||||
<t t-if="not invite_preview and channel.prerequisite_channel_ids and not channel.prerequisite_user_has_completed">
|
||||
<small t-if="len(channel.prerequisite_channel_ids) == 1" class="text-center mb-2">
|
||||
Prerequisite:
|
||||
<a t-attf-href="/slides/{{channel.prerequisite_channel_ids[0].id}}"
|
||||
t-out="channel.prerequisite_channel_ids[0].name"/>
|
||||
</small>
|
||||
<small t-else="" class="text-center mb-2">
|
||||
There are some
|
||||
<a href="#" class="o_wslides_js_prerequisite_course"
|
||||
t-att-data-channels="json.dumps([
|
||||
{'course_id': course.id, 'course_name': course.name}
|
||||
for course in channel.prerequisite_channel_ids]
|
||||
)">
|
||||
prerequisite courses.
|
||||
</a>
|
||||
</small>
|
||||
</t>
|
||||
<t t-if="invite_preview">
|
||||
<a type="button" class="btn btn-primary text-uppercase ms-2"
|
||||
t-att-aria-label="'Sign up' if is_partner_without_user else 'Log in'"
|
||||
t-attf-href="/slides/#{channel.id}/identify?#{keep_query('invite_partner_id', 'invite_hash')}">
|
||||
<t t-if="is_partner_without_user">Sign up</t>
|
||||
<t t-else="">Log in</t>
|
||||
</a>
|
||||
</t>
|
||||
<div t-else="" class="oe_website_sale">
|
||||
<form>
|
||||
<input
|
||||
type="hidden"
|
||||
name="product_template_id"
|
||||
t-att-value="channel.product_id.product_tmpl_id.id"
|
||||
/>
|
||||
<input
|
||||
type="hidden"
|
||||
class="product_id"
|
||||
name="product_id"
|
||||
t-att-value="channel.product_id.id"
|
||||
/>
|
||||
<a
|
||||
id="add_to_cart"
|
||||
role="button"
|
||||
class="btn btn-primary d-block"
|
||||
>
|
||||
<i class="fa fa-shopping-cart"></i> Add to Cart
|
||||
</a>
|
||||
<!-- Hook for wishlist -->
|
||||
<div id="product_option_block"/>
|
||||
</form>
|
||||
</div>
|
||||
</t>
|
||||
<t t-elif="not channel.is_member">
|
||||
|
|
@ -148,15 +202,16 @@
|
|||
</template>
|
||||
|
||||
<template name="Display 'Buy Now'" id="course_option_buy_course_now" inherit_id="website_sale_slides.course_buy_course_button" active="False">
|
||||
<xpath expr="//div[hasclass('add_to_cart_button')]" position="before">
|
||||
<div class="mb-1">
|
||||
<a role="button" class="post_link btn btn-primary d-block" t-attf-href="/shop/cart/update?product_id={{channel.product_id.id}}&express=1">
|
||||
<i class="fa fa-bolt"></i> Buy Now
|
||||
</a>
|
||||
</div>
|
||||
<xpath expr="//form//a[@id='add_to_cart']" position="before">
|
||||
<a
|
||||
role="button"
|
||||
class="btn btn-primary d-block o_we_buy_now mb-1"
|
||||
>
|
||||
<i class="fa fa-bolt"></i> Buy Now
|
||||
</a>
|
||||
</xpath>
|
||||
<xpath expr="//div[hasclass('add_to_cart_button')]//a[@id='add_to_cart']" position="attributes">
|
||||
<attribute name="class">btn btn-outline-primary d-block js_check_product o_js_add_to_cart a-submit</attribute>
|
||||
<xpath expr="//form//a[@id='add_to_cart']" position="attributes">
|
||||
<attribute name="class" remove="btn-primary" add="btn-outline-primary" separator=" "/>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue