mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] Conflict Merge Folio view button
This commit is contained in:
@@ -2,4 +2,5 @@
|
||||
|
||||
from . import models
|
||||
from . import wizards
|
||||
from . import controllers
|
||||
from .init_hook import post_init_hook
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
"views/webclient_templates.xml",
|
||||
"views/ir_sequence_views.xml",
|
||||
"views/account_journal_views.xml",
|
||||
"views/folio_portal_templates.xml",
|
||||
"views/reservation_portal_templates.xml",
|
||||
"wizards/wizard_reservation.xml",
|
||||
"wizards/wizard_massive_changes.xml",
|
||||
"wizards/wizard_advanced_filters.xml",
|
||||
|
||||
1
pms/controllers/__init__.py
Normal file
1
pms/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import pms_portal
|
||||
220
pms/controllers/pms_portal.py
Normal file
220
pms/controllers/pms_portal.py
Normal file
@@ -0,0 +1,220 @@
|
||||
from odoo import _, http
|
||||
from odoo.exceptions import AccessError, MissingError
|
||||
from odoo.http import request
|
||||
|
||||
from odoo.addons.portal.controllers.portal import CustomerPortal, pager as portal_pager
|
||||
|
||||
|
||||
class PortalFolio(CustomerPortal):
|
||||
def _prepare_home_portal_values(self, counters):
|
||||
partner = request.env.user.partner_id
|
||||
values = super()._prepare_home_portal_values(counters)
|
||||
Folio = request.env["pms.folio"]
|
||||
if "folio_count" in counters:
|
||||
values["folio_count"] = (
|
||||
Folio.search_count(
|
||||
[
|
||||
("partner_id", "=", partner.id),
|
||||
]
|
||||
)
|
||||
if Folio.check_access_rights("read", raise_exception=False)
|
||||
else 0
|
||||
)
|
||||
return values
|
||||
|
||||
def _folio_get_page_view_values(self, folio, access_token, **kwargs):
|
||||
values = {"folio": folio, "token": access_token}
|
||||
return self._get_page_view_values(
|
||||
folio, access_token, values, "my_folios_history", False, **kwargs
|
||||
)
|
||||
|
||||
@http.route(
|
||||
["/my/folios", "/my/folios/page/<int:page>"],
|
||||
type="http",
|
||||
auth="user",
|
||||
website=True,
|
||||
)
|
||||
def portal_my_folios(
|
||||
self, page=1, date_begin=None, date_end=None, sortby=None, filterby=None, **kw
|
||||
):
|
||||
partner = request.env.user.partner_id
|
||||
values = self._prepare_portal_layout_values()
|
||||
PmsFolio = request.env["pms.folio"]
|
||||
values["folios"] = PmsFolio.search(
|
||||
[
|
||||
("partner_id", "child_of", partner.id),
|
||||
]
|
||||
)
|
||||
domain = [
|
||||
("partner_id", "child_of", partner.id),
|
||||
]
|
||||
searchbar_sortings = {
|
||||
"date": {"label": _("Order Date"), "folio": "date_order desc"},
|
||||
"name": {"label": _("Reference"), "folio": "name"},
|
||||
"stage": {"label": _("Stage"), "folio": "state"},
|
||||
}
|
||||
if not sortby:
|
||||
sortby = "date"
|
||||
sort_order = searchbar_sortings[sortby]["folio"]
|
||||
|
||||
if date_begin and date_end:
|
||||
domain += [
|
||||
("create_date", ">", date_begin),
|
||||
("create_date", "<=", date_end),
|
||||
]
|
||||
folio_count = PmsFolio.search_count(domain)
|
||||
pager = portal_pager(
|
||||
url="/my/folios",
|
||||
url_args={"date_begin": date_begin, "date_end": date_end, "sortby": sortby},
|
||||
total=folio_count,
|
||||
page=page,
|
||||
step=self._items_per_page,
|
||||
)
|
||||
folios = PmsFolio.search(
|
||||
domain, order=sort_order, limit=self._items_per_page, offset=pager["offset"]
|
||||
)
|
||||
request.session["my_folios_history"] = folios.ids[:100]
|
||||
values.update(
|
||||
{
|
||||
"date": date_begin,
|
||||
"folios": folios.sudo(),
|
||||
"page_name": "folios",
|
||||
"pager": pager,
|
||||
"default_url": "/my/folios",
|
||||
"searchbar_sortings": searchbar_sortings,
|
||||
"sortby": sortby,
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_folio", values)
|
||||
|
||||
@http.route(["/my/folios/<int:folio_id>"], type="http", auth="user", website=True)
|
||||
def portal_my_folio_detail(
|
||||
self, folio_id, access_token=None, report_type=None, download=False, **kw
|
||||
):
|
||||
try:
|
||||
folio_sudo = self._document_check_access(
|
||||
"pms.folio",
|
||||
folio_id,
|
||||
access_token=access_token,
|
||||
)
|
||||
except (AccessError, MissingError):
|
||||
return request.redirect("/my")
|
||||
if report_type in ("html", "pdf", "text"):
|
||||
return self._show_report(
|
||||
model=folio_sudo,
|
||||
report_type=report_type,
|
||||
report_ref="pms.action_report_folio",
|
||||
download=download,
|
||||
)
|
||||
values = self._folio_get_page_view_values(folio_sudo, access_token, **kw)
|
||||
return request.render("pms.folio_portal_template", values)
|
||||
|
||||
|
||||
class PortalReservation(CustomerPortal):
|
||||
def _prepare_home_portal_values(self, counters):
|
||||
partner = request.env.user.partner_id
|
||||
values = super()._prepare_home_portal_values(counters)
|
||||
Reservation = request.env["pms.reservation"]
|
||||
if "reservation_count" in counters:
|
||||
values["reservation_count"] = (
|
||||
Reservation.search_count(
|
||||
[
|
||||
("partner_id", "=", partner.id),
|
||||
]
|
||||
)
|
||||
if Reservation.check_access_rights("read", raise_exception=False)
|
||||
else 0
|
||||
)
|
||||
return values
|
||||
|
||||
def _reservation_get_page_view_values(self, reservation, access_token, **kwargs):
|
||||
values = {"reservation": reservation, "token": access_token}
|
||||
return self._get_page_view_values(
|
||||
reservation,
|
||||
access_token,
|
||||
values,
|
||||
"my_reservations_history",
|
||||
False,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
@http.route(
|
||||
["/my/reservations", "/my/reservations/page/<int:page>"],
|
||||
type="http",
|
||||
auth="user",
|
||||
website=True,
|
||||
)
|
||||
def portal_my_reservations(
|
||||
self, page=1, date_begin=None, date_end=None, sortby=None, filterby=None, **kw
|
||||
):
|
||||
partner = request.env.user.partner_id
|
||||
values = self._prepare_portal_layout_values()
|
||||
Reservation = request.env["pms.reservation"]
|
||||
values["reservations"] = Reservation.search(
|
||||
[
|
||||
("partner_id", "child_of", partner.id),
|
||||
]
|
||||
)
|
||||
domain = [
|
||||
("partner_id", "child_of", partner.id),
|
||||
]
|
||||
# searchbar_sortings = {
|
||||
# "date": {"label": _("Order Date"), "reservation": "date_order desc"},
|
||||
# "name": {"label": _("Reference"), "reservation": "name"},
|
||||
# "stage": {"label": _("Stage"), "reservation": "state"},
|
||||
# }
|
||||
# if not sortby:
|
||||
# sortby = "date"
|
||||
# sort_order = searchbar_sortings[sortby]["reservation"]
|
||||
|
||||
if date_begin and date_end:
|
||||
domain += [
|
||||
("create_date", ">", date_begin),
|
||||
("create_date", "<=", date_end),
|
||||
]
|
||||
reservation_count = Reservation.search_count(domain)
|
||||
pager = portal_pager(
|
||||
url="/my/reservations",
|
||||
url_args={"date_begin": date_begin, "date_end": date_end},
|
||||
total=reservation_count,
|
||||
page=page,
|
||||
step=self._items_per_page,
|
||||
)
|
||||
reservations = Reservation.search(
|
||||
domain, limit=self._items_per_page, offset=pager["offset"]
|
||||
)
|
||||
request.session["my_reservations_history"] = reservations.ids[:100]
|
||||
values.update(
|
||||
{
|
||||
"date": date_begin,
|
||||
"reservations": reservations.sudo(),
|
||||
"page_name": "reservations",
|
||||
"pager": pager,
|
||||
"default_url": "/my/reservations",
|
||||
# "searchbar_sortings": searchbar_sortings,
|
||||
# "sortby": sortby,
|
||||
}
|
||||
)
|
||||
return request.render("pms.portal_my_reservation", values)
|
||||
|
||||
@http.route(
|
||||
["/my/reservations/<int:reservation_id>"],
|
||||
type="http",
|
||||
auth="user",
|
||||
website=True,
|
||||
)
|
||||
def portal_my_reservation_detail(self, reservation_id, access_token=None, **kw):
|
||||
try:
|
||||
reservation_sudo = self._document_check_access(
|
||||
"pms.reservation",
|
||||
reservation_id,
|
||||
access_token=access_token,
|
||||
)
|
||||
except (AccessError, MissingError):
|
||||
return request.redirect("/my")
|
||||
# for attachment in reservation_sudo.attachment_ids:
|
||||
# attachment.generate_access_token()
|
||||
values = self._reservation_get_page_view_values(
|
||||
reservation_sudo, access_token, **kw
|
||||
)
|
||||
return request.render("pms.portal_my_reservation_detail", values)
|
||||
@@ -553,6 +553,19 @@ class PmsFolio(models.Model):
|
||||
order.move_ids = invoices
|
||||
order.invoice_count = len(invoices)
|
||||
|
||||
def _compute_access_url(self):
|
||||
super(PmsFolio, self)._compute_access_url()
|
||||
for folio in self:
|
||||
folio.access_url = "/my/folios/%s" % (folio.id)
|
||||
|
||||
def preview_folio(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
"type": "ir.actions.act_url",
|
||||
"target": "self",
|
||||
"url": self.get_portal_url(),
|
||||
}
|
||||
|
||||
def _search_invoice_ids(self, operator, value):
|
||||
if operator == "in" and value:
|
||||
self.env.cr.execute(
|
||||
@@ -757,6 +770,9 @@ class PmsFolio(models.Model):
|
||||
record.max_reservation_prior = max(reservation_priors)
|
||||
|
||||
# Action methods
|
||||
def _get_report_base_filename(self):
|
||||
self.ensure_one()
|
||||
return "Folio %s" % self.name
|
||||
|
||||
def action_pay(self):
|
||||
self.ensure_one()
|
||||
|
||||
@@ -846,6 +846,19 @@ class PmsReservation(models.Model):
|
||||
else False
|
||||
)
|
||||
|
||||
def _compute_access_url(self):
|
||||
super(PmsReservation, self)._compute_access_url()
|
||||
for reservation in self:
|
||||
reservation.access_url = "/my/reservations/%s" % (reservation.id)
|
||||
|
||||
def preview_reservation(self):
|
||||
self.ensure_one()
|
||||
return {
|
||||
"type": "ir.actions.act_url",
|
||||
"target": "self",
|
||||
"url": self.get_portal_url(),
|
||||
}
|
||||
|
||||
def _search_left_for_checkin(self, operator, value):
|
||||
if operator not in ("=",):
|
||||
raise UserError(
|
||||
|
||||
@@ -61,3 +61,5 @@ user_access_pms_invoice_filter_days,user_access_pms_invoice_filter_days,model_pm
|
||||
user_access_pms_invoice_filter_days_items,user_access_pms_invoice_filter_days_items,model_pms_invoice_filter_days_items,pms.group_pms_user,1,1,1,1
|
||||
user_access_wizard_payment_folio,user_access_wizard_payment_folio,model_wizard_payment_folio,pms.group_pms_user,1,1,1,1
|
||||
user_access_wizard_folio_changes,user_access_wizard_folio_changes,model_wizard_folio_changes,pms.group_pms_user,1,1,1,1
|
||||
user_access_pms_folio_portal,user_access_pms_folio_portal,model_pms_folio,base.group_portal,1,0,0,0
|
||||
user_access_pms_reservation_portal,user_access_pms_reservation_portal,model_pms_reservation,base.group_portal,1,0,0,0
|
||||
|
||||
|
@@ -223,5 +223,19 @@
|
||||
user.get_active_property_ids())]
|
||||
</field>
|
||||
</record>
|
||||
<record id="pms_folio_rule_portal" model="ir.rule">
|
||||
<field name="name">Portal Personal Folios</field>
|
||||
<field name="model_id" ref="model_pms_folio" />
|
||||
<field name="domain_force">[]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]" />
|
||||
<field name="perm_read" eval="True" />
|
||||
</record>
|
||||
<record id="pms_reservation_rule_portal" model="ir.rule">
|
||||
<field name="name">Portal Personal Reservation</field>
|
||||
<field name="model_id" ref="model_pms_reservation" />
|
||||
<field name="domain_force">[]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_portal'))]" />
|
||||
<field name="perm_read" eval="True" />
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
470
pms/views/folio_portal_templates.xml
Normal file
470
pms/views/folio_portal_templates.xml
Normal file
@@ -0,0 +1,470 @@
|
||||
<odoo>
|
||||
<template
|
||||
id="portal_my_home_menu_folio"
|
||||
name="Portal layout : folio menu entries"
|
||||
inherit_id="portal.portal_breadcrumbs"
|
||||
priority="20"
|
||||
>
|
||||
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
|
||||
<li
|
||||
t-if="page_name == 'folios'"
|
||||
t-attf-class="breadcrumb-item #{'active ' if not folios else ''}"
|
||||
>
|
||||
<a t-attf-href="/my/folios?{{ keep_query() }}">Folios</a>
|
||||
</li>
|
||||
<li t-if="folio" class="breadcrumb-item active">
|
||||
<a t-attf-href="/my/folios?{{ keep_query() }}">Folios/</a>
|
||||
<t t-esc="folio.name" />
|
||||
</li>
|
||||
</xpath>
|
||||
</template>
|
||||
<template
|
||||
id="portal_my_folios"
|
||||
name="Folios"
|
||||
inherit_id="portal.portal_my_home"
|
||||
customize_show="True"
|
||||
priority="30"
|
||||
>
|
||||
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
|
||||
<t t-call="portal.portal_docs_entry">
|
||||
<t t-set="title">Folios</t>
|
||||
<t t-set="url" t-value="'/my/folios'" />
|
||||
<t t-set="placeholder_count" t-value="'folio_count'" />
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
|
||||
<template id="portal_my_folio" name="My Folios">
|
||||
<t t-call="portal.portal_layout">
|
||||
<t t-set="breadcrumbs_searchbar" t-value="True" />
|
||||
|
||||
<t t-call="portal.portal_searchbar">
|
||||
<t t-set="title">Folios</t>
|
||||
</t>
|
||||
<t t-if="not folios">
|
||||
<p>There are currently no folios for your account.</p>
|
||||
</t>
|
||||
<t t-if="folios" t-call="portal.portal_table">
|
||||
<thead>
|
||||
<tr class="active">
|
||||
<th>Folio #</th>
|
||||
<th>Order Date</th>
|
||||
<th class="text-right">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="folios" t-as="folio">
|
||||
<tr>
|
||||
<td>
|
||||
<a
|
||||
t-att-href="folio.get_portal_url()"
|
||||
t-att-title="folio.name"
|
||||
>
|
||||
<t t-esc="folio.name" />
|
||||
</a>
|
||||
</td>
|
||||
<td><span t-field="folio.date_order" /></td>
|
||||
<td class="text-right"><span
|
||||
t-field="folio.amount_total"
|
||||
/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
<template
|
||||
id="folio_portal_template"
|
||||
name="Folio Portal Template"
|
||||
inherit_id="portal.portal_sidebar"
|
||||
primary="True"
|
||||
>
|
||||
<xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
|
||||
|
||||
<div class="row mt16 o_portal_sale_sidebar">
|
||||
<!-- Sidebar -->
|
||||
<t t-call="portal.portal_record_sidebar">
|
||||
<t t-set="classes" t-value="'col-lg-auto d-print-none'" />
|
||||
|
||||
<t t-set="title">
|
||||
<h2 class="mb-0"><b t-field="folio.amount_total" /> </h2>
|
||||
</t>
|
||||
<t t-set="entries">
|
||||
<ul
|
||||
class="list-group list-group-flush flex-wrap flex-row flex-lg-column"
|
||||
>
|
||||
<li class="list-group-item flex-grow-1">
|
||||
<div class="o_download_pdf btn-toolbar flex-sm-nowrap">
|
||||
<div class="btn-group flex-grow-1 mr-1 mb-1">
|
||||
<a
|
||||
class="btn btn-secondary btn-block o_download_btn"
|
||||
t-att-href="folio.get_portal_url(report_type='pdf', download=True)"
|
||||
title="Download"
|
||||
><i class="fa fa-download" /> Download</a>
|
||||
</div>
|
||||
<div class="btn-group flex-grow-1 mb-1">
|
||||
<a
|
||||
class="btn btn-secondary btn-block o_print_btn o_portal_invoice_print"
|
||||
t-att-href="folio.get_portal_url(report_type='pdf')"
|
||||
id="print_folio_report"
|
||||
title="Print"
|
||||
target="_blank"
|
||||
><i class="fa fa-print" /> Print</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<li
|
||||
t-if="folio.user_id.name"
|
||||
class="list-group-item flex-grow-1"
|
||||
>
|
||||
<div class="small mb-1"><strong
|
||||
class="text-muted"
|
||||
>Salesperson</strong></div>
|
||||
<div class="row flex-nowrap">
|
||||
<div class="col flex-grow-0 pr-2">
|
||||
<img
|
||||
class="rounded-circle mr4 float-left o_portal_contact_img"
|
||||
t-if="folio.user_id.image_1024"
|
||||
t-att-src="image_data_uri(folio.user_id.image_1024)"
|
||||
alt="Contact"
|
||||
/>
|
||||
<img
|
||||
class="rounded-circle mr4 float-left o_portal_contact_img"
|
||||
t-if="not folio.user_id.image_1024"
|
||||
src="/web/static/src/img/placeholder.png"
|
||||
alt="Contact"
|
||||
/>
|
||||
</div>
|
||||
<div class="col pl-0" style="min-width: 150px">
|
||||
<span
|
||||
t-field="folio.user_id"
|
||||
t-options='{"widget": "contact", "fields": ["name", "phone"], "no_marker": True}'
|
||||
/>
|
||||
<a href="#discussion" class="small"><i
|
||||
class="fa fa-comment"
|
||||
/> Send message</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</t>
|
||||
</t>
|
||||
<!-- main content-->
|
||||
<div t-attf-class="card col-8 p-3" id="portal_folio_content">
|
||||
<div t-call="pms.folio_portal_content" />
|
||||
</div>
|
||||
<!-- chatter -->
|
||||
<div class="col-3" />
|
||||
<div id="folio_communication" class="mt-4 col-8">
|
||||
<h2>History</h2>
|
||||
<t t-call="portal.message_thread">
|
||||
<t t-set="object" t-value="folio" />
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!--
|
||||
Sales Order content : intro, informations, order lines, remarks, descriptions ....
|
||||
This template should contains all the printable element of the SO. This is the
|
||||
template rendered in PDF with the report engine.
|
||||
-->
|
||||
<template id="folio_portal_content" name="Folio Portal Content">
|
||||
<t t-set="address">
|
||||
<div
|
||||
class="row pb-2 pt-3 #{'card-header bg-white' if report_type == 'html' else ''}"
|
||||
>
|
||||
<div class="col-xs-6">
|
||||
<t t-if="folio.partner_invoice_ids[0] != folio.partner_id">
|
||||
<div
|
||||
t-field="folio.partner_invoice_ids"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'
|
||||
/>
|
||||
</t>
|
||||
</div>
|
||||
<div class="col-xs-5 col-xs-offset-1">
|
||||
<div
|
||||
t-field="folio.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}'
|
||||
/>
|
||||
<p t-if="folio.partner_id.vat">
|
||||
<t t-esc="folio.company_id.country_id.vat_label or 'TIN'" />
|
||||
:
|
||||
<span t-field="folio.partner_id.vat" />
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<div class="page">
|
||||
<div class="oe_structure" />
|
||||
|
||||
<h2 class="mt16">
|
||||
<span t-if="folio.state not in ['draft','sent']">Order #</span>
|
||||
<span t-if="folio.state in ['draft','sent']">Quotation #</span>
|
||||
<span t-field="folio.name" />
|
||||
</h2>
|
||||
|
||||
<div class="row mt32 mb32" id="informations">
|
||||
<div t-if="folio.client_order_ref" class="mb-3 col-6">
|
||||
<strong>Your Reference:</strong>
|
||||
<p class="m-0" t-field="folio.client_order_ref" />
|
||||
</div>
|
||||
<div
|
||||
t-if="folio.date_order and folio.state not in ['draft','sent']"
|
||||
class="mb-3 col-6"
|
||||
>
|
||||
<strong>Order Date:</strong>
|
||||
<p class="m-0" t-field="folio.date_order" />
|
||||
</div>
|
||||
<div
|
||||
t-if="folio.date_order and folio.state in ['draft','sent']"
|
||||
class="mb-3 col-6"
|
||||
>
|
||||
<strong>Quotation Date:</strong>
|
||||
<p
|
||||
class="mb-3 col-6"
|
||||
t-field="folio.date_order"
|
||||
t-options='{"widget": "date"}'
|
||||
/>
|
||||
</div>
|
||||
<div t-if="folio.user_id.name" class="mb-3 col-6">
|
||||
<strong>Salesperson:</strong>
|
||||
<p class="m-0" t-field="folio.user_id" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Is there a discount on at least one line? -->
|
||||
<t
|
||||
t-set="display_discount"
|
||||
t-value="any(l.discount for l in folio.sale_line_ids)"
|
||||
/>
|
||||
|
||||
<table class="table table-sm o_main_table">
|
||||
<!-- In case we want to repeat the header, remove "display: table-row-group" -->
|
||||
<thead style="display: table-row-group">
|
||||
<tr>
|
||||
<th name="th_description" class="text-left">Description</th>
|
||||
<th name="th_quantity" class="text-right">Quantity</th>
|
||||
<th name="th_priceunit" class="text-right">Unit Price</th>
|
||||
<th
|
||||
name="th_discount"
|
||||
t-if="display_discount"
|
||||
class="text-right"
|
||||
>
|
||||
<span>Disc.%</span>
|
||||
</th>
|
||||
<th name="th_taxes" class="text-right">Taxes</th>
|
||||
<th name="th_subtotal" class="text-right">
|
||||
<span
|
||||
groups="account.group_show_line_subtotals_tax_excluded"
|
||||
>Amount</span>
|
||||
<span
|
||||
groups="account.group_show_line_subtotals_tax_included"
|
||||
>Total Price</span>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="sale_tbody">
|
||||
|
||||
<t t-set="current_subtotal" t-value="0" />
|
||||
|
||||
<t t-foreach="folio.sale_line_ids" t-as="line">
|
||||
|
||||
<t
|
||||
t-set="current_subtotal"
|
||||
t-value="current_subtotal + line.price_subtotal"
|
||||
groups="account.group_show_line_subtotals_tax_excluded"
|
||||
/>
|
||||
<t
|
||||
t-set="current_subtotal"
|
||||
t-value="current_subtotal + line.price_total"
|
||||
groups="account.group_show_line_subtotals_tax_included"
|
||||
/>
|
||||
|
||||
<tr
|
||||
t-att-class="'bg-200 font-weight-bold o_line_section' if line.display_type == 'line_section' else 'font-italic o_line_note' if line.display_type == 'line_note' else ''"
|
||||
>
|
||||
<t t-if="not line.display_type">
|
||||
<t t-set="price" t-value="line.price_unit" />
|
||||
|
||||
<t t-if="line.reservation_id">
|
||||
<t
|
||||
t-set="print_board_service"
|
||||
t-value="line.reservation_id.board_service_room_id.pms_board_service_id.show_detail_report"
|
||||
/>
|
||||
<t t-if="not print_board_service">
|
||||
<t
|
||||
t-foreach="line.reservation_id.service_ids"
|
||||
t-as="service"
|
||||
>
|
||||
<t t-if="service.is_board_service">
|
||||
<t
|
||||
t-set="price"
|
||||
t-value="service.product_qty/line.product_uom_qty*service.price_unit*(1-(service.discount or 0.0)*0.01) + price"
|
||||
/>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
<t
|
||||
t-if="not(not print_board_service and line.service_id.is_board_service)"
|
||||
>
|
||||
<td name="td_name"><span
|
||||
t-field="line.name"
|
||||
/></td>
|
||||
<td name="td_quantity" class="text-right">
|
||||
<span t-field="line.product_uom_qty" />
|
||||
<span
|
||||
t-field="line.product_uom"
|
||||
groups="uom.group_uom"
|
||||
/>
|
||||
</td>
|
||||
|
||||
<td name="td_priceunit" class="text-right">
|
||||
<span
|
||||
t-esc="price"
|
||||
t-options='{"widget": "monetary", "display_currency": folio.pricelist_id.currency_id}'
|
||||
/>
|
||||
</td>
|
||||
<td t-if="display_discount" class="text-right">
|
||||
<span t-field="line.discount" />
|
||||
</td>
|
||||
<td name="td_taxes" class="text-right">
|
||||
<span
|
||||
t-esc="', '.join(map(lambda x: (x.description or x.name), line.tax_ids))"
|
||||
/>
|
||||
</td>
|
||||
<td
|
||||
name="td_subtotal"
|
||||
class="text-right o_price_total"
|
||||
>
|
||||
<span
|
||||
t-esc="price*(1-(line.discount or 0.0)*0.01)* line.product_uom_qty"
|
||||
groups="account.group_show_line_subtotals_tax_excluded"
|
||||
t-options='{"widget": "monetary", "display_currency": folio.pricelist_id.currency_id}'
|
||||
/>
|
||||
<span
|
||||
t-esc="price *(1-(line.discount or 0.0)*0.01)* line.product_uom_qty"
|
||||
groups="account.group_show_line_subtotals_tax_included"
|
||||
t-options='{"widget": "monetary", "display_currency": folio.pricelist_id.currency_id}'
|
||||
/>
|
||||
</td>
|
||||
</t>
|
||||
</t>
|
||||
<t t-if="line.display_type == 'line_section'">
|
||||
<td name="td_section_line" colspan="99">
|
||||
<span t-field="line.name" />
|
||||
</td>
|
||||
<t t-set="current_section" t-value="line" />
|
||||
<t t-set="current_subtotal" t-value="0" />
|
||||
</t>
|
||||
|
||||
<t t-if="line.display_type == 'line_note'">
|
||||
<td name="td_note_line" colspan="99">
|
||||
<span t-field="line.name" />
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
|
||||
<t
|
||||
t-if="current_section and (line_last or folio.sale_line_ids[line_index+1].display_type == 'line_section')"
|
||||
>
|
||||
<tr class="is-subtotal text-right">
|
||||
<td name="td_section_subtotal" colspan="99">
|
||||
<strong class="mr16">Subtotal</strong>
|
||||
<span
|
||||
t-esc="current_subtotal"
|
||||
t-options='{"widget": "monetary", "display_currency": folio.pricelist_id.currency_id}'
|
||||
/>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="clearfix" name="so_total_summary">
|
||||
<div id="total" class="row" name="total">
|
||||
<div
|
||||
t-attf-class="#{'col-4' if report_type != 'html' else 'col-sm-7 col-md-5'} ml-auto"
|
||||
>
|
||||
<table class="table table-sm">
|
||||
<tr class="border-black o_subtotal" style="">
|
||||
<td name="td_amount_untaxed_label"><strong
|
||||
>Subtotal</strong></td>
|
||||
<td name="td_amount_untaxed" class="text-right">
|
||||
<span t-field="folio.amount_untaxed" />
|
||||
</td>
|
||||
</tr>
|
||||
<t
|
||||
t-foreach="folio._get_tax_amount_by_group()"
|
||||
t-as="amount_by_group"
|
||||
>
|
||||
<tr style="">
|
||||
<t
|
||||
t-if="amount_by_group[3] == 1 and folio.amount_untaxed == amount_by_group[2]"
|
||||
>
|
||||
<td name="td_amount_by_group_label_3">
|
||||
<span t-esc="amount_by_group[0]" />
|
||||
<span>&nbsp;<span>on</span>&nbsp;<t
|
||||
t-esc="amount_by_group[2]"
|
||||
t-options='{"widget": "monetary", "display_currency": folio.pricelist_id.currency_id}'
|
||||
/></span>
|
||||
</td>
|
||||
<td
|
||||
name="td_amount_by_group_3"
|
||||
class="text-right o_price_total"
|
||||
>
|
||||
<span
|
||||
t-esc="amount_by_group[1]"
|
||||
t-options='{"widget": "monetary", "display_currency": folio.pricelist_id.currency_id}'
|
||||
/>
|
||||
</td>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<td name="td_amount_by_group_label">
|
||||
<span t-esc="amount_by_group[0]" />
|
||||
</td>
|
||||
<td
|
||||
name="td_amount_by_group"
|
||||
class="text-right o_price_total"
|
||||
>
|
||||
<span
|
||||
t-esc="amount_by_group[1]"
|
||||
t-options='{"widget": "monetary", "display_currency": folio.pricelist_id.currency_id}'
|
||||
/>
|
||||
</td>
|
||||
</t>
|
||||
</tr>
|
||||
</t>
|
||||
<tr class="border-black o_total">
|
||||
<td name="td_amount_total_label"><strong
|
||||
>Total</strong></td>
|
||||
<td name="td_amount_total" class="text-right">
|
||||
<span t-field="folio.amount_total" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oe_structure" />
|
||||
|
||||
<p t-field="folio.note" />
|
||||
<p t-if="folio.payment_term_id.note">
|
||||
<span t-field="folio.payment_term_id.note" />
|
||||
</p>
|
||||
<p
|
||||
id="fiscal_position_remark"
|
||||
t-if="folio.fiscal_position_id and folio.fiscal_position_id.sudo().note"
|
||||
>
|
||||
<strong>Fiscal Position Remark:</strong>
|
||||
<span t-field="folio.fiscal_position_id.sudo().note" />
|
||||
</p>
|
||||
</div>
|
||||
</template>
|
||||
</odoo>
|
||||
@@ -130,6 +130,17 @@
|
||||
>
|
||||
<span class="o_stat_text">New Booking Group</span>
|
||||
</button>
|
||||
<button
|
||||
name="preview_folio"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-globe icon"
|
||||
>
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_text">Customer</span>
|
||||
<span class="o_stat_text">Preview</span>
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
<widget
|
||||
name="web_ribbon"
|
||||
|
||||
@@ -88,6 +88,17 @@
|
||||
name="button_box"
|
||||
attrs="{'invisible': [('folio_id','=',False)]}"
|
||||
>
|
||||
<button
|
||||
name="preview_reservation"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
icon="fa-globe icon"
|
||||
>
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_text">Customer</span>
|
||||
<span class="o_stat_text">Preview</span>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
|
||||
285
pms/views/reservation_portal_templates.xml
Normal file
285
pms/views/reservation_portal_templates.xml
Normal file
@@ -0,0 +1,285 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template
|
||||
id="portal_my_home_menu_reservation"
|
||||
name="Portal layout : reservation menu entries"
|
||||
inherit_id="portal.portal_breadcrumbs"
|
||||
priority="20"
|
||||
>
|
||||
<xpath expr="//ol[hasclass('o_portal_submenu')]" position="inside">
|
||||
<li
|
||||
t-if="page_name == 'reservations'"
|
||||
t-attf-class="breadcrumb-item #{'active ' if not reservations else ''}"
|
||||
>
|
||||
<a t-attf-href="/my/reservations?{{ keep_query() }}">Reservations</a>
|
||||
</li>
|
||||
<li t-if="reservation" class="breadcrumb-item active">
|
||||
<a t-attf-href="/my/reservations?{{ keep_query() }}">Reservations/</a>
|
||||
<t t-esc="reservation.name" />
|
||||
</li>
|
||||
</xpath>
|
||||
</template>
|
||||
<template
|
||||
id="portal_my_reservations"
|
||||
name="Reservations"
|
||||
inherit_id="portal.portal_my_home"
|
||||
customize_show="True"
|
||||
priority="30"
|
||||
>
|
||||
<xpath expr="//div[hasclass('o_portal_docs')]" position="inside">
|
||||
<t t-call="portal.portal_docs_entry">
|
||||
<t t-set="title">Reservations</t>
|
||||
<t t-set="url" t-value="'/my/reservations'" />
|
||||
<t t-set="placeholder_count" t-value="'reservation_count'" />
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="portal_my_reservation" name="My Reservations">
|
||||
<t t-call="portal.portal_layout">
|
||||
<t t-set="breadcrumbs_searchbar" t-value="True" />
|
||||
|
||||
<t t-call="portal.portal_searchbar">
|
||||
<t t-set="title">Reservations</t>
|
||||
</t>
|
||||
<t t-if="not reservations">
|
||||
<p>There are currently no reservations for your account.</p>
|
||||
</t>
|
||||
<t t-if="reservations" t-call="portal.portal_table">
|
||||
<thead>
|
||||
<tr class="active">
|
||||
<th>Reservation #</th>
|
||||
<th>Checkin</th>
|
||||
<th>Checkout</th>
|
||||
<th class="text-right">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="reservations" t-as="reservation">
|
||||
<t t-set="folio" t-value="reservation.folio_id" />
|
||||
<!-- Sacar folio-->
|
||||
<t t-if="reservation == folio.reservation_ids[0]">
|
||||
<tr class="bg-light">
|
||||
<td colspan="4"><em
|
||||
class="font-weight-normal text-muted"
|
||||
><span /> Reservations by folio: </em>
|
||||
<a
|
||||
t-att-href="folio.get_portal_url()"
|
||||
t-att-title="folio.name"
|
||||
>
|
||||
<t t-esc="folio.name" />
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</t>
|
||||
<tr>
|
||||
<td>
|
||||
<a
|
||||
t-att-href="reservation.get_portal_url()"
|
||||
t-att-title="reservation.name"
|
||||
>
|
||||
<t t-esc="reservation.name" />
|
||||
</a>
|
||||
</td>
|
||||
<td><span t-field="reservation.checkin" /></td>
|
||||
<td><span t-field="reservation.checkout" /></td>
|
||||
<td class="text-right"><span
|
||||
t-field="reservation.price_room_services_set"
|
||||
/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</tbody>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
||||
<template id="portal_my_reservation_detail" name="My Reservation">
|
||||
<t t-call="portal.portal_layout">
|
||||
<t t-call="portal.portal_record_layout">
|
||||
<t t-set="card_header">
|
||||
<div class="row no-gutters">
|
||||
<div class="col-12">
|
||||
<h5 class="d-flex mb-1 mb-md-0 row">
|
||||
<span
|
||||
t-field="reservation.name"
|
||||
class="col-9 text-truncate"
|
||||
/>
|
||||
<div class="col-3 col-md-2 text-right">
|
||||
<small class="text-right">Status:</small>
|
||||
<span
|
||||
t-field="reservation.state"
|
||||
class=" badge badge-pill badge-info"
|
||||
title="Current state of this reservation"
|
||||
/>
|
||||
</div>
|
||||
</h5>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-set="card_body">
|
||||
<div class="row mb-4">
|
||||
<div class="col-12 col-md-6">
|
||||
<strong>Checkin:</strong> <span
|
||||
t-field="reservation.checkin"
|
||||
t-options='{"widget": "date"}'
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 mb-1">
|
||||
<strong>Checkout:</strong> <span
|
||||
t-field="reservation.checkout"
|
||||
t-options='{"widget": "date"}'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb-4">
|
||||
<div class="col-12 col-md-6">
|
||||
<strong>Arrival hour:</strong> <span
|
||||
t-field="reservation.arrival_hour"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 mb-1">
|
||||
<strong>Departure hour:</strong> <span
|
||||
t-field="reservation.departure_hour"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-12 col-md-6">
|
||||
<strong>Room:</strong> <span
|
||||
t-field="reservation.preferred_room_id"
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 mb-1">
|
||||
<t t-if="reservation.board_service_room_id">
|
||||
<strong>Board Service:</strong> <span
|
||||
t-field="reservation.board_service_room_id.pms_board_service_id.name"
|
||||
/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
<t t-set="service_price" t-value="0" />
|
||||
<t t-set="board_service_price" t-value="0" />
|
||||
<t t-foreach="reservation.service_ids" t-as="service">
|
||||
<t t-if="service.is_board_service">
|
||||
<t
|
||||
t-set="board_service_price"
|
||||
t-value="board_service_price + service.price_total"
|
||||
/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<t
|
||||
t-set="service_price"
|
||||
t-value="service_price + service.price_total"
|
||||
/>
|
||||
</t>
|
||||
</t>
|
||||
<div class="row mb-4">
|
||||
<div class="col-12 col-md-6">
|
||||
<strong>Room price:</strong> <span
|
||||
t-esc="reservation.price_total + board_service_price"
|
||||
t-options='{"widget": "monetary", "display_currency": reservation.pricelist_id.currency_id}'
|
||||
/>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 mb-1">
|
||||
<t t-if="service_price!=0">
|
||||
<strong>Service total:</strong> <span
|
||||
t-esc="service_price"
|
||||
t-options='{"widget": "monetary", "display_currency": reservation.pricelist_id.currency_id}'
|
||||
/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
<t t-if="reservation.service_ids">
|
||||
<t t-if="service_price!=0">
|
||||
<table class="table">
|
||||
<thead style="display:table-row-group">
|
||||
<th name="th_services">
|
||||
Services
|
||||
</th>
|
||||
<th name="th_qty">
|
||||
Quantity
|
||||
</th>
|
||||
<th name="th_price">
|
||||
Price Unit
|
||||
</th>
|
||||
<th name="th_price_total">
|
||||
Price Total
|
||||
</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
<t t-foreach="reservation.service_ids" t-as="service">
|
||||
<t t-if="not service.is_board_service">
|
||||
<tr>
|
||||
<td><span t-esc="service.name" /></td>
|
||||
<td><span
|
||||
t-field="service.product_qty"
|
||||
/></td>
|
||||
<td><span
|
||||
t-field="service.price_unit"
|
||||
t-options='{"widget": "monetary", "display_currency": reservation.pricelist_id.currency_id}'
|
||||
/></td>
|
||||
<td><span
|
||||
t-field="service.price_total"
|
||||
t-options='{"widget": "monetary", "display_currency": reservation.pricelist_id.currency_id}'
|
||||
/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
</tbody>
|
||||
</table>
|
||||
</t>
|
||||
<div class="row mb-4 justify-content-start">
|
||||
<div class="h3 text-info">
|
||||
<strong>Reservation total:</strong> <span
|
||||
t-field="reservation.price_room_services_set"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<div class="row mb-4" t-if="reservation.partner_id.is_agency">
|
||||
<div
|
||||
class="col-12 col-md-6 pb-2"
|
||||
t-if="reservation.partner_id.is_agency"
|
||||
>
|
||||
<strong>Assigned to</strong>
|
||||
<div class="row">
|
||||
<div class="col flex-grow-0 pr-3">
|
||||
<img
|
||||
t-if="reservation.partner_id.image_1024"
|
||||
class="rounded-circle mt-1 o_portal_contact_img"
|
||||
t-att-src="image_data_uri(reservation.partner_id.image_1024)"
|
||||
alt="Contact"
|
||||
/>
|
||||
<img
|
||||
t-else=""
|
||||
class="rounded-circle mt-1 o_portal_contact_img"
|
||||
src="/web/static/src/img/user_menu_avatar.png"
|
||||
alt="Contact"
|
||||
/>
|
||||
</div>
|
||||
<div class="col pl-md-0">
|
||||
<div
|
||||
t-field="reservation.partner_id"
|
||||
t-options='{"widget": "contact", "fields": ["name", "email", "phone"]}'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
<div class="mt32">
|
||||
<h4><strong>Message and communication history</strong></h4>
|
||||
<t t-call="portal.message_thread">
|
||||
<t t-set="object" t-value="reservation" />
|
||||
<t t-set="token" t-value="reservation.access_token" />
|
||||
<t t-set="pid" t-value="pid" />
|
||||
<t t-set="hash" t-value="hash" />
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user