mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: add report proforma routes
This commit is contained in:
@@ -570,3 +570,41 @@ class PortalPrecheckin(CustomerPortal):
|
||||
if firstname and email:
|
||||
checkin_partner.write({"firstname": firstname, "email": email})
|
||||
checkin_partner.send_portal_invitation_email(firstname, email)
|
||||
|
||||
|
||||
class PortalAccount(CustomerPortal):
|
||||
@http.route(
|
||||
["/my/invoices/proforma/<int:invoice_id>"],
|
||||
type="http",
|
||||
auth="public",
|
||||
website=True,
|
||||
)
|
||||
def portal_proforma_my_invoice_detail(
|
||||
self, invoice_id, access_token=None, report_type=None, download=False, **kw
|
||||
):
|
||||
try:
|
||||
invoice_sudo = self._document_check_access(
|
||||
"account.move", invoice_id, access_token
|
||||
)
|
||||
except (AccessError, MissingError):
|
||||
return request.redirect("/my")
|
||||
|
||||
if report_type in ("html", "pdf", "text"):
|
||||
return self._show_report(
|
||||
model=invoice_sudo,
|
||||
report_type=report_type,
|
||||
report_ref="pms.action_report_pms_pro_forma_invoice",
|
||||
download=download,
|
||||
)
|
||||
|
||||
invoice_sudo = invoice_sudo.with_context(proforma=True)
|
||||
values = self._invoice_get_page_view_values(invoice_sudo, access_token, **kw)
|
||||
acquirers = values.get("acquirers")
|
||||
if acquirers:
|
||||
country_id = (
|
||||
values.get("partner_id") and values.get("partner_id")[0].country_id.id
|
||||
)
|
||||
values["acq_extra_fees"] = acquirers.get_acquirer_extra_fees(
|
||||
invoice_sudo.amount_residual, invoice_sudo.currency_id, country_id
|
||||
)
|
||||
return request.render("pms.pms_proforma_invoice_template", values)
|
||||
|
||||
Reference in New Issue
Block a user