-
-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] new module account_receipt_portal
- Loading branch information
Showing
16 changed files
with
717 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
||
AccountInvoice = request.env["account.move"] | ||
|
||
domain = self._get_invoices_domain() | ||
|
||
searchbar_sortings = values.get("searchbar_sortings", {}) | ||
|
||
# default sort by order | ||
if not sortby: | ||
sortby = "date" | ||
order = searchbar_sortings[sortby]["order"] | ||
|
||
searchbar_filters = values.get("searchbar_filters", {}) | ||
searchbar_filters.update( | ||
{ | ||
"sale_receipts": { | ||
"label": _("Sale Receipt"), | ||
"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"] | ||
|
||
pager = values.get("pager") | ||
|
||
# content according to pager and archive selected | ||
invoices = AccountInvoice.search( | ||
domain, order=order, limit=self._items_per_page, offset=pager["offset"] | ||
) | ||
request.session["my_invoices_history"] = invoices.ids[:100] | ||
|
||
values.update( | ||
{ | ||
"invoices": invoices, | ||
"sortby": sortby, | ||
"searchbar_filters": OrderedDict(sorted(searchbar_filters.items())), | ||
"filterby": filterby, | ||
} | ||
) | ||
return request.render("account.portal_my_invoices", values) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
for move in self.filtered(lambda move: move.is_receipt()): | ||
move.access_url = "/my/invoices/%s" % (move.id) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This module adds sale and purchase receipts in the customer portal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
Oops, something went wrong.