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

[14.0] [ADD] new module account_receipt_portal #1685

Draft
wants to merge 1 commit into
base: 14.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
87 changes: 87 additions & 0 deletions account_receipt_portal/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
===========================
Website Portal for Receipts
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:9e02a24ad529193ce3b5e9a529c12284239e1232194e3b59873d48b5c95a53ca
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-OCA%2Faccount--invoicing-lightgray.png?logo=github
:target: https://github.com/OCA/account-invoicing/tree/14.0/account_receipt_portal
:alt: OCA/account-invoicing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-invoicing-14-0/account-invoicing-14-0-account_receipt_portal
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-invoicing&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module adds sale and purchase receipts in the customer portal.

**Table of contents**

.. contents::
:local:

Configuration
=============

In order to use sale and purchase receipts, you need to enable them in the user settings.

* Activate **Developer mode**
* Go to *Settings → Users & Companies → Users*
* In the user form, select 'Sale Receipt' and 'Purchase Receipt' checkboxes within the *Technical* section of *Access Rights* tab

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-invoicing/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/account-invoicing/issues/new?body=module:%20account_receipt_portal%0Aversion:%2014.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
~~~~~~~

* Pordenone Linux User Group (PNLUG)

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

* `Pordenone Linux User Group APS <https://www.pnlug.it>`__:

* Sergio Zanchetta <https://github.com/primes2h>

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

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/account-invoicing <https://github.com/OCA/account-invoicing/tree/14.0/account_receipt_portal>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions account_receipt_portal/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models, controllers
18 changes: 18 additions & 0 deletions account_receipt_portal/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2024 Sergio Zanchetta (Associazione PNLUG - Gruppo Odoo)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Website Portal for Receipts",
"version": "14.0.1.0.0",
"category": "Accounting & Finance",
"summary": "Add sale and purchase receipts in the customer portal",
"author": "Pordenone Linux User Group (PNLUG), Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-invoicing",
"license": "AGPL-3",
"depends": ["account", "portal", "account_receipt_base", "account_receipt_print"],
"data": [
"views/account_portal_templates.xml",
"security/account_security.xml",
],
"installable": True,
}
3 changes: 3 additions & 0 deletions account_receipt_portal/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import portal
66 changes: 66 additions & 0 deletions account_receipt_portal/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Copyright 2024 Sergio Zanchetta - PNLUG APS
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from collections import OrderedDict

from odoo import _, http
from odoo.http import request

from odoo.addons.account.controllers.portal import PortalAccount


class PortalAccount(PortalAccount):
@http.route()
def portal_my_invoices(
self, page=1, date_begin=None, date_end=None, sortby=None, filterby=None, **kw
):
res = super(PortalAccount, self).portal_my_invoices(filterby=None)
values = res.qcontext

Check warning on line 18 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L17-L18

Added lines #L17 - L18 were not covered by tests

AccountInvoice = request.env["account.move"]

Check warning on line 20 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L20

Added line #L20 was not covered by tests

domain = self._get_invoices_domain()

Check warning on line 22 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L22

Added line #L22 was not covered by tests

searchbar_sortings = values.get("searchbar_sortings", {})

Check warning on line 24 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L24

Added line #L24 was not covered by tests

# default sort by order
if not sortby:
sortby = "date"
order = searchbar_sortings[sortby]["order"]

Check warning on line 29 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L28-L29

Added lines #L28 - L29 were not covered by tests

searchbar_filters = values.get("searchbar_filters", {})
searchbar_filters.update(

Check warning on line 32 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L31-L32

Added lines #L31 - L32 were not covered by tests
{
"sale_receipts": {
"label": _("Sale Receipts"),
"domain": [("move_type", "=", "out_receipt")],
},
"purchase_receipts": {
"label": _("Purchase Receipts"),
"domain": [("move_type", "=", "in_receipt")],
},
}
)

# default filter by value
if not filterby:
filterby = "all"
domain += searchbar_filters[filterby]["domain"]

Check warning on line 48 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L47-L48

Added lines #L47 - L48 were not covered by tests

pager = values.get("pager")

Check warning on line 50 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L50

Added line #L50 was not covered by tests

# content according to pager and archive selected
invoices = AccountInvoice.search(

Check warning on line 53 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L53

Added line #L53 was not covered by tests
domain, order=order, limit=self._items_per_page, offset=pager["offset"]
)
request.session["my_invoices_history"] = invoices.ids[:100]

Check warning on line 56 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L56

Added line #L56 was not covered by tests

values.update(

Check warning on line 58 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L58

Added line #L58 was not covered by tests
{
"invoices": invoices,
"sortby": sortby,
"searchbar_filters": OrderedDict(sorted(searchbar_filters.items())),
"filterby": filterby,
}
)
return request.render("account.portal_my_invoices", values)

Check warning on line 66 in account_receipt_portal/controllers/portal.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/controllers/portal.py#L66

Added line #L66 was not covered by tests
70 changes: 70 additions & 0 deletions account_receipt_portal/i18n/account_receipt_portal.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_receipt_portal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-15 21:05+0000\n"
"PO-Revision-Date: 2024-03-15 21:05+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: account_receipt_portal
#: model:ir.model.fields,field_description:account_receipt_portal.field_account_move__display_name
msgid "Display Name"
msgstr ""

#. module: account_receipt_portal
#: model:ir.model.fields,field_description:account_receipt_portal.field_account_move__id
msgid "ID"
msgstr ""

