diff --git a/account_check_printing_report_base/README.rst b/account_check_printing_report_base/README.rst new file mode 100644 index 00000000000..ef8ef3bc4b4 --- /dev/null +++ b/account_check_printing_report_base/README.rst @@ -0,0 +1,108 @@ +================================== +Account Check Printing Report Base +================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:bb55783143c1ac5d84c90fa06d598eaaff087b45d912ea989d2b6855892a221d + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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--payment-lightgray.png?logo=github + :target: https://github.com/OCA/account-payment/tree/16.0/account_check_printing_report_base + :alt: OCA/account-payment +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/account-payment-16-0/account-payment-16-0-account_check_printing_report_base + :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-payment&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This module provides the basic framework for check printing, and a sample +layout. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +Go to 'Settings / Users / Companies' and assign the desired check format. +This module proposes a basic layout, but other modules such as +"account_check_printing_report_dlt103" provide formats adjusted to known +check formats such as DLT103. + +Usage +===== + +* Go to 'Invoicing / Vendors / Payments'. Select one of the payments with + type 'Check' and print the check. +* For automatic check printing when validating payment, mark the field in + the journal associated. + +Known issues / Roadmap +====================== + +* When print check automatically in the payment validation process, the wizard + remains opened. + +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 +~~~~~~~ + +* Eficent +* Serpent Consulting Services Pvt. Ltd. +* Ursa Information Systems + +Contributors +~~~~~~~~~~~~ + +* Jordi Ballester Alomar +* Lois Rilo Antelo +* Sandip Mangukiya +* Manuel Marquez +* `Tecnativa `_: + + * Luis M. Ontalba + * Carlos Roca + +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-payment `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_check_printing_report_base/__init__.py b/account_check_printing_report_base/__init__.py new file mode 100644 index 00000000000..bf588bc8b80 --- /dev/null +++ b/account_check_printing_report_base/__init__.py @@ -0,0 +1,2 @@ +from . import models +from . import report diff --git a/account_check_printing_report_base/__manifest__.py b/account_check_printing_report_base/__manifest__.py new file mode 100644 index 00000000000..af5c9b51dae --- /dev/null +++ b/account_check_printing_report_base/__manifest__.py @@ -0,0 +1,28 @@ +# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# Copyright 2016 Serpent Consulting Services Pvt. Ltd. +# Copyright 2017 Tecnativa. +# Copyright 2018 iterativo. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +{ + "name": "Account Check Printing Report Base", + "version": "16.0.1.0.0", + "license": "AGPL-3", + "author": "Eficent," + "Serpent Consulting Services Pvt. Ltd.," + "Ursa Information Systems," + "Odoo Community Association (OCA)", + "category": "Generic Modules/Accounting", + "website": "https://github.com/OCA/account-payment", + "depends": ["account_check_printing", "report_wkhtmltopdf_param"], + "external_dependencies": {"python": ["num2words"]}, + "data": [ + "security/ir.model.access.csv", + "data/report_paperformat.xml", + "views/account_journal_view.xml", + "views/report_check_base.xml", + "report/account_check_writing_report.xml", + ], + "installable": True, +} diff --git a/account_check_printing_report_base/data/report_paperformat.xml b/account_check_printing_report_base/data/report_paperformat.xml new file mode 100644 index 00000000000..d83e07b93f8 --- /dev/null +++ b/account_check_printing_report_base/data/report_paperformat.xml @@ -0,0 +1,33 @@ + + + + US Bank Check + + custom + 297 + 210 + Portrait + 3 + 3 + 3 + 3 + + 3 + 80 + + + Promissory Note Letter + + custom + 297 + 210 + Portrait + 40 + 0 + 0 + 0 + + 40 + 90 + + diff --git a/account_check_printing_report_base/i18n/account_check_printing_report_base.pot b/account_check_printing_report_base/i18n/account_check_printing_report_base.pot new file mode 100644 index 00000000000..0cbea1d6359 --- /dev/null +++ b/account_check_printing_report_base/i18n/account_check_printing_report_base.pot @@ -0,0 +1,156 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_check_printing_report_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \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_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +msgid "Check Amount:" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_account_journal__check_print_auto +msgid "Automatic check printing" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Balance Due" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_account_journal__account_check_printing_layout +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_res_company__account_check_printing_layout +msgid "Check Layout" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_res_company +msgid "Companies" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Dear partner" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,help:account_check_printing_report_base.field_account_journal__check_print_auto +msgid "" +"Default check for the company is printed automatically when invoice payment " +"is validated" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +msgid "Description" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Due Date" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Invoice / Reference" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Invoice date" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_journal +msgid "Journal" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Original Amount" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Payment" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.actions.report,name:account_check_printing_report_base.action_report_check_base +msgid "Payment Check Base" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.actions.report,name:account_check_printing_report_base.action_report_check_base_a4 +msgid "Payment Check Base A4" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_payment +msgid "Payments" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__account_journal__account_check_printing_layout__account_check_printing_report_base_action_report_check_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__res_company__account_check_printing_layout__account_check_printing_report_base_action_report_check_base +msgid "Print Check Base" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__account_journal__account_check_printing_layout__account_check_printing_report_base_action_report_check_base_a4 +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__res_company__account_check_printing_layout__account_check_printing_report_base_action_report_check_base_a4 +msgid "Print Check Base A4" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_payment_register +msgid "Register Payment" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_report_check_base +msgid "Report Check Print" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_report_check_base_a4 +msgid "Report Check Print for A4" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_promissory_footer_a4 +msgid "Report Promissory Note Print for A4" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,help:account_check_printing_report_base.field_account_journal__account_check_printing_layout +#: model:ir.model.fields,help:account_check_printing_report_base.field_res_company__account_check_printing_layout +msgid "" +"Select the format corresponding to the check paper you will be printing your checks on.\n" +"In order to disable the printing feature, select 'None'." +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Waiting for your agreement, regards." +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "We attach the list of invoices paid with this check with amount of" +msgstr "" diff --git a/account_check_printing_report_base/i18n/es.po b/account_check_printing_report_base/i18n/es.po new file mode 100644 index 00000000000..4f3bcb04080 --- /dev/null +++ b/account_check_printing_report_base/i18n/es.po @@ -0,0 +1,166 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_check_printing_report_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 13.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-10-05 07:47+0000\n" +"PO-Revision-Date: 2023-09-20 20:29+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +msgid "Check Amount:" +msgstr "Cantidad:" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_account_journal__check_print_auto +msgid "Automatic check printing" +msgstr "Impresión de cheque automático" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Balance Due" +msgstr "Saldo a pagar" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_account_journal__account_check_printing_layout +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_res_company__account_check_printing_layout +msgid "Check Layout" +msgstr "Plantilla de cheque" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_res_company +msgid "Companies" +msgstr "Compañías" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Dear partner" +msgstr "Estimado proveedor" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,help:account_check_printing_report_base.field_account_journal__check_print_auto +msgid "" +"Default check for the company is printed automatically when invoice payment " +"is validated" +msgstr "" +"El cheque predeterminado para la compañía es impreso automáticamente cuando " +"el pago es validado" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +msgid "Description" +msgstr "Descripción" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Due Date" +msgstr "Fecha de vencimiento" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Invoice / Reference" +msgstr "Factura / Referencia" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Invoice date" +msgstr "Fecha de factura" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_journal +msgid "Journal" +msgstr "Diario" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Original Amount" +msgstr "Importe" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Payment" +msgstr "Pago" + +#. module: account_check_printing_report_base +#: model:ir.actions.report,name:account_check_printing_report_base.action_report_check_base +msgid "Payment Check Base" +msgstr "Cheque de pago Base" + +#. module: account_check_printing_report_base +#: model:ir.actions.report,name:account_check_printing_report_base.action_report_check_base_a4 +msgid "Payment Check Base A4" +msgstr "Cheque de pago Base A4" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_payment +msgid "Payments" +msgstr "Pagos" + +#. module: account_check_printing_report_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__account_journal__account_check_printing_layout__account_check_printing_report_base_action_report_check_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__res_company__account_check_printing_layout__account_check_printing_report_base_action_report_check_base +msgid "Print Check Base" +msgstr "Imprimir base de cheques" + +#. module: account_check_printing_report_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__account_journal__account_check_printing_layout__account_check_printing_report_base_action_report_check_base_a4 +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__res_company__account_check_printing_layout__account_check_printing_report_base_action_report_check_base_a4 +msgid "Print Check Base A4" +msgstr "Base de impresión A4" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_payment_register +msgid "Register Payment" +msgstr "Registrar pago" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_report_check_base +msgid "Report Check Print" +msgstr "Informe de impresión de cheques" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_report_check_base_a4 +msgid "Report Check Print for A4" +msgstr "Cheque de pago Base A4" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_promissory_footer_a4 +msgid "Report Promissory Note Print for A4" +msgstr "Informe de impresión de pagarés para A4" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,help:account_check_printing_report_base.field_account_journal__account_check_printing_layout +#: model:ir.model.fields,help:account_check_printing_report_base.field_res_company__account_check_printing_layout +msgid "" +"Select the format corresponding to the check paper you will be printing your " +"checks on.\n" +"In order to disable the printing feature, select 'None'." +msgstr "" +"Seleccione el tamaño correspondiente al tamaño de cheque que va a imprimir.\n" +"Para desactivar la función de impresión, seleccione 'Ninguno'." + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Waiting for your agreement, regards." +msgstr "Esperando su acuerdo, saludos." + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "We attach the list of invoices paid with this check with amount of" +msgstr "" +"Adjuntamos el listado de facturas pagadas con este cheque con precio de" diff --git a/account_check_printing_report_base/i18n/pt.po b/account_check_printing_report_base/i18n/pt.po new file mode 100644 index 00000000000..2cb4046a507 --- /dev/null +++ b/account_check_printing_report_base/i18n/pt.po @@ -0,0 +1,198 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * account_check_printing_report_base +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2019-08-18 01:44+0000\n" +"Last-Translator: Pedro Castro Silva \n" +"Language-Team: none\n" +"Language: pt\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 3.7.1\n" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +msgid "Check Amount:" +msgstr "Montante do Cheque:" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_account_journal__check_print_auto +msgid "Automatic check printing" +msgstr "Impressão automática de cheques" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Balance Due" +msgstr "Saldo a Liquidar" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_account_journal__account_check_printing_layout +#: model:ir.model.fields,field_description:account_check_printing_report_base.field_res_company__account_check_printing_layout +msgid "Check Layout" +msgstr "Layout do Cheque" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_res_company +msgid "Companies" +msgstr "Empresas" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Dear partner" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,help:account_check_printing_report_base.field_account_journal__check_print_auto +msgid "" +"Default check for the company is printed automatically when invoice payment " +"is validated" +msgstr "" +"Predefinição - o cheque para a empresa é impresso automaticamente quando o " +"pagamento da fatura é validado" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +msgid "Description" +msgstr "Descrição" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Due Date" +msgstr "Data de Vencimento" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Invoice / Reference" +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Invoice date" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_journal +msgid "Journal" +msgstr "Diário" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Original Amount" +msgstr "Montante Original" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Payment" +msgstr "Pagamento" + +#. module: account_check_printing_report_base +#: model:ir.actions.report,name:account_check_printing_report_base.action_report_check_base +msgid "Payment Check Base" +msgstr "Base do Cheque de Pagamento" + +#. module: account_check_printing_report_base +#: model:ir.actions.report,name:account_check_printing_report_base.action_report_check_base_a4 +msgid "Payment Check Base A4" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_payment +msgid "Payments" +msgstr "Pagamentos" + +#. module: account_check_printing_report_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__account_journal__account_check_printing_layout__account_check_printing_report_base_action_report_check_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__res_company__account_check_printing_layout__account_check_printing_report_base_action_report_check_base +msgid "Print Check Base" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__account_journal__account_check_printing_layout__account_check_printing_report_base_action_report_check_base_a4 +#: model:ir.model.fields.selection,name:account_check_printing_report_base.selection__res_company__account_check_printing_layout__account_check_printing_report_base_action_report_check_base_a4 +msgid "Print Check Base A4" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_account_payment_register +msgid "Register Payment" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_report_check_base +msgid "Report Check Print" +msgstr "Imprimir Relatório de Cheque" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_report_check_base_a4 +msgid "Report Check Print for A4" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model,name:account_check_printing_report_base.model_report_account_check_printing_report_base_promissory_footer_a4 +msgid "Report Promissory Note Print for A4" +msgstr "" + +#. module: account_check_printing_report_base +#: model:ir.model.fields,help:account_check_printing_report_base.field_account_journal__account_check_printing_layout +#: model:ir.model.fields,help:account_check_printing_report_base.field_res_company__account_check_printing_layout +msgid "" +"Select the format corresponding to the check paper you will be printing your " +"checks on.\n" +"In order to disable the printing feature, select 'None'." +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "Waiting for your agreement, regards." +msgstr "" + +#. module: account_check_printing_report_base +#: model_terms:ir.ui.view,arch_db:account_check_printing_report_base.report_check_base_a4_document +msgid "We attach the list of invoices paid with this check with amount of" +msgstr "" + +#~ msgid "Account Payment Check Report" +#~ msgstr "Relatório de Impressão de Cheques" + +#~ msgid "Check Layouts" +#~ msgstr "Layouts de Cheques" + +#~ msgid "Check format" +#~ msgstr "Formato do cheque" + +#~ msgid "Check printing layout" +#~ msgstr "Layout de impressão de cheques" + +#~ msgid "Created by" +#~ msgstr "Criado por" + +#~ msgid "Created on" +#~ msgstr "Criado em" + +#~ msgid "Display Name" +#~ msgstr "Nome a Exibir" + +#~ msgid "Last Modified on" +#~ msgstr "Última Modific. em" + +#~ msgid "Last Updated on" +#~ msgstr "Última Atualização em" + +#~ msgid "Name" +#~ msgstr "Nome" + +#~ msgid "Report name" +#~ msgstr "Nome do relatório" + +#~ msgid "Register Payments" +#~ msgstr "Registar Pagamentos" diff --git a/account_check_printing_report_base/models/__init__.py b/account_check_printing_report_base/models/__init__.py new file mode 100644 index 00000000000..0bf0da32d71 --- /dev/null +++ b/account_check_printing_report_base/models/__init__.py @@ -0,0 +1,3 @@ +from . import account_journal +from . import account_payment +from . import res_company diff --git a/account_check_printing_report_base/models/account_journal.py b/account_check_printing_report_base/models/account_journal.py new file mode 100644 index 00000000000..bd240c3d69f --- /dev/null +++ b/account_check_printing_report_base/models/account_journal.py @@ -0,0 +1,26 @@ +# Copyright 2017 Tecnativa. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + +from .res_company import REPORTS_DEFINED + + +class AccountJournal(models.Model): + _inherit = "account.journal" + + check_print_auto = fields.Boolean( + string="Automatic check printing", + help="Default check for the company is printed automatically when " + "invoice payment is validated", + ) + account_check_printing_layout = fields.Selection( + string="Check Layout", + selection=REPORTS_DEFINED, + # Set default False to allow using same ondelete as res.company when inheriting + # this module. + default=False, + help="Select the format corresponding to the check paper you will be printing " + "your checks on.\n" + "In order to disable the printing feature, select 'None'.", + ) diff --git a/account_check_printing_report_base/models/account_payment.py b/account_check_printing_report_base/models/account_payment.py new file mode 100644 index 00000000000..9a5de2a8c90 --- /dev/null +++ b/account_check_printing_report_base/models/account_payment.py @@ -0,0 +1,56 @@ +# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# Copyright 2016 Serpent Consulting Services Pvt. Ltd. +# Copyright 2018 iterativo. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import models + + +class AccountRegisterPayments(models.TransientModel): + _inherit = "account.payment.register" + + def action_create_payments(self): + res = super().action_create_payments() + if ( + self.journal_id.check_print_auto + and self.payment_method_line_id.code == "check_printing" + ): + payment = self.env["account.payment"].search( + [ + ("journal_id", "=", self.journal_id.id), + ( + "payment_method_line_id.name", + "like", + self.payment_method_line_id.name, + ), + ], + order="id desc", + limit=1, + ) + return payment.do_print_checks() + return res + + +class AccountPayment(models.Model): + _inherit = "account.payment" + + def do_print_checks(self): + for rec in self: + if rec.journal_id.account_check_printing_layout: + report_action = self.env.ref( + rec.journal_id.account_check_printing_layout, False + ) + self.write({"is_move_sent": True}) + return report_action.report_action(self) + return super().do_print_checks() + + def action_post(self): + res = super().action_post() + recs = self.filtered( + lambda x: x.journal_id.check_print_auto + and x.payment_method_line_id.code == "check_printing" + ) + if recs: + return recs.do_print_checks() + return res diff --git a/account_check_printing_report_base/models/res_company.py b/account_check_printing_report_base/models/res_company.py new file mode 100644 index 00000000000..658e144be1c --- /dev/null +++ b/account_check_printing_report_base/models/res_company.py @@ -0,0 +1,23 @@ +# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# Copyright 2016 Serpent Consulting Services Pvt. Ltd. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from odoo import fields, models + +REPORTS_DEFINED = [ + ("account_check_printing_report_base.action_report_check_base", "Print Check Base"), + ( + "account_check_printing_report_base.action_report_check_base_a4", + "Print Check Base A4", + ), +] +REPORTS_DEFINED_ONDELETE = {r[0]: "set default" for r in REPORTS_DEFINED} + + +class ResCompany(models.Model): + _inherit = "res.company" + + account_check_printing_layout = fields.Selection( + selection_add=REPORTS_DEFINED, ondelete=REPORTS_DEFINED_ONDELETE + ) diff --git a/account_check_printing_report_base/readme/CONFIGURE.rst b/account_check_printing_report_base/readme/CONFIGURE.rst new file mode 100644 index 00000000000..7cd12eeea1a --- /dev/null +++ b/account_check_printing_report_base/readme/CONFIGURE.rst @@ -0,0 +1,4 @@ +Go to 'Settings / Users / Companies' and assign the desired check format. +This module proposes a basic layout, but other modules such as +"account_check_printing_report_dlt103" provide formats adjusted to known +check formats such as DLT103. diff --git a/account_check_printing_report_base/readme/CONTRIBUTORS.rst b/account_check_printing_report_base/readme/CONTRIBUTORS.rst new file mode 100644 index 00000000000..f6c62f83b8e --- /dev/null +++ b/account_check_printing_report_base/readme/CONTRIBUTORS.rst @@ -0,0 +1,8 @@ +* Jordi Ballester Alomar +* Lois Rilo Antelo +* Sandip Mangukiya +* Manuel Marquez +* `Tecnativa `_: + + * Luis M. Ontalba + * Carlos Roca diff --git a/account_check_printing_report_base/readme/DESCRIPTION.rst b/account_check_printing_report_base/readme/DESCRIPTION.rst new file mode 100644 index 00000000000..7f9e98f4e68 --- /dev/null +++ b/account_check_printing_report_base/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +This module provides the basic framework for check printing, and a sample +layout. diff --git a/account_check_printing_report_base/readme/ROADMAP.rst b/account_check_printing_report_base/readme/ROADMAP.rst new file mode 100644 index 00000000000..849c28da498 --- /dev/null +++ b/account_check_printing_report_base/readme/ROADMAP.rst @@ -0,0 +1,2 @@ +* When print check automatically in the payment validation process, the wizard + remains opened. diff --git a/account_check_printing_report_base/readme/USAGE.rst b/account_check_printing_report_base/readme/USAGE.rst new file mode 100644 index 00000000000..6995fe99dcf --- /dev/null +++ b/account_check_printing_report_base/readme/USAGE.rst @@ -0,0 +1,4 @@ +* Go to 'Invoicing / Vendors / Payments'. Select one of the payments with + type 'Check' and print the check. +* For automatic check printing when validating payment, mark the field in + the journal associated. diff --git a/account_check_printing_report_base/report/__init__.py b/account_check_printing_report_base/report/__init__.py new file mode 100644 index 00000000000..40e745c32ed --- /dev/null +++ b/account_check_printing_report_base/report/__init__.py @@ -0,0 +1,2 @@ +from . import check_print +from . import lang diff --git a/account_check_printing_report_base/report/account_check_writing_report.xml b/account_check_printing_report_base/report/account_check_writing_report.xml new file mode 100644 index 00000000000..0a64a8bdd88 --- /dev/null +++ b/account_check_printing_report_base/report/account_check_writing_report.xml @@ -0,0 +1,30 @@ + + + + Payment Check Base + account.payment + qweb-pdf + account_check_printing_report_base.report_check_base + account_check_printing_report_base.report_check_base + + + + Payment Check Base A4 + account.payment + qweb-pdf + account_check_printing_report_base.report_check_base_a4 + account_check_printing_report_base.report_check_base_a4 + + + diff --git a/account_check_printing_report_base/report/check_print.py b/account_check_printing_report_base/report/check_print.py new file mode 100644 index 00000000000..57757dc06c2 --- /dev/null +++ b/account_check_printing_report_base/report/check_print.py @@ -0,0 +1,141 @@ +# Copyright 2016 Eficent Business and IT Consulting Services S.L. +# (http://www.eficent.com) +# Copyright 2016 Serpent Consulting Services Pvt. Ltd. +# Copyright 2018 iterativo. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +import time + +from odoo import api, models +from odoo.tools import float_is_zero + +from . import lang + + +class ReportCheckPrint(models.AbstractModel): + _name = "report.account_check_printing_report_base.report_check_base" + _description = "Report Check Print" + + @api.model + def fill_stars_number(self, amount, stars_prefix=5, stars_suffix=1): + str_prefix = " ".join(["*" * stars_prefix, amount, "*" * stars_suffix]) + return str_prefix + + def _format_date_to_partner_lang(self, date, partner_id): + lang_code = self.env["res.partner"].browse(partner_id).lang + lang = self.env["res.lang"]._lang_get(lang_code) + return date.strftime(lang.date_format) + + @api.model + def fill_stars(self, amount_in_word): + if amount_in_word and len(amount_in_word) < 100: + stars = 100 - len(amount_in_word) + return " ".join([amount_in_word, "*" * stars]) + else: + return amount_in_word + + def _get_residual_amount(self, payment, line): + amt = line.amount_residual + if amt < 0.0: + amt *= -1 + amt = payment.company_id.currency_id.with_context(date=payment.date).compute( + amt, payment.currency_id + ) + return amt + + def _get_total_amount(self, payment, line): + amt = line.balance + if amt < 0.0: + amt *= -1 + amt = payment.company_id.currency_id.with_context(date=payment.date).compute( + amt, payment.currency_id + ) + return amt + + def _get_paid_amount(self, payment, line): + amount = 0.0 + total_amount_to_show = 0.0 + # We pay out + if line.matched_credit_ids: + amount = sum(p.amount for p in line.matched_credit_ids) + # We receive payment + elif line.matched_debit_ids: + amount = sum(p.amount for p in line.matched_debit_ids) + + amount_to_show = payment.company_id.currency_id.with_context( + date=payment.date + ).compute(amount, payment.currency_id) + if not float_is_zero( + amount_to_show, precision_rounding=payment.currency_id.rounding + ): + total_amount_to_show = amount_to_show + return total_amount_to_show + + def get_paid_lines(self, payments): + lines = {} + for payment in payments: + lines[payment.id] = [] + pay_acc = payment.outstanding_account_id + rec_lines = payment.line_ids.filtered( + lambda x: x.account_id.reconcile and x.account_id != pay_acc + ) + amls = rec_lines.mapped( + "matched_credit_ids.credit_move_id" + ) + rec_lines.mapped("matched_debit_ids.debit_move_id") + amls -= rec_lines + for aml in amls: + date_due = aml.date_maturity + total_amt = self._get_total_amount(payment, aml) + residual_amt = self._get_residual_amount(payment, aml) + paid_amt = self._get_paid_amount(payment, aml) + line = { + "date_due": date_due, + "date": aml.date, + "reference": aml.display_name, + "number": aml.name, + "amount_total": total_amt, + "residual": residual_amt, + "paid_amount": paid_amt, + } + lines[payment.id].append(line) + return lines + + @api.model + def _get_report_values(self, docids, data=None): + model = self.env.context.get("active_model", "account.payment") + objects = self.env[model].browse(docids) + paid_lines = self.get_paid_lines(objects) + docargs = { + "doc_ids": docids, + "doc_model": model, + "docs": objects, + "time": time, + "fill_stars": self.fill_stars, + "fill_stars_number": self.fill_stars_number, + "paid_lines": paid_lines, + "_format_date_to_partner_lang": self._format_date_to_partner_lang, + } + return docargs + + +class ReportCheckPrintA4(models.AbstractModel): + _name = "report.account_check_printing_report_base.report_check_base_a4" + _inherit = "report.account_check_printing_report_base.report_check_base" + _description = "Report Check Print for A4" + + +class ReportPromissoryNotePrint(models.AbstractModel): + _name = "report.account_check_printing_report_base.promissory_footer_a4" + _inherit = "report.account_check_printing_report_base.report_check_base_a4" + _description = "Report Promissory Note Print for A4" + + def amount2words(self, amount): + return lang.num2words_custom( + amount, to="currency", lang=self.env.context.get("lang", "en_US") + ) + + @api.model + def _get_report_values(self, docids, data=None): + res = super()._get_report_values(docids, data=data) + res.update({"fill_stars": self.fill_stars, "num2words": self.amount2words}) + return res diff --git a/account_check_printing_report_base/report/lang.py b/account_check_printing_report_base/report/lang.py new file mode 100644 index 00000000000..078922d4a20 --- /dev/null +++ b/account_check_printing_report_base/report/lang.py @@ -0,0 +1,40 @@ +from num2words import CONVERTER_CLASSES, CONVERTES_TYPES, num2words +from num2words.base import Num2Word_Base +from num2words.lang_ES import Num2Word_ES + +num2words_by_lang = {"es": "Num2WordESCustom"} + + +class Num2WordESCustom(Num2Word_ES): + CURRENCY_FORMS = Num2Word_ES.CURRENCY_FORMS.copy() + CURRENCY_FORMS.update({"EUR": (("euro", "euros"), ("céntimo", "céntimos"))}) + + # TODO: PR to remove overwrite in num2words code and use CURRENCY_FORMS + def to_currency(self, val, longval=True, old=False): + try: + # On older versions we need to use "seperator" instead of "separator" + return Num2Word_Base.to_currency( + self, val, currency="EUR", cents=True, seperator=" con", adjective=False + ) + except TypeError: + return Num2Word_Base.to_currency( + self, val, currency="EUR", cents=True, separator=" con", adjective=False + ) + + +def num2words_custom(number, ordinal=False, lang="en", to="cardinal", **kwargs): + if lang not in CONVERTER_CLASSES: + # ... and then try only the first 2 letters + lang = lang[:2] + if lang not in CONVERTER_CLASSES: + raise NotImplementedError() + if lang not in num2words_by_lang: + return num2words(number, ordinal, lang, to, **kwargs) + else: + # Fixed implementation + converter = globals()[num2words_by_lang[lang]]() + if ordinal: + return converter.to_ordinal(number) + if to not in CONVERTES_TYPES: + raise NotImplementedError() + return getattr(converter, "to_{}".format(to))(number, **kwargs) diff --git a/account_check_printing_report_base/security/ir.model.access.csv b/account_check_printing_report_base/security/ir.model.access.csv new file mode 100644 index 00000000000..e9b5586993c --- /dev/null +++ b/account_check_printing_report_base/security/ir.model.access.csv @@ -0,0 +1,4 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_report_account_check_printing_report_base_report_check_base,report.account_check_printing_report_base.report_check_base,model_report_account_check_printing_report_base_report_check_base,base.group_user,1,1,1,1 +access_report_account_check_printing_report_base_report_check_base_a4,report.account_check_printing_report_base.report_check_base_a4,model_report_account_check_printing_report_base_report_check_base_a4,base.group_user,1,1,1,1 +access_report_account_check_printing_report_base_promissory_footer_a4,report.account_check_printing_report_base.promissory_footer_a4,model_report_account_check_printing_report_base_promissory_footer_a4,base.group_user,1,1,1,1 diff --git a/account_check_printing_report_base/static/description/icon.png b/account_check_printing_report_base/static/description/icon.png new file mode 100644 index 00000000000..3a0328b516c Binary files /dev/null and b/account_check_printing_report_base/static/description/icon.png differ diff --git a/account_check_printing_report_base/static/description/index.html b/account_check_printing_report_base/static/description/index.html new file mode 100644 index 00000000000..b60fa9d1dd8 --- /dev/null +++ b/account_check_printing_report_base/static/description/index.html @@ -0,0 +1,465 @@ + + + + + + +Account Check Printing Report Base + + + +
+

