From bafffd0eded6a7eb71570d3f22bfb91dc19ba4bc Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Thu, 25 Feb 2016 19:00:50 +0100 Subject: [PATCH] [IMP] account_banking_payment_export: Add option for not grouping lines There can be multiple reasons for not grouping payment lines: * The customer needs each payment line individually for matching references. * For avoiding the risk of returning a big amount. * For not overpassing amout limits. * ... So with this commit, you have the possibility of selecting at payment mode level if you want to group or not --- account_banking_payment_export/__openerp__.py | 4 +- account_banking_payment_export/i18n/es.po | 40 ++++++++++++++++--- .../models/account_payment.py | 10 ++++- .../models/payment_mode.py | 15 ++++++- .../views/payment_mode.xml | 3 ++ 5 files changed, 61 insertions(+), 11 deletions(-) diff --git a/account_banking_payment_export/__openerp__.py b/account_banking_payment_export/__openerp__.py index 0e1c7c1ac..8ec98141e 100644 --- a/account_banking_payment_export/__openerp__.py +++ b/account_banking_payment_export/__openerp__.py @@ -2,12 +2,12 @@ # © 2009 EduSense BV () # © 2011-2013 Therp BV () # © 2013-2014 ACSONE SA (). -# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# © 2014-2016 Serv. Tecnol. Avanzados - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { 'name': 'Account Banking - Payments Export Infrastructure', - 'version': '8.0.0.2.0', + 'version': '8.0.0.3.0', 'license': 'AGPL-3', 'author': "ACSONE SA/NV, " "Therp BV, " diff --git a/account_banking_payment_export/i18n/es.po b/account_banking_payment_export/i18n/es.po index 40f1ad5af..ef7840f71 100644 --- a/account_banking_payment_export/i18n/es.po +++ b/account_banking_payment_export/i18n/es.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-02-18 08:37+0000\n" -"PO-Revision-Date: 2016-02-18 08:37+0000\n" +"POT-Creation-Date: 2016-02-25 17:56+0000\n" +"PO-Revision-Date: 2016-02-25 17:56+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -29,6 +29,7 @@ msgid "Active" msgstr "Activo" #. module: account_banking_payment_export +#: field:bank.payment.line,amount_currency:0 #: view:payment.order:account_banking_payment_export.view_payment_order_form msgid "Amount" msgstr "Importe" @@ -123,7 +124,7 @@ msgid "Entry Information" msgstr "Información del asiento" #. module: account_banking_payment_export -#: code:addons/account_banking_payment_export/wizard/payment_order_create.py:149 +#: code:addons/account_banking_payment_export/wizard/payment_order_create.py:152 #, python-format msgid "Entry Lines" msgstr "Líneas de pago" @@ -144,6 +145,11 @@ msgstr "Tipo de exportación" msgid "General Information" msgstr "Información General" +#. module: account_banking_payment_export +#: field:payment.mode,group_lines:0 +msgid "Group lines in payment orders" +msgstr "Agrupar líneas en las órdenes de pago" + #. module: account_banking_payment_export #: field:bank.payment.line,id:0 #: field:payment.manual,id:0 @@ -151,6 +157,23 @@ msgstr "Información General" msgid "ID" msgstr "ID" +#. module: account_banking_payment_export +#: help:payment.mode,group_lines:0 +msgid "If this mark is checked, the payment order lines will be grouped when validating the payment order before exporting the bank file. The grouping will be done only if the following fields matches:\n" +"* Partner\n" +"* Currency\n" +"* Destination Bank Account\n" +"* Communication Type (structured, free)\n" +"* Payment Date\n" +"(other modules can set additional fields to restrict the grouping.)" +msgstr "Si esta casilla está marcada, las líneas de las órdenes de pago serán agrupadas cuando se valide la orden de pago antes de la exportación al archivo bancario. La agrupación se realizará sólo si los siguientes campos casan:\n" +"* Empresa\n" +"* Moneda\n" +"* Cuenta bancaria destino\n" +"* Tipo de comunicacion (estructurada, libre)\n" +"* Fecha de pago\n" +"(otros módulo pueden establecer campos adicionales para restringir la agrupación.)" + #. module: account_banking_payment_export #: view:payment.order:account_banking_payment_export.view_payment_order_form msgid "Information" @@ -197,6 +220,11 @@ msgstr "Última actualización por" msgid "Last Updated on" msgstr "Última actualización en" +#. module: account_banking_payment_export +#: view:payment.mode:account_banking_payment_export.view_payment_mode_form_inherit +msgid "Line grouping" +msgstr "Agrupación de líneas" + #. module: account_banking_payment_export #: field:payment.mode,default_invoice:0 #: field:payment.order.create,invoice:0 @@ -297,7 +325,7 @@ msgid "Payment Order Export" msgstr "Exportación de la orden de pago" #. module: account_banking_payment_export -#: code:addons/account_banking_payment_export/wizard/payment_order_create.py:243 +#: code:addons/account_banking_payment_export/wizard/payment_order_create.py:246 #, python-format msgid "Payment Orders" msgstr "Órdenes de pago" @@ -342,7 +370,7 @@ msgstr "Líneas de pago relacionadas" #. module: account_banking_payment_export #: view:payment.mode:account_banking_payment_export.view_payment_mode_form_inherit msgid "Select Move Lines to Pay - Default Values" -msgstr "Seleccione los apuntes a pagar - Valores por defecto" +msgstr "Selección de los apuntes - Valores por defecto" #. module: account_banking_payment_export #: help:payment.mode,type:0 @@ -387,7 +415,7 @@ msgid "Suitable bank types" msgstr "Tipos de cuentas bancarias adecuadas" #. module: account_banking_payment_export -#: code:addons/account_banking_payment_export/models/account_payment.py:146 +#: code:addons/account_banking_payment_export/models/account_payment.py:151 #, python-format msgid "The amount for Partner '%s' is negative or null (%.2f) !" msgstr "El importe para el empresa '%s' es negativo o nulo (%.2f) !" diff --git a/account_banking_payment_export/models/account_payment.py b/account_banking_payment_export/models/account_payment.py index e3bf51270..2508b8804 100644 --- a/account_banking_payment_export/models/account_payment.py +++ b/account_banking_payment_export/models/account_payment.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # © 2009 EduSense BV () # © 2011-2013 Therp BV () +# © 2016 Serv. Tecnol. Avanzados - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api, exceptions, workflow, _ @@ -129,7 +130,12 @@ class PaymentOrder(models.Model): requested_date = today # Write requested_date on 'date' field of payment line payline.date = requested_date - hashcode = payline.payment_line_hashcode() + # Group options + if order.mode.group_lines: + hashcode = payline.payment_line_hashcode() + else: + # Use line ID as hascode, which actually means no grouping + hashcode = payline.id if hashcode in group_paylines: group_paylines[hashcode]['paylines'] += payline group_paylines[hashcode]['total'] +=\ @@ -138,7 +144,7 @@ class PaymentOrder(models.Model): group_paylines[hashcode] = { 'paylines': payline, 'total': payline.amount_currency, - } + } # Create bank payment lines for paydict in group_paylines.values(): # Block if a bank payment line is <= 0 diff --git a/account_banking_payment_export/models/payment_mode.py b/account_banking_payment_export/models/payment_mode.py index 67e1b612b..152acf0b3 100644 --- a/account_banking_payment_export/models/payment_mode.py +++ b/account_banking_payment_export/models/payment_mode.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # © 2009 EduSense BV () # © 2011-2013 Therp BV () -# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# © 2014-2016 Serv. Tecnol. Avanzados - Pedro M. Baeza # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from openerp import models, fields, api, SUPERUSER_ID @@ -91,6 +91,19 @@ class PaymentMode(models.Model): ], default='due', string="Type of Date Filter") default_populate_results = fields.Boolean( string='Populate Results Directly') + group_lines = fields.Boolean( + string="Group lines in payment orders", default=True, + help="If this mark is checked, the payment order lines will be " + "grouped when validating the payment order before exporting the " + "bank file. The grouping will be done only if the following " + "fields matches:\n" + "* Partner\n" + "* Currency\n" + "* Destination Bank Account\n" + "* Communication Type (structured, free)\n" + "* Payment Date\n" + "(other modules can set additional fields to restrict the " + "grouping.)") @api.onchange('type') def type_on_change(self): diff --git a/account_banking_payment_export/views/payment_mode.xml b/account_banking_payment_export/views/payment_mode.xml index cdc5a33c1..93f616a4a 100644 --- a/account_banking_payment_export/views/payment_mode.xml +++ b/account_banking_payment_export/views/payment_mode.xml @@ -23,6 +23,9 @@ + + +