#. module: account_receipt_portal
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_invoices
msgid "Invoice/Receipt #"
msgstr ""

#. module: account_receipt_portal
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_invoices
msgid "Invoice/Receipt Date"
msgstr ""

#. module: account_receipt_portal
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_home_invoice
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_home_menu_invoice
msgid "Invoices, Bills &amp; Receipts"
msgstr ""

#. module: account_receipt_portal
#: model:ir.model,name:account_receipt_portal.model_account_move
msgid "Journal Entry"
msgstr ""

#. module: account_receipt_portal
#: model:ir.model.fields,field_description:account_receipt_portal.field_account_move____last_update
msgid "Last Modified on"
msgstr ""

#. module: account_receipt_portal
#: code:addons/account_receipt_portal/controllers/portal.py:0
#, python-format
msgid "Purchase Receipts"
msgstr ""

#. module: account_receipt_portal
#: code:addons/account_receipt_portal/controllers/portal.py:0
#, python-format
msgid "Sale Receipts"
msgstr ""

#. module: account_receipt_portal
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_invoices
msgid ""
"There are currently no invoices/receipts and payments for your account."
msgstr ""
70 changes: 70 additions & 0 deletions account_receipt_portal/i18n/it.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * account_receipt_portal
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-03-15 21:06+0000\n"
"PO-Revision-Date: 2024-03-15 21:06+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: account_receipt_portal
#: model:ir.model.fields,field_description:account_receipt_portal.field_account_move__display_name
msgid "Display Name"
msgstr "Nome visualizzato"

#. module: account_receipt_portal
#: model:ir.model.fields,field_description:account_receipt_portal.field_account_move__id
msgid "ID"
msgstr "ID"

#. module: account_receipt_portal
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_invoices
msgid "Invoice/Receipt #"
msgstr "Fattura/Ricevuta n°"

#. module: account_receipt_portal
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_invoices
msgid "Invoice/Receipt Date"
msgstr "Data fattura/ricevuta"

#. module: account_receipt_portal
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_home_invoice
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_home_menu_invoice
msgid "Invoices, Bills &amp; Receipts"
msgstr "Fatture e ricevute"

#. module: account_receipt_portal
#: model:ir.model,name:account_receipt_portal.model_account_move
msgid "Journal Entry"
msgstr "Registrazione contabile"

#. module: account_receipt_portal
#: model:ir.model.fields,field_description:account_receipt_portal.field_account_move____last_update
msgid "Last Modified on"
msgstr "Ultima modifica il"

#. module: account_receipt_portal
#: code:addons/account_receipt_portal/controllers/portal.py:0
#, python-format
msgid "Purchase Receipts"
msgstr "Ricevute di acquisto"

#. module: account_receipt_portal
#: code:addons/account_receipt_portal/controllers/portal.py:0
#, python-format
msgid "Sale Receipts"
msgstr "Ricevute di vendita"

#. module: account_receipt_portal
#: model_terms:ir.ui.view,arch_db:account_receipt_portal.portal_my_invoices
msgid ""
"There are currently no invoices/receipts and payments for your account."
msgstr "Al momento nell'account non sono presenti fatture/ricevute e pagamenti."
3 changes: 3 additions & 0 deletions account_receipt_portal/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import account_move
13 changes: 13 additions & 0 deletions account_receipt_portal/models/account_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 Sergio Zanchetta - PNLUG APS
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import models


class AccountMove(models.Model):
_inherit = "account.move"

def _compute_access_url(self):
super(AccountMove, self)._compute_access_url()

Check warning on line 11 in account_receipt_portal/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/models/account_move.py#L11

Added line #L11 was not covered by tests
for move in self.filtered(lambda move: move.is_receipt()):
move.access_url = "/my/invoices/%s" % (move.id)

Check warning on line 13 in account_receipt_portal/models/account_move.py

View check run for this annotation

Codecov / codecov/patch

account_receipt_portal/models/account_move.py#L13

Added line #L13 was not covered by tests
5 changes: 5 additions & 0 deletions account_receipt_portal/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
In order to use sale and purchase receipts, you need to enable them in the user settings.

* Activate **Developer mode**
* Go to *Settings → Users & Companies → Users*
* In the user form, select 'Sale Receipt' and 'Purchase Receipt' checkboxes within the *Technical* section of *Access Rights* tab
3 changes: 3 additions & 0 deletions account_receipt_portal/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* `Pordenone Linux User Group APS <https://www.pnlug.it>`__:

* Sergio Zanchetta <https://github.com/primes2h>
1 change: 1 addition & 0 deletions account_receipt_portal/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module adds sale and purchase receipts in the customer portal.
24 changes: 24 additions & 0 deletions account_receipt_portal/security/account_security.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'account'), ('name', '=', 'account_invoice_rule_portal')]"
/>
</function>
<value eval="{'noupdate': False}" />
</function>
<record id="account.account_invoice_rule_portal" model="ir.rule">
<field
name="domain_force"
>[('state', 'not in', ('cancel', 'draft')), ('move_type', 'in', ('out_invoice', 'out_refund', 'out_receipt', 'in_invoice', 'in_refund', 'in_receipt')), ('message_partner_ids','child_of',[user.commercial_partner_id.id])]</field>
</record>
<function name="write" model="ir.model.data">
<function name="search" model="ir.model.data">
<value
eval="[('module', '=', 'account'), ('name', '=', 'account_invoice_rule_portal')]"
/>
</function>
<value eval="{'noupdate': True}" />
</function>
</odoo>
Loading
Loading