Account Check Printing Report Base

+ + +

Beta License: AGPL-3 OCA/account-payment Translate me on Weblate Try me on Runboat

+

This module provides the basic framework for check printing, and a sample +layout.

+

Table of contents

+ +
+

Configuration

+

Go to ‘Settings / Users / Companies’ and assign the desired check format. +This module proposes a basic layout, but other modules such as +“account_check_printing_report_dlt103” provide formats adjusted to known +check formats such as DLT103.

+
+
+

Usage

+
    +
  • Go to ‘Invoicing / Vendors / Payments’. Select one of the payments with +type ‘Check’ and print the check.
  • +
  • For automatic check printing when validating payment, mark the field in +the journal associated.
  • +
+
+
+

Known issues / Roadmap

+
    +
  • When print check automatically in the payment validation process, the wizard +remains opened.
  • +
+
+
+

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

+
    +
  • Eficent
  • +
  • Serpent Consulting Services Pvt. Ltd.
  • +
  • Ursa Information Systems
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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-payment project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/account_check_printing_report_base/tests/__init__.py b/account_check_printing_report_base/tests/__init__.py new file mode 100644 index 00000000000..5d9ea1394fc --- /dev/null +++ b/account_check_printing_report_base/tests/__init__.py @@ -0,0 +1,2 @@ +from . import test_check_printing_report +from . import test_num2words_lang_solution diff --git a/account_check_printing_report_base/tests/test_check_printing_report.py b/account_check_printing_report_base/tests/test_check_printing_report.py new file mode 100644 index 00000000000..043dcee28e7 --- /dev/null +++ b/account_check_printing_report_base/tests/test_check_printing_report.py @@ -0,0 +1,207 @@ +# © 2016 Eficent Business and IT Consulting Services S.L. +# Copyright 2018 iterativo. +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +import time + +from odoo import fields +from odoo.exceptions import RedirectWarning +from odoo.tests.common import TransactionCase + + +class TestAccountCheckPrintingReportBase(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.langs = ("en_US", "es_ES") + cls.rl = cls.env["res.lang"] + for lang in cls.langs: + if not cls.rl.search([("code", "=", lang)]): + cls.rl.load_lang(lang) + cls.account_invoice_model = cls.env["account.move"] + cls.journal_model = cls.env["account.journal"] + cls.payment_method_model = cls.env["account.payment.method"] + cls.account_account_model = cls.env["account.account"] + cls.payment_model = cls.env["account.payment"] + cls.report = cls.env[ + "report.account_check_printing_report_base.report_check_base" + ] + + cls.partner1 = cls.env.ref("base.res_partner_1") + cls.company = cls.env.ref("base.main_company") + cls.currency_usd_id = cls.env.ref("base.USD").id + cls.currency_euro_id = cls.env.ref("base.EUR").id + cls.acc_payable = "liability_payable" + cls.acc_expense = "expense" + cls.product = cls.env.ref("product.product_product_4") + cls.check_report = "account_check_printing_report_base.action_report_check_base" + cls.check_report_a4 = ( + "account_check_printing_report_base.action_report_check_base_a4" + ) + cls.action_check_report = ( + "account_check_printing_report_base.action_report_check_base" + ) + cls.payment_method_check = cls.payment_method_model.search( + [("code", "=", "check_printing")], + limit=1, + ) + if not cls.payment_method_check: + cls.payment_method_check = cls.payment_method_model.create( + { + "name": "Check", + "code": "check_printing", + "payment_type": "outbound", + "check": True, + } + ) + cls.purchase_journal = cls.journal_model.create( + {"name": "Purchase Journal - Test", "type": "purchase", "code": "Test"} + ) + cls.bank_journal = cls.journal_model.create( + { + "name": "Cash Journal - Test", + "type": "bank", + "code": "bank", + "check_manual_sequencing": True, + # "outbound_payment_method_ids": [ + # (4, cls.payment_method_check.id, None) + # ], + } + ) + cls.acc_payable = cls._create_account( + "account payable test", "ACPRB1", cls.acc_payable, True + ) + cls.vendor_bill = cls._create_vendor_bill(cls.acc_payable) + cls.vendor_bill.invoice_date = time.strftime("%Y") + "-07-15" + cls.acc_expense = cls._create_account( + "account expense test", "ACPRB2", cls.acc_expense, False + ) + cls._create_invoice_line(cls.acc_expense, cls.vendor_bill) + + cls.vendor_bill.action_post() + # Pay the invoice using a bank journal associated to the main company + ctx = {"active_model": "account.move", "active_ids": [cls.vendor_bill.id]} + register_payments = cls.payment_model.with_context(**ctx).create( + { + "date": time.strftime("%Y") + "-07-15", + "journal_id": cls.bank_journal.id, + "payment_method_line_id": cls.payment_method_check.id, + } + ) + register_payments.action_post() + cls.payment = cls.payment_model.search([], order="id desc", limit=1) + + @classmethod + def _create_account(cls, name, code, user_type, reconcile): + account = cls.account_account_model.create( + { + "name": name, + "code": code, + "account_type": user_type, + "company_id": cls.company.id, + "reconcile": reconcile, + } + ) + return account + + @classmethod + def _create_vendor_bill(cls, account): + vendor_bill = cls.account_invoice_model.create( + { + "move_type": "in_invoice", + "partner_id": cls.partner1.id, + "currency_id": cls.company.currency_id.id, + "journal_id": cls.purchase_journal.id, + "company_id": cls.company.id, + } + ) + return vendor_bill + + @classmethod + def _create_invoice_line(cls, account, invoice): + invoice = invoice.write( + { + "invoice_line_ids": [ + ( + 0, + 0, + { + "name": "Test invoice line", + "account_id": account.id, + "quantity": 1.000, + "price_unit": 2.99, + "product_id": cls.product.id, + }, + ) + ] + } + ) + + return invoice + + def test_01_check_printing_no_layout(self): + """Test if the exception raises when no layout is set for a + company or for the journal.""" + with self.assertRaises(RedirectWarning): + self.payment.do_print_checks() + + # Set check layout verification by journal + ICPSudo = self.env["ir.config_parameter"].sudo() + ICPSudo.set_param( + "account_check_printing_report_base.check_layout_verification", "by_journal" + ) + self.assertFalse(self.payment.journal_id.account_check_printing_layout) + with self.assertRaises(RedirectWarning): + self.payment.do_print_checks() + content = self.env["ir.actions.report"]._render_qweb_pdf( + self.action_check_report, res_ids=self.payment.ids + ) + self.assertEqual(content[1], "html") + + def test_02_check_printing_with_layout(self): + """Test if the check is printed when the layout is specified for a + company and journal.""" + + self.company.account_check_printing_layout = self.check_report + self.payment.journal_id.account_check_printing_layout = self.check_report_a4 + e = False + try: + self.payment.do_print_checks() + except RedirectWarning as e: + e = e.name + self.assertEqual(e, False) + + content = self.env["ir.actions.report"]._render_qweb_pdf( + self.action_check_report, res_ids=self.payment.ids + ) + self.assertEqual(content[1], "html") + + def test_03_fotmat_form(self): + """Test formatting on check form""" + # Convert date to formatting from partner : 2020-01-20 > 01/20/2020 + today = fields.Date.today() + date = self.report._format_date_to_partner_lang(today, self.partner1.id) + self.assertEqual(date, today.strftime("%m/%d/%Y")) + # Fill starts in amount + amount = 100.0 + amount_in_word = "One Hundred Euro" + stars = 100 - len(amount_in_word) + amount1 = self.report.fill_stars_number(str(amount)) + amount2 = self.report.fill_stars(amount_in_word) + self.assertEqual(amount1, "***** %s *" % amount) + self.assertEqual(amount2, "{} {}".format(amount_in_word, ("*" * stars))) + + def test_num2words(self): + report_model = "report.account_check_printing_report_base.promissory_footer_a4" + words_number = ( + self.env[report_model].with_context(lang="en_US").amount2words(4.9) + ) + self.assertEqual(words_number, "four euro, ninety cents") + words_number = ( + self.env[report_model].with_context(lang="es_ES").amount2words(4.9) + ) + self.assertEqual(words_number, "cuatro euros con noventa céntimos") + words_number = ( + self.env[report_model].with_context(lang="es_ES").amount2words(4.95) + ) + self.assertEqual(words_number, "cuatro euros con noventa y cinco céntimos") diff --git a/account_check_printing_report_base/tests/test_num2words_lang_solution.py b/account_check_printing_report_base/tests/test_num2words_lang_solution.py new file mode 100644 index 00000000000..74f8be55b68 --- /dev/null +++ b/account_check_printing_report_base/tests/test_num2words_lang_solution.py @@ -0,0 +1,28 @@ +# Copyright 2017 Tecnativa - Carlos Roca +from odoo.tests.common import TransactionCase + + +class TestNum2WordsLangSolution(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.propissory_note_amount = cls.env[ + "report.account_check_printing_report_base.promissory_footer_a4" + ] + cls.amount = 3.09 + + def test_num2words_es_correction(self): + amount_in_word = self.propissory_note_amount.with_context( + lang="es" + ).amount2words(self.amount) + self.assertEqual("tres euros con nueve céntimos", amount_in_word) + amount_in_word_stars = self.propissory_note_amount.fill_stars(amount_in_word) + stars = "*" * (100 - len(amount_in_word)) + self.assertEqual(amount_in_word_stars, amount_in_word + " " + stars) + + def test_num2words_normal_flux(self): + amount_in_word = self.propissory_note_amount.amount2words(self.amount) + self.assertEqual("three euro, nine cents", amount_in_word) + amount_in_word_stars = self.propissory_note_amount.fill_stars(amount_in_word) + stars = "*" * (100 - len(amount_in_word)) + self.assertEqual(amount_in_word_stars, amount_in_word + " " + stars) diff --git a/account_check_printing_report_base/views/account_journal_view.xml b/account_check_printing_report_base/views/account_journal_view.xml new file mode 100644 index 00000000000..b981c58105d --- /dev/null +++ b/account_check_printing_report_base/views/account_journal_view.xml @@ -0,0 +1,17 @@ + + + + account.journal.form.inherited + account.journal + + + + + + + + + diff --git a/account_check_printing_report_base/views/report_check_base.xml b/account_check_printing_report_base/views/report_check_base.xml new file mode 100644 index 00000000000..6667b073fdd --- /dev/null +++ b/account_check_printing_report_base/views/report_check_base.xml @@ -0,0 +1,188 @@ + + + + + + diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000000..27f28b32e74 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +# generated from manifests external_dependencies +num2words diff --git a/setup/account_check_printing_report_base/odoo/addons/account_check_printing_report_base b/setup/account_check_printing_report_base/odoo/addons/account_check_printing_report_base new file mode 120000 index 00000000000..d4fb3077c79 --- /dev/null +++ b/setup/account_check_printing_report_base/odoo/addons/account_check_printing_report_base @@ -0,0 +1 @@ +../../../../account_check_printing_report_base \ No newline at end of file diff --git a/setup/account_check_printing_report_base/setup.py b/setup/account_check_printing_report_base/setup.py new file mode 100644 index 00000000000..28c57bb6403 --- /dev/null +++ b/setup/account_check_printing_report_base/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)