diff --git a/account_banking_pain_base/__manifest__.py b/account_banking_pain_base/__manifest__.py index 4a5fb803a..5004ddbc7 100644 --- a/account_banking_pain_base/__manifest__.py +++ b/account_banking_pain_base/__manifest__.py @@ -1,7 +1,7 @@ # Copyright 2013-2016 Akretion - Alexis de Lattre -# Copyright 2014-2017 Tecnativa - Pedro M. Baeza # Copyright 2016 Tecnativa - Antonio Espinosa # Copyright 2021 Tecnativa - Carlos Roca +# Copyright 2014-2022 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { @@ -18,7 +18,6 @@ "security/security.xml", "views/account_payment_line.xml", "views/account_payment_order.xml", - "views/bank_payment_line_view.xml", "views/account_payment_mode.xml", "views/res_config_settings.xml", "views/account_payment_method.xml", diff --git a/account_banking_pain_base/models/__init__.py b/account_banking_pain_base/models/__init__.py index af5bbf1f2..4f1503393 100644 --- a/account_banking_pain_base/models/__init__.py +++ b/account_banking_pain_base/models/__init__.py @@ -1,6 +1,5 @@ from . import account_payment_line from . import account_payment_order -from . import bank_payment_line from . import account_payment_mode from . import res_company from . import res_config_settings diff --git a/account_banking_pain_base/models/account_payment_line.py b/account_banking_pain_base/models/account_payment_line.py index e62dc92b4..3aed2d062 100644 --- a/account_banking_pain_base/models/account_payment_line.py +++ b/account_banking_pain_base/models/account_payment_line.py @@ -1,9 +1,9 @@ # Copyright 2013-2016 Akretion - Alexis de Lattre -# Copyright 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza # Copyright 2021 Tecnativa - Carlos Roca +# Copyright 2014-2022 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). -from odoo import fields, models +from odoo import api, fields, models class AccountPaymentLine(models.Model): @@ -173,3 +173,10 @@ class AccountPaymentLine(models.Model): communication_type = fields.Selection( selection_add=[("ISO", "ISO")], ondelete={"ISO": "cascade"} ) + + @api.model + def _get_payment_line_grouping_fields(self): + """Add specific PAIN fields to the grouping criteria.""" + res = super()._get_payment_line_grouping_fields() + res += ["priority", "local_instrument", "category_purpose", "purpose"] + return res diff --git a/account_banking_pain_base/models/account_payment_order.py b/account_banking_pain_base/models/account_payment_order.py index 820d2fe7e..1d4e0c9c9 100644 --- a/account_banking_pain_base/models/account_payment_order.py +++ b/account_banking_pain_base/models/account_payment_order.py @@ -1,7 +1,7 @@ # Copyright 2013-2016 Akretion - Alexis de Lattre -# Copyright 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza # Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa # Copyright 2021 Tecnativa - Carlos Roca +# Copyright 2014-2022 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import logging @@ -610,11 +610,12 @@ class AccountPaymentOrder(models.Model): @api.model def generate_remittance_info_block(self, parent_node, line, gen_args): remittance_info = etree.SubElement(parent_node, "RmtInf") - if line.communication_type == "normal": + communication_type = line.payment_line_ids[:1].communication_type + if communication_type == "normal": remittance_info_unstructured = etree.SubElement(remittance_info, "Ustrd") remittance_info_unstructured.text = self._prepare_field( "Remittance Unstructured Information", - "line.communication", + "line.payment_reference", {"line": line}, 140, gen_args=gen_args, @@ -636,7 +637,7 @@ class AccountPaymentOrder(models.Model): creditor_ref_info_type_issuer = etree.SubElement( creditor_ref_info_type, "Issr" ) - creditor_ref_info_type_issuer.text = line.communication_type + creditor_ref_info_type_issuer.text = communication_type creditor_reference = etree.SubElement( creditor_ref_information, "CdtrRef" ) @@ -655,13 +656,13 @@ class AccountPaymentOrder(models.Model): creditor_ref_info_type_issuer = etree.SubElement( creditor_ref_info_type, "Issr" ) - creditor_ref_info_type_issuer.text = line.communication_type + creditor_ref_info_type_issuer.text = communication_type creditor_reference = etree.SubElement(creditor_ref_information, "Ref") creditor_reference.text = self._prepare_field( "Creditor Structured Reference", - "line.communication", + "line.payment_reference", {"line": line}, 35, gen_args=gen_args, diff --git a/account_banking_pain_base/models/bank_payment_line.py b/account_banking_pain_base/models/bank_payment_line.py deleted file mode 100644 index 0079b5fda..000000000 --- a/account_banking_pain_base/models/bank_payment_line.py +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright 2013-2016 Akretion - Alexis de Lattre -# Copyright 2021 Tecnativa - Carlos Roca -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). - -from odoo import api, fields, models - - -class BankPaymentLine(models.Model): - _inherit = "bank.payment.line" - - priority = fields.Selection(related="payment_line_ids.priority", string="Priority") - local_instrument = fields.Selection( - related="payment_line_ids.local_instrument", string="Local Instrument" - ) - category_purpose = fields.Selection( - related="payment_line_ids.category_purpose", string="Category Purpose" - ) - purpose = fields.Selection(related="payment_line_ids.purpose") - - @api.model - def same_fields_payment_line_and_bank_payment_line(self): - res = super().same_fields_payment_line_and_bank_payment_line() - res += ["priority", "local_instrument", "category_purpose", "purpose"] - return res diff --git a/account_banking_pain_base/views/bank_payment_line_view.xml b/account_banking_pain_base/views/bank_payment_line_view.xml deleted file mode 100644 index 247de1783..000000000 --- a/account_banking_pain_base/views/bank_payment_line_view.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - pain.base.bank.payment.line.form - bank.payment.line - - - - - - - - - - - - pain.base.bank.payment.line.tree - bank.payment.line - - - - - - - - -