diff --git a/.docker_files/main/__manifest__.py b/.docker_files/main/__manifest__.py index f854857..ae59d26 100644 --- a/.docker_files/main/__manifest__.py +++ b/.docker_files/main/__manifest__.py @@ -11,8 +11,9 @@ "category": "Other", "summary": "Install all addons required for testing.", "depends": [ + "account_check_printing_aeroo", "report_aeroo", - "report_aeroo_replace_qweb" + "report_aeroo_replace_qweb", ], "installable": True, } diff --git a/Dockerfile b/Dockerfile index 51ce254..dd75be5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN pip3 install -r ./requirements.txt && rm ./requirements.txt USER odoo +COPY ./account_check_printing_aeroo /mnt/extra-addons/account_check_printing_aeroo COPY ./report_aeroo /mnt/extra-addons/report_aeroo COPY ./report_aeroo_replace_qweb /mnt/extra-addons/report_aeroo_replace_qweb diff --git a/account_check_printing_aeroo/README.rst b/account_check_printing_aeroo/README.rst new file mode 100644 index 0000000..dcd0d28 --- /dev/null +++ b/account_check_printing_aeroo/README.rst @@ -0,0 +1,25 @@ +Aeroo Check Printing +==================== + +This module allows creating check reports using Aeroo. + +Each journal (bank account) points to its own specific check report template. +When clicking on 'Print Check' on the payment, the appropriate Aeroo template is selected. + +Configuration +------------- +To define an Aeroo report as the check report: + +* Go to Invoicing / Configuration / Journals +* Select your bank/check journal +* In the Advanced Settings tab, under Check Printing, select your check report template. + +.. image:: static/description/account_journal_form.png + +Contributors +------------ +* Numigi (tm) and all its contributors (https://bit.ly/numigiens) + +More information +---------------- +* Meet us at https://bit.ly/numigi-com diff --git a/account_check_printing_aeroo/__init__.py b/account_check_printing_aeroo/__init__.py new file mode 100644 index 0000000..6681026 --- /dev/null +++ b/account_check_printing_aeroo/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import models diff --git a/account_check_printing_aeroo/__manifest__.py b/account_check_printing_aeroo/__manifest__.py new file mode 100644 index 0000000..9a3dfec --- /dev/null +++ b/account_check_printing_aeroo/__manifest__.py @@ -0,0 +1,25 @@ +# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +{ + "name": "Aeroo Check Printing", + "version": "16.0.1.0.0", + "author": "Numigi", + "maintainer": "numigi", + "website": "http://www.savoirfairelinux.com", + "license": "LGPL-3", + "category": "Accounting", + "summary": "Check Printing With Aeroo", + "depends": [ + "account_check_printing", + "report_aeroo", + ], + "data": [ + "views/account_journal.xml", + ], + "demo": [ + "demo/report.xml", + ], + "installable": True, + "application": False, +} diff --git a/account_check_printing_aeroo/demo/check_sample.odt b/account_check_printing_aeroo/demo/check_sample.odt new file mode 100644 index 0000000..dae5f60 Binary files /dev/null and b/account_check_printing_aeroo/demo/check_sample.odt differ diff --git a/account_check_printing_aeroo/demo/report.xml b/account_check_printing_aeroo/demo/report.xml new file mode 100644 index 0000000..1c17a49 --- /dev/null +++ b/account_check_printing_aeroo/demo/report.xml @@ -0,0 +1,17 @@ + + + + + Check Sample + ir.actions.report + account.payment + check_ca + aeroo + odt + + account_check_printing_aeroo/demo/check_sample.odt + file + 'en_US' + + + diff --git a/account_check_printing_aeroo/i18n/fr.po b/account_check_printing_aeroo/i18n/fr.po new file mode 100644 index 0000000..93cf6ff --- /dev/null +++ b/account_check_printing_aeroo/i18n/fr.po @@ -0,0 +1,47 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_check_printing_aeroo +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-11-07 11:07+0000\n" +"PO-Revision-Date: 2024-11-07 11:07+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_check_printing_aeroo +#: model:ir.model.fields,field_description:account_check_printing_aeroo.field_account_journal__check_report_id +msgid "Check Report" +msgstr "Rapport de chèque" + +#. module: account_check_printing_aeroo +#: model:ir.actions.report,name:account_check_printing_aeroo.sample_report +msgid "Check Sample" +msgstr "Chèque Démo" + +#. module: account_check_printing_aeroo +#. odoo-python +#: code:addons/account_check_printing_aeroo/models/account_payment.py:0 +#, python-format +msgid "" +"In order to generate checks in batch, all selected payments must belong to " +"the same journal (bank account)." +msgstr "" +"Afin de générer les chèques en lot, tous les paiements sélectionnés doivent " +"appartenir à un même journal (compte bancaire)." + +#. module: account_check_printing_aeroo +#: model:ir.model,name:account_check_printing_aeroo.model_account_journal +msgid "Journal" +msgstr "" + +#. module: account_check_printing_aeroo +#: model:ir.model,name:account_check_printing_aeroo.model_account_payment +msgid "Payments" +msgstr "Paiements" diff --git a/account_check_printing_aeroo/models/__init__.py b/account_check_printing_aeroo/models/__init__.py new file mode 100644 index 0000000..79f91e2 --- /dev/null +++ b/account_check_printing_aeroo/models/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2021 Numigi (tm) and all its contributors (https://bit.ly/numigiens) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import account_payment, account_journal diff --git a/account_check_printing_aeroo/models/account_journal.py b/account_check_printing_aeroo/models/account_journal.py new file mode 100644 index 0000000..543c229 --- /dev/null +++ b/account_check_printing_aeroo/models/account_journal.py @@ -0,0 +1,16 @@ +# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import fields, models + + +class AccountJournal(models.Model): + + _inherit = "account.journal" + + check_report_id = fields.Many2one( + "ir.actions.report", + "Check Report", + ondelete="restrict", + domain="[('report_type', '=', 'aeroo'), ('model', '=', 'account.payment')]", + ) diff --git a/account_check_printing_aeroo/models/account_payment.py b/account_check_printing_aeroo/models/account_payment.py new file mode 100644 index 0000000..852d7bc --- /dev/null +++ b/account_check_printing_aeroo/models/account_payment.py @@ -0,0 +1,23 @@ +# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo import models, _ +from odoo.exceptions import UserError + + +class AccountPayment(models.Model): + + _inherit = "account.payment" + + def do_print_checks(self): + journal = self.mapped("journal_id") + if len(journal) != 1: + raise UserError( + _( + "In order to generate checks in batch, all selected " + "payments must belong to the same journal (bank account)." + ) + ) + if journal.check_report_id: + return journal.check_report_id.report_action(self) + return super().do_print_checks() diff --git a/account_check_printing_aeroo/static/description/account_journal_form.png b/account_check_printing_aeroo/static/description/account_journal_form.png new file mode 100644 index 0000000..21c73ba Binary files /dev/null and b/account_check_printing_aeroo/static/description/account_journal_form.png differ diff --git a/account_check_printing_aeroo/static/description/icon.png b/account_check_printing_aeroo/static/description/icon.png new file mode 100644 index 0000000..92a86b1 Binary files /dev/null and b/account_check_printing_aeroo/static/description/icon.png differ diff --git a/account_check_printing_aeroo/tests/__init__.py b/account_check_printing_aeroo/tests/__init__.py new file mode 100644 index 0000000..cfa591d --- /dev/null +++ b/account_check_printing_aeroo/tests/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from . import test_check_printing diff --git a/account_check_printing_aeroo/tests/test_check_printing.py b/account_check_printing_aeroo/tests/test_check_printing.py new file mode 100644 index 0000000..afe910c --- /dev/null +++ b/account_check_printing_aeroo/tests/test_check_printing.py @@ -0,0 +1,35 @@ +# Copyright 2024 Numigi (tm) and all its contributors (https://bit.ly/numigiens) +# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). + +from odoo.tests.common import TransactionCase + + +class TestCheckPrinting(TransactionCase): + + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.partner = cls.env["res.partner"].search([], limit=1) + cls.report = cls.env.ref("account_check_printing_aeroo.sample_report") + cls.journal = cls.env["account.journal"].create( + { + "name": "BMO CAD", + "code": "BMO", + "type": "bank", + "check_report_id": cls.report.id, + } + ) + cls.payment = cls.env["account.payment"].create( + { + "partner_id": cls.partner.id, + "amount": 1234.56, + "journal_id": cls.journal.id, + "payment_type": "outbound", + "payment_method_id": cls.env.ref( + "account_check_printing.account_payment_method_check" + ).id, + } + ) + + def test_print_check(self): + self.payment.do_print_checks() diff --git a/account_check_printing_aeroo/views/account_journal.xml b/account_check_printing_aeroo/views/account_journal.xml new file mode 100644 index 0000000..1e7f3f7 --- /dev/null +++ b/account_check_printing_aeroo/views/account_journal.xml @@ -0,0 +1,15 @@ + + + + + account.journal.form + account.journal + + + + + + + + +