Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] portal_pos_order_amount #527

Merged
merged 11 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions portal_pos_order_amount/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
=======================
Portal POS order amount
=======================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-beescoop%2FObeesdoo-lightgray.png?logo=github
:target: https://github.com/beescoop/Obeesdoo/tree/12.0/portal_pos_order_amount
:alt: beescoop/Obeesdoo

|badge1| |badge2| |badge3|

Show the total amount of pos order in the website portal.

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

Add currency in the template

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/beescoop/Obeesdoo/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/beescoop/Obeesdoo/issues/new?body=module:%20portal_pos_order_amount%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Coop IT Easy SC

Contributors
~~~~~~~~~~~~

* BEES coop - Cellule IT
* Coop IT Easy SC

Maintainers
~~~~~~~~~~~

This module is part of the `beescoop/Obeesdoo <https://github.com/beescoop/Obeesdoo/tree/12.0/portal_pos_order_amount>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions portal_pos_order_amount/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import controllers
16 changes: 16 additions & 0 deletions portal_pos_order_amount/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2019 Coop IT Easy SC
# Rémy Taymans <remy@coopiteasy.be>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Portal POS order amount",
"summary": """
Show the total amount of pos order in the website portal.
""",
"author": "Coop IT Easy SC",
"license": "AGPL-3",
"version": "16.0.1.0.0",
"website": "https://github.com/beescoop/Obeesdoo",
"category": "Website",
"depends": ["portal", "point_of_sale"],
"data": ["templates/portal_pos_order_amount.xml"],
}
1 change: 1 addition & 0 deletions portal_pos_order_amount/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import main
43 changes: 43 additions & 0 deletions portal_pos_order_amount/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2018 Rémy Taymans <remytaymans@gmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).


from itertools import groupby

from odoo.http import request

from odoo.addons.portal.controllers.portal import CustomerPortal


class PortalPosOrderAmount(CustomerPortal):
def _prepare_portal_layout_values(self):
values = super(PortalPosOrderAmount, self)._prepare_portal_layout_values()
user = request.env.user
owned_pos_order = (
request.env["pos.order"]
.sudo()
.search(
[
(
"partner_id",
"=",
user.partner_id.commercial_partner_id.id,
),
("state", "!=", "cancel"),
]
)
)
values["pos_order_amount"] = sum(po.amount_total for po in owned_pos_order)
values["pos_order_amount_by_year"] = [
{
"year": year,
"amount": sum(
pos_order.amount_total for pos_order in grouped_pos_orders
),
}
for year, grouped_pos_orders in groupby(
owned_pos_order, key=lambda pos_order: pos_order.date_order.year
)
]
values["company_currency"] = request.env.company.currency_id
return values
37 changes: 37 additions & 0 deletions portal_pos_order_amount/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * portal_pos_order_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-05-12 09:42+0000\n"
"PO-Revision-Date: 2023-05-12 09:42+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: portal_pos_order_amount
#: model_terms:ir.ui.view,arch_db:portal_pos_order_amount.total_pos_order_amount
msgid "Amount"
msgstr "Montant"

#. module: portal_pos_order_amount
#: model_terms:ir.ui.view,arch_db:portal_pos_order_amount.total_pos_order_amount
msgid "Purchases"
msgstr "Achats"

#. module: portal_pos_order_amount
#: model_terms:ir.ui.view,arch_db:portal_pos_order_amount.total_pos_order_amount
msgid "Year"
msgstr "Année"

#. module: portal_pos_order_amount
#: model_terms:ir.ui.view,arch_db:portal_pos_order_amount.total_pos_order_amount
msgid "You have purchased a total amount of"
msgstr "Vous avez dépensé un total de"

35 changes: 35 additions & 0 deletions portal_pos_order_amount/i18n/portal_pos_order_amount.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * portal_pos_order_amount
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: portal_pos_order_amount
#: model_terms:ir.ui.view,arch_db:portal_pos_order_amount.total_pos_order_amount
msgid "Amount"
msgstr ""

#. module: portal_pos_order_amount
#: model_terms:ir.ui.view,arch_db:portal_pos_order_amount.total_pos_order_amount
msgid "Purchases"
msgstr ""

#. module: portal_pos_order_amount
#: model_terms:ir.ui.view,arch_db:portal_pos_order_amount.total_pos_order_amount
msgid "Year"
msgstr ""

#. module: portal_pos_order_amount
#: model_terms:ir.ui.view,arch_db:portal_pos_order_amount.total_pos_order_amount
msgid "You have purchased a total amount of"
msgstr ""

2 changes: 2 additions & 0 deletions portal_pos_order_amount/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* BEES coop - Cellule IT
* Coop IT Easy SC
1 change: 1 addition & 0 deletions portal_pos_order_amount/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Show the total amount of pos order in the website portal.
1 change: 1 addition & 0 deletions portal_pos_order_amount/readme/ROADMAP.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add currency in the template
Loading
Loading