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,11 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_tests" inherit_id="web.assets_tests" name="Website Event Sale Assets Tests">
<xpath expr="." position="inside">
<script type="text/javascript" src="/website_event_sale/static/tests/tours/website_event_sale.js"></script>
<script type="text/javascript" src="/website_event_sale/static/tests/tours/website_event_sale_last_ticket.js"></script>
</xpath>
</template>
</odoo>

View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="event_form_mandatory_company" model="ir.ui.view">
<field name="name">event.event.view.form.inherit.company.mandatory</field>
<field name="model">event.event</field>
<field name="inherit_id" ref="event.view_event_form"/>
<field name="arch" type="xml">
<xpath expr="//group//field[@name='company_id']" position="attributes">
<attribute name="required">1</attribute>
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="registration_template" inherit_id="website_event.registration_template">
<!-- Add price information on tickets (multi tickets, aka in collapse) -->
<xpath expr="//div[hasclass('o_wevent_registration_multi_select')]" position="inside">
<t t-if="ticket.price">
<t t-if="(ticket.price - ticket.price_reduce) &gt; 1 and website.pricelist_id.discount_policy == 'without_discount'">
<del class="text-danger me-1" t-field="ticket.price" t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.pricelist_id.currency_id}"/>
</t>
<span t-field="ticket.price_reduce"
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.pricelist_id.currency_id}"
groups="account.group_show_line_subtotals_tax_excluded"/>
<span t-field="ticket.price_reduce_taxinc"
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.pricelist_id.currency_id}"
groups="account.group_show_line_subtotals_tax_included"/>
<span itemprop="price" class="d-none" t-out="ticket.price"/>
<span itemprop="priceCurrency" class="d-none" t-out="website.pricelist_id.currency_id.name"/>
</t>
<span t-else="" class="fw-bold text-uppercase">Free</span>
</xpath>
<xpath expr="//div[hasclass('o_wevent_price_range')]" position="inside">
<t t-if="event.event_ticket_ids[-1].price_reduce > 0">
<span class="text-dark">
From
<span t-out="event.event_ticket_ids[0].price_reduce" t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.pricelist_id.currency_id}"/>
<t t-if="event.event_ticket_ids[-1].price_reduce != event.event_ticket_ids[0].price_reduce">
to
<span t-out="event.event_ticket_ids[-1].price_reduce" t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.pricelist_id.currency_id}"/>
</t>
</span>
</t>
</xpath>
<!-- Add price information on tickets (mono ticket, aka not in collapse) -->
<xpath expr="//div[hasclass('o_wevent_registration_single')]//h6" position="after">
<div class="px-2 text-dark d-flex align-items-center align-self-stretch">
<t t-if="tickets.price">
<t t-if="(tickets.price - tickets.price_reduce) &gt;1 and website.get_current_pricelist().discount_policy == 'without_discount'">
<del class="text-danger me-1" t-field="tickets.price" t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.pricelist_id.currency_id}"/>
</t>
<span t-field="tickets.price_reduce"
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.pricelist_id.currency_id}"
groups="account.group_show_line_subtotals_tax_excluded"/>
<span t-field="tickets.price_reduce_taxinc"
t-options="{'widget': 'monetary', 'from_currency': event.company_id.sudo().currency_id, 'display_currency': website.pricelist_id.currency_id}"
groups="account.group_show_line_subtotals_tax_included"/>
<span itemprop="price" class="d-none" t-out="tickets.price"/>
<span itemprop="priceCurrency" class="d-none" t-out="website.pricelist_id.currency_id.name"/>
</t>
<span t-else="" class="fw-bold text-uppercase">Free</span>
</div>
</xpath>
</template>
</odoo>

View file

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- If the sale order line concerns an event, we want the "product" link to point to the event itself and not to the product on the ecommerce -->
<template id="cart_line_product_link_inherit_website_event_sale" inherit_id="website_sale.cart_line_product_link" name="Event Shopping Cart Line Product Link">
<xpath expr="//a" position="attributes">
<attribute name="t-attf-href"/>
<attribute name="t-att-href">
line.event_id and ('/event/%s/register' % slug(line.event_id)) or line.product_id.website_url
</attribute>
</xpath>
</template>
<!-- If the sale order line concerns an event, we want to show an additional line with the event name even on small screens -->
<template id="cart_lines_inherit_website_event_sale" inherit_id="website_sale.cart_lines" name="Event Shopping Cart Lines">
<xpath expr="//t[@t-call='website_sale.cart_line_description_following_lines']/t[@t-set='div_class']" position="after">
<t t-if="line.event_id">
<t t-set="div_class" t-value="''"/>
</t>
</xpath>
<xpath expr="//del" position="attributes">
<attribute name="t-attf-class" separator=" " add="#{line.event_id and 'd-none' or ''}"/>
</xpath>
</template>
<!-- If the sale order line concerns an event, we want to show an additional line with the event name -->
<template id="cart_popover_inherit_website_event_sale" inherit_id="website_sale.cart_popover" name="Event Cart Popover">
<xpath expr="//t[@t-call='website_sale.cart_line_product_link']" position="after">
<t t-if="line.event_id" t-call="website_sale.cart_line_description_following_lines"/>
</xpath>
</template>
<!-- If the sale order line concerns an event, we want to show an additional line with the event name -->
<template id="cart_summary_inherit_website_event_sale" inherit_id="website_sale.cart_summary" name="Event Cart right column">
<xpath expr="//td[hasclass('td-product_name')]/div/strong" position="after">
<t t-if="line.event_id" t-call="website_sale.cart_line_description_following_lines"/>
</xpath>
</template>
<template id="event_confirmation" inherit_id="website_sale.confirmation">
<xpath expr="//div[@id='oe_structure_website_sale_confirmation_2']" position="inside">
<t t-if="events">
<section class="s_title pt40" data-snippet="s_title" data-name="Title">
<div class="s_allow_columns container">
<h4>
We are looking forward to meeting you at the following <t t-if="len(events) == 1">event</t><t t-else="">events</t>:
</h4>
</div>
</section>
<section class="pb32 o_cc o_cc2 o_colored_level bg-transparent">
<div class="s_nb_column_fixed s_col_no_bgcolor o_wevent_index" t-foreach="events" t-as="event">
<div class="col-lg-12 card mt-3 mx-auto item pt16 pb16">
<div class="row s_col_no_bgcolor g-0 align-items-center o_cc1">
<div class="col-lg-4 align-self-stretch d-block o_wevent_events_list">
<t t-call="website.record_cover">
<t t-set="_record" t-value="event" />
<div class="o_wevent_event_date position-absolute bg-white shadow-sm text-dark">
<span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'format': 'LLL'}" class="o_wevent_event_month" />
<span t-field="event.with_context(tz=event.date_tz).date_begin" t-options="{'format': 'dd'}" class="o_wevent_event_day oe_hide_on_date_edit" />
</div>
<small class="o_wevent_participating text-bg-success">
<i class="fa fa-check me-2" />
Registered
</small>
<small t-if="not event.website_published" class="o_wevent_unpublished text-bg-danger">
<i class="fa fa-ban me-2" />
Unpublished
</small>
</t>
</div>
<div class="col-lg-8 p-4">
<h3 t-esc="event.name" />
<a class="btn btn-primary mb-2" t-attf-href="/event/#{ slug(event) }">Go to Event</a>
</div>
</div>
</div>
</div>
</section>
</t>
</xpath>
</template>
</odoo>