diff --git a/account_payment_manual_eligibility/README.rst b/account_payment_manual_eligibility/README.rst new file mode 100644 index 000000000..9ee2449ac --- /dev/null +++ b/account_payment_manual_eligibility/README.rst @@ -0,0 +1,60 @@ +================================== +Account Payment Manual eligibility +================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:5f4673cecf313955af242b004c44246002b189bb01388c65a2a5133c542aab06 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-akretion%2Fak--odoo--incubator-lightgray.png?logo=github + :target: https://github.com/akretion/ak-odoo-incubator/tree/14.0/account_payment_manual_eligibility + :alt: akretion/ak-odoo-incubator + +|badge1| |badge2| |badge3| + +This module allows to filter the journals that are displayed in the register payment wizard on invoices + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Akretion + +Contributors +~~~~~~~~~~~~ + +* Florian da Costa + +Maintainers +~~~~~~~~~~~ + +This module is part of the `akretion/ak-odoo-incubator `_ project on GitHub. + +You are welcome to contribute. diff --git a/account_payment_manual_eligibility/__init__.py b/account_payment_manual_eligibility/__init__.py new file mode 100644 index 000000000..aee8895e7 --- /dev/null +++ b/account_payment_manual_eligibility/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import wizards diff --git a/account_payment_manual_eligibility/__manifest__.py b/account_payment_manual_eligibility/__manifest__.py new file mode 100644 index 000000000..e4b2794aa --- /dev/null +++ b/account_payment_manual_eligibility/__manifest__.py @@ -0,0 +1,15 @@ +{ + "name": "Account Payment Manual eligibility", + "version": "14.0.1.0.0", + "author": "Akretion, Odoo Community Association (OCA)", + "category": "Tools", + "depends": ["account"], + "website": "https://github.com/akretion/ak-odoo-incubator", + "data": [ + "views/account_journal.xml", + "wizards/account_payment_register_views.xml", + ], + "maintainer": "florian-dacosta", + "license": "AGPL-3", + "installable": True, +} diff --git a/account_payment_manual_eligibility/models/__init__.py b/account_payment_manual_eligibility/models/__init__.py new file mode 100644 index 000000000..2388e1196 --- /dev/null +++ b/account_payment_manual_eligibility/models/__init__.py @@ -0,0 +1 @@ +from . import account_journal diff --git a/account_payment_manual_eligibility/models/account_journal.py b/account_payment_manual_eligibility/models/account_journal.py new file mode 100644 index 000000000..6e2cc03a5 --- /dev/null +++ b/account_payment_manual_eligibility/models/account_journal.py @@ -0,0 +1,11 @@ +# Copyright (C) 2015 Akretion (http://www.akretion.com). + +from odoo import fields, models + + +class AccountJournal(models.Model): + _inherit = "account.journal" + + available_for_manual_payment = fields.Boolean( + help="If active, the journal will be available to register a payment manually" + ) diff --git a/account_payment_manual_eligibility/readme/CONTRIBUTORS.rst b/account_payment_manual_eligibility/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..0bddb053a --- /dev/null +++ b/account_payment_manual_eligibility/readme/CONTRIBUTORS.rst @@ -0,0 +1 @@ +* Florian da Costa diff --git a/account_payment_manual_eligibility/readme/DESCRIPTION.rst b/account_payment_manual_eligibility/readme/DESCRIPTION.rst new file mode 100644 index 000000000..f239d96ab --- /dev/null +++ b/account_payment_manual_eligibility/readme/DESCRIPTION.rst @@ -0,0 +1 @@ +This module allows to filter the journals that are displayed in the register payment wizard on invoices diff --git a/account_payment_manual_eligibility/static/description/index.html b/account_payment_manual_eligibility/static/description/index.html new file mode 100644 index 000000000..ea15063d7 --- /dev/null +++ b/account_payment_manual_eligibility/static/description/index.html @@ -0,0 +1,416 @@ + + + + + +Account Payment Manual eligibility + + + +
+

Account Payment Manual eligibility

+ + +

Beta License: AGPL-3 akretion/ak-odoo-incubator

+

This module allows to filter the journals that are displayed in the register payment wizard on invoices

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

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

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the akretion/ak-odoo-incubator project on GitHub.

+

You are welcome to contribute.

+
+
+
+ + diff --git a/account_payment_manual_eligibility/views/account_journal.xml b/account_payment_manual_eligibility/views/account_journal.xml new file mode 100644 index 000000000..81ff70076 --- /dev/null +++ b/account_payment_manual_eligibility/views/account_journal.xml @@ -0,0 +1,14 @@ + + + + + account.journal + + + + + + + + + diff --git a/account_payment_manual_eligibility/wizards/__init__.py b/account_payment_manual_eligibility/wizards/__init__.py new file mode 100644 index 000000000..019698a88 --- /dev/null +++ b/account_payment_manual_eligibility/wizards/__init__.py @@ -0,0 +1 @@ +from . import account_payment_register diff --git a/account_payment_manual_eligibility/wizards/account_payment_register.py b/account_payment_manual_eligibility/wizards/account_payment_register.py new file mode 100644 index 000000000..451296b98 --- /dev/null +++ b/account_payment_manual_eligibility/wizards/account_payment_register.py @@ -0,0 +1,22 @@ +# Copyright (C) 2015 Akretion (http://www.akretion.com). + +from odoo import models +from odoo.fields import first + + +class AccountPaymentRegister(models.TransientModel): + _inherit = "account.payment.register" + + def _compute_journal_id(self): + res = super()._compute_journal_id() + allowed_journals = self.env["account.journal"].search( + [ + ("company_id", "=", self.env.company.id), + ("type", "in", ("bank", "cash")), + ("available_for_manual_payment", "=", True), + ] + ) + for rec in self: + if rec.journal_id not in allowed_journals: + rec.journal_id = first(allowed_journals) + return res diff --git a/account_payment_manual_eligibility/wizards/account_payment_register_views.xml b/account_payment_manual_eligibility/wizards/account_payment_register_views.xml new file mode 100644 index 000000000..0e37a10f8 --- /dev/null +++ b/account_payment_manual_eligibility/wizards/account_payment_register_views.xml @@ -0,0 +1,16 @@ + + + + + account.payment.register + + + + [('company_id', '=', company_id), ('type', 'in', ('bank', 'cash')), ('available_for_manual_payment', '=', True)] + + + + + diff --git a/setup/account_payment_manual_eligibility/odoo/addons/account_payment_manual_eligibility b/setup/account_payment_manual_eligibility/odoo/addons/account_payment_manual_eligibility new file mode 120000 index 000000000..52fe7e568 --- /dev/null +++ b/setup/account_payment_manual_eligibility/odoo/addons/account_payment_manual_eligibility @@ -0,0 +1 @@ +../../../../account_payment_manual_eligibility \ No newline at end of file diff --git a/setup/account_payment_manual_eligibility/setup.py b/setup/account_payment_manual_eligibility/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/account_payment_manual_eligibility/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)