Browse Source
Merge pull request #131 from beescoop/12.0-mig-beesdoo_website_posorder_amount
[MIG] 12.0 mig beesdoo website posorder amount
pull/150/head
Rémy Taymans
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
75 additions and
0 deletions
-
beesdoo_website_posorder_amount/__init__.py
-
beesdoo_website_posorder_amount/__manifest__.py
-
beesdoo_website_posorder_amount/controllers/__init__.py
-
beesdoo_website_posorder_amount/controllers/main.py
-
beesdoo_website_posorder_amount/templates/portal_posorder_amount.xml
|
|
@ -0,0 +1 @@ |
|
|
|
from . import controllers |
|
|
@ -0,0 +1,18 @@ |
|
|
|
# Copyright 2019 Coop IT Easy SCRLfs |
|
|
|
# Rémy Taymans <remy@coopiteasy.be> |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
{ |
|
|
|
"name": "Portal Website POS order amount", |
|
|
|
"summary": """ |
|
|
|
Show the total amount of pos order in the website portal. |
|
|
|
""", |
|
|
|
"description": """ |
|
|
|
""", |
|
|
|
"author": "Coop IT Easy SCRLfs", |
|
|
|
"license": "AGPL-3", |
|
|
|
"version": "12.0.1.0.0", |
|
|
|
"website": "https://github.com/beescoop/Obeesdoo", |
|
|
|
"category": "Website", |
|
|
|
"depends": ["portal", "point_of_sale"], |
|
|
|
"data": ["templates/portal_posorder_amount.xml"], |
|
|
|
} |
|
|
@ -0,0 +1 @@ |
|
|
|
from . import main |
|
|
@ -0,0 +1,28 @@ |
|
|
|
# Copyright 2018 Rémy Taymans <remytaymans@gmail.com> |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
|
|
|
|
|
|
|
|
from odoo.addons.portal.controllers.portal import CustomerPortal |
|
|
|
from odoo.http import request |
|
|
|
|
|
|
|
|
|
|
|
class PortalPosOrderAmount(CustomerPortal): |
|
|
|
|
|
|
|
def _prepare_portal_layout_values(self): |
|
|
|
values = super( |
|
|
|
PortalPosOrderAmount, self |
|
|
|
)._prepare_portal_layout_values() |
|
|
|
user = request.env.user |
|
|
|
owned_posorder = request.env["pos.order"].sudo().search( |
|
|
|
[ |
|
|
|
("partner_id", "=", user.partner_id.commercial_partner_id.id), |
|
|
|
("state", "!=", "cancel"), |
|
|
|
] |
|
|
|
) |
|
|
|
values["posorder_amount"] = sum( |
|
|
|
po.amount_total for po in owned_posorder |
|
|
|
) |
|
|
|
values["company_currency"] = ( |
|
|
|
request.env["res.company"]._company_default_get().currency_id |
|
|
|
) |
|
|
|
return values |
|
|
@ -0,0 +1,27 @@ |
|
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
<!-- |
|
|
|
Copyright 2018 Rémy Taymans <remytaymans@gmail.com> |
|
|
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). |
|
|
|
--> |
|
|
|
<odoo> |
|
|
|
|
|
|
|
<!-- Add pos.order total amount --> |
|
|
|
<template |
|
|
|
id="total_pos_order_amount" |
|
|
|
name="Portal total POS order amount" |
|
|
|
priority="40" |
|
|
|
inherit_id="portal.portal_layout"> |
|
|
|
<xpath expr="//div[@class='o_portal_my_details']" position="after"> |
|
|
|
<div class="o_my_details_eater mt-2"> |
|
|
|
<h4 class="page-header">Purchases</h4> |
|
|
|
<hr class="mt-1 mb-0"/> |
|
|
|
<p> |
|
|
|
You have purchased a total amount of |
|
|
|
<span t-esc="posorder_amount" |
|
|
|
t-esc-options='{"widget": "monetary", "display_currency": "company_currency"}'/>. |
|
|
|
</p> |
|
|
|
</div> |
|
|
|
</xpath> |
|
|
|
</template> |
|
|
|
|
|
|
|
</odoo> |