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

TA#67304 [16.0][MIG] account_check_printing_aeroo #69

Merged
merged 2 commits into from
Nov 7, 2024
Merged
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
3 changes: 2 additions & 1 deletion .docker_files/main/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 25 additions & 0 deletions account_check_printing_aeroo/README.rst
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions account_check_printing_aeroo/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Check notice on line 4 in account_check_printing_aeroo/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

account_check_printing_aeroo/__init__.py#L4

'.models' imported but unused (F401)
25 changes: 25 additions & 0 deletions account_check_printing_aeroo/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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).

{

Check warning on line 4 in account_check_printing_aeroo/__manifest__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

account_check_printing_aeroo/__manifest__.py#L4

Statement seems to have no effect
"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,
}
Binary file not shown.
17 changes: 17 additions & 0 deletions account_check_printing_aeroo/demo/report.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<odoo noupdate="1">

<record id="sample_report" model="ir.actions.report">
<field name="name">Check Sample</field>
<field name="type">ir.actions.report</field>
<field name="model">account.payment</field>
<field name="report_name">check_ca</field>
<field name="report_type">aeroo</field>
<field name="aeroo_in_format">odt</field>
<field name="aeroo_out_format_id" ref="report_aeroo.aeroo_mimetype_pdf_odt" />
<field name="aeroo_template_path">account_check_printing_aeroo/demo/check_sample.odt</field>
<field name="aeroo_template_source">file</field>
<field name="aeroo_lang_eval">'en_US'</field>
</record>

</odoo>
47 changes: 47 additions & 0 deletions account_check_printing_aeroo/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -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"
4 changes: 4 additions & 0 deletions account_check_printing_aeroo/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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

Check notice on line 4 in account_check_printing_aeroo/models/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

account_check_printing_aeroo/models/__init__.py#L4

'.account_payment' imported but unused (F401)
16 changes: 16 additions & 0 deletions account_check_printing_aeroo/models/account_journal.py
Original file line number Diff line number Diff line change
@@ -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')]",
)
23 changes: 23 additions & 0 deletions account_check_printing_aeroo/models/account_payment.py
Original file line number Diff line number Diff line change
@@ -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()
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions account_check_printing_aeroo/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions account_check_printing_aeroo/tests/test_check_printing.py
Original file line number Diff line number Diff line change
@@ -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()
15 changes: 15 additions & 0 deletions account_check_printing_aeroo/views/account_journal.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>

<record id="view_account_journal_form" model="ir.ui.view">
<field name="name">account.journal.form</field>
<field name="model">account.journal</field>
<field name="inherit_id" ref="account_check_printing.view_account_journal_form_inherited" />
<field name="arch" type="xml">
<field name="check_next_number" position="after">
<field name="check_report_id" />
</field>
</field>
</record>

</odoo>
Loading