From a7e1833664a069d5fecb3b0f437232a0465c7fc8 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 1 Jun 2015 19:22:15 +0200 Subject: [PATCH 1/4] =?UTF-8?q?Fix=20bug=20#111=20New=20field=C2=A0initiat?= =?UTF-8?q?ing=5Fparty=5Fidentifier=20on=20res.company=20(migration=20scri?= =?UTF-8?q?pt=20included)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- account_banking_pain_base/__init__.py | 1 + account_banking_pain_base/__openerp__.py | 3 +- .../i18n/account_banking_pain_base.pot | 51 +++++++++------ .../migrations/8.0.0.2/post-migration.py | 30 +++++++++ .../models/banking_export_pain.py | 19 ++++-- .../models/res_company.py | 64 ++++--------------- account_banking_pain_base/post_install.py | 57 +++++++++++++++++ .../views/res_company_view.xml | 3 +- 8 files changed, 148 insertions(+), 80 deletions(-) create mode 100644 account_banking_pain_base/migrations/8.0.0.2/post-migration.py create mode 100644 account_banking_pain_base/post_install.py diff --git a/account_banking_pain_base/__init__.py b/account_banking_pain_base/__init__.py index b69a01a1b..49f1f9fc1 100644 --- a/account_banking_pain_base/__init__.py +++ b/account_banking_pain_base/__init__.py @@ -21,3 +21,4 @@ ############################################################################## from . import models +from post_install import set_default_initiating_party diff --git a/account_banking_pain_base/__openerp__.py b/account_banking_pain_base/__openerp__.py index 273c44438..19aef3e38 100644 --- a/account_banking_pain_base/__openerp__.py +++ b/account_banking_pain_base/__openerp__.py @@ -22,7 +22,7 @@ { 'name': 'Account Banking PAIN Base Module', 'summary': 'Base module for PAIN file generation', - 'version': '0.1', + 'version': '0.2', 'license': 'AGPL-3', 'author': "Akretion, " "Noviat, " @@ -40,6 +40,7 @@ 'views/payment_mode_view.xml', 'views/res_company_view.xml', ], + 'post_init_hook': 'set_default_initiating_party', 'description': ''' Base module for PAIN file generation ==================================== diff --git a/account_banking_pain_base/i18n/account_banking_pain_base.pot b/account_banking_pain_base/i18n/account_banking_pain_base.pot index 3430bda2b..ec6637431 100644 --- a/account_banking_pain_base/i18n/account_banking_pain_base.pot +++ b/account_banking_pain_base/i18n/account_banking_pain_base.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-10-31 22:52+0000\n" -"PO-Revision-Date: 2014-10-31 22:52+0000\n" +"POT-Creation-Date: 2015-06-01 17:20+0000\n" +"PO-Revision-Date: 2015-06-01 17:20+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -16,13 +16,18 @@ msgstr "" "Plural-Forms: \n" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:74 +#: model:ir.model,name:account_banking_pain_base.model_res_partner_bank +msgid "Bank Accounts" +msgstr "" + +#. module: account_banking_pain_base +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:79 #, python-format msgid "Cannot compute the '%s' of the Payment Line with reference '%s'." msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:80 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:85 #, python-format msgid "Cannot compute the '%s'." msgstr "" @@ -38,19 +43,19 @@ msgid "Convert to ASCII" msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:47 -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:73 -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:79 -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:89 -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:124 -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:303 -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:385 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:52 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:78 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:84 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:94 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:129 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:313 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:395 #, python-format msgid "Error:" msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:83 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:88 #, python-format msgid "Field type error:" msgstr "" @@ -70,13 +75,18 @@ msgstr "" msgid "If active, Odoo will convert each accented caracter to the corresponding unaccented caracter, so that only ASCII caracters are used in the generated PAIN file." msgstr "" +#. module: account_banking_pain_base +#: field:res.company,initiating_party_identifier:0 +msgid "Initiating Party Identifier" +msgstr "" + #. module: account_banking_pain_base #: field:res.company,initiating_party_issuer:0 msgid "Initiating Party Issuer" msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:386 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:396 #, python-format msgid "Missing 'Structured Communication Type' on payment line with reference '%s'." msgstr "" @@ -112,31 +122,31 @@ msgid "Structured Communication Type" msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:90 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:95 #, python-format msgid "The '%s' is empty or 0. It should have a non-null value." msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:304 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:314 #, python-format msgid "The bank account with IBAN '%s' of partner '%s' must have an associated BIC because it is a cross-border SEPA operation." msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:125 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:130 #, python-format msgid "The generated XML file is not valid against the official XML Schema Definition. The generated XML file and the full error have been written in the server logs. Here is the error, which may give you an idea on the cause of the problem : %s" msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:84 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:89 #, python-format msgid "The type of the field '%s' is %s. It should be a string or unicode." msgstr "" #. module: account_banking_pain_base -#: code:addons/account_banking_pain_base/models/banking_export_pain.py:47 +#: code:addons/account_banking_pain_base/models/banking_export_pain.py:52 #, python-format msgid "This IBAN is not valid : %s" msgstr "" @@ -146,6 +156,11 @@ msgstr "" msgid "This field will be used as the 'Instruction Priority' in the generated PAIN file." msgstr "" +#. module: account_banking_pain_base +#: help:res.company,initiating_party_identifier:0 +msgid "This will be used as the 'Initiating Party Identifier' in the PAIN files generated by Odoo." +msgstr "" + #. module: account_banking_pain_base #: help:res.company,initiating_party_issuer:0 msgid "This will be used as the 'Initiating Party Issuer' in the PAIN files generated by Odoo." diff --git a/account_banking_pain_base/migrations/8.0.0.2/post-migration.py b/account_banking_pain_base/migrations/8.0.0.2/post-migration.py new file mode 100644 index 000000000..eae959b03 --- /dev/null +++ b/account_banking_pain_base/migrations/8.0.0.2/post-migration.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2015 Akretion (http://www.akretion.com/) +# @author: Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from openerp.addons.account_banking_pain_base.post_install\ + import set_default_initiating_party + + +def migrate(cr, version): + if not version: + return + + set_default_initiating_party(cr, None) diff --git a/account_banking_pain_base/models/banking_export_pain.py b/account_banking_pain_base/models/banking_export_pain.py index d1a178c72..8d70f2480 100644 --- a/account_banking_pain_base/models/banking_export_pain.py +++ b/account_banking_pain_base/models/banking_export_pain.py @@ -267,13 +267,18 @@ class BankingExportPain(orm.AbstractModel): initiating_party_1_8 = etree.SubElement(parent_node, 'InitgPty') initiating_party_name = etree.SubElement(initiating_party_1_8, 'Nm') initiating_party_name.text = my_company_name - initiating_party_identifier = self.pool['res.company'].\ - _get_initiating_party_identifier( - cr, uid, - gen_args['sepa_export'].payment_order_ids[0].company_id.id, - context=context) - initiating_party_issuer = gen_args['sepa_export'].\ - payment_order_ids[0].company_id.initiating_party_issuer + initiating_party_identifier = self._prepare_field( + cr, uid, 'Initiating Party Identifier', + 'sepa_export.payment_order_ids[0].company_id.' + 'initiating_party_identifier', + {'sepa_export': gen_args['sepa_export']}, + 35, gen_args=gen_args, context=context) + initiating_party_issuer = self._prepare_field( + cr, uid, 'Initiating Party Issuer', + 'sepa_export.payment_order_ids[0].company_id.' + 'initiating_party_issuer', + {'sepa_export': gen_args['sepa_export']}, + 35, gen_args=gen_args, context=context) if initiating_party_identifier and initiating_party_issuer: iniparty_id = etree.SubElement(initiating_party_1_8, 'Id') iniparty_org_id = etree.SubElement(iniparty_id, 'OrgId') diff --git a/account_banking_pain_base/models/res_company.py b/account_banking_pain_base/models/res_company.py index 2e5509de4..465984559 100644 --- a/account_banking_pain_base/models/res_company.py +++ b/account_banking_pain_base/models/res_company.py @@ -2,7 +2,7 @@ ############################################################################## # # PAIN Base module for OpenERP -# Copyright (C) 2013 Akretion (http://www.akretion.com) +# Copyright (C) 2013-2015 Akretion (http://www.akretion.com) # Copyright (C) 2013 Noviat (http://www.noviat.com) # @author: Alexis de Lattre # @author: Luc de Meyer (Noviat) @@ -22,59 +22,17 @@ # ############################################################################## -from openerp.osv import orm, fields +from openerp import models, fields -class ResCompany(orm.Model): +class ResCompany(models.Model): _inherit = 'res.company' - _columns = { - 'initiating_party_issuer': fields.char( - 'Initiating Party Issuer', size=35, - help="This will be used as the 'Initiating Party Issuer' in the " - "PAIN files generated by Odoo."), - } - - def _get_initiating_party_identifier( - self, cr, uid, company_id, context=None): - """The code here may be different from one country to another. - If you need to add support for an additionnal country, you can - contribute your code here or inherit this function in the - localization modules for your country""" - assert isinstance(company_id, int), 'Only one company ID' - company = self.browse(cr, uid, company_id, context=context) - company_vat = company.vat - party_identifier = company.sepa_creditor_identifier - if not party_identifier and company_vat: - country_code = company_vat[0:2].upper() - if country_code == 'BE': - party_identifier = company_vat[2:].replace(' ', '') - return party_identifier - - def _initiating_party_issuer_default(self, cr, uid, context=None): - """If you need to add support for an additionnal country, you can - add an entry in the dict "party_issuer_per_country" here - or inherit this function in the localization modules for - your country""" - initiating_party_issuer = '' - # If your country require the 'Initiating Party Issuer', you should - # contribute the entry for your country in the dict below - party_issuer_per_country = { - 'BE': 'KBO-BCE', # KBO-BCE = the registry of companies in Belgium - } - company_id = self._company_default_get( - cr, uid, 'res.company', context=context) - if company_id: - company = self.browse(cr, uid, company_id, context=context) - country_code = company.country_id.code - initiating_party_issuer = party_issuer_per_country.get( - country_code, '') - return initiating_party_issuer - - def _initiating_party_issuer_def(self, cr, uid, context=None): - return self._initiating_party_issuer_default( - cr, uid, context=context) - - _defaults = { - 'initiating_party_issuer': _initiating_party_issuer_def, - } + initiating_party_issuer = fields.Char( + string='Initiating Party Issuer', size=35, + help="This will be used as the 'Initiating Party Issuer' in the " + "PAIN files generated by Odoo.") + initiating_party_identifier = fields.Char( + string='Initiating Party Identifier', size=35, + help="This will be used as the 'Initiating Party Identifier' in " + "the PAIN files generated by Odoo.") diff --git a/account_banking_pain_base/post_install.py b/account_banking_pain_base/post_install.py new file mode 100644 index 000000000..2ae817710 --- /dev/null +++ b/account_banking_pain_base/post_install.py @@ -0,0 +1,57 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# PAIN Base module for Odoo +# Copyright (C) 2015 Akretion (http://www.akretion.com) +# @author: Alexis de Lattre +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + + +def set_default_initiating_party(cr, registry): + party_issuer_per_country = { + 'BE': 'KBO-BCE', # KBO-BCE = the registry of companies in Belgium + } + cr.execute(''' + SELECT + res_company.id, + res_country.code AS country_code, + res_partner.vat, + res_company.initiating_party_identifier, + res_company.initiating_party_issuer + FROM res_company + LEFT JOIN res_partner ON res_partner.id = res_company.partner_id + LEFT JOIN res_country ON res_country.id = res_partner.country_id + ''') + for company in cr.dictfetchall(): + country_code = company['country_code'] + if not company['initiating_party_issuer']: + if country_code and country_code in party_issuer_per_country: + cr.execute( + 'UPDATE res_company SET initiating_party_issuer=%s ' + 'WHERE id=%s', + (party_issuer_per_country[country_code], company['id'])) + party_identifier = False + if not company['initiating_party_identifier']: + if company['vat'] and country_code: + if country_code == 'BE': + party_identifier = company['vat'][2:].replace(' ', '') + if party_identifier: + cr.execute( + 'UPDATE res_company SET initiating_party_identifier=%s ' + 'WHERE id=%s', + (party_identifier, company['id'])) + return diff --git a/account_banking_pain_base/views/res_company_view.xml b/account_banking_pain_base/views/res_company_view.xml index a98d9b641..fd3af4755 100644 --- a/account_banking_pain_base/views/res_company_view.xml +++ b/account_banking_pain_base/views/res_company_view.xml @@ -1,6 +1,6 @@ @@ -14,6 +14,7 @@ + From e45505ddbf9e69b79aa550deb51f24ad3093be90 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 1 Jun 2015 19:28:47 +0200 Subject: [PATCH 2/4] Better import --- account_banking_pain_base/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account_banking_pain_base/__init__.py b/account_banking_pain_base/__init__.py index 49f1f9fc1..06e1d7cff 100644 --- a/account_banking_pain_base/__init__.py +++ b/account_banking_pain_base/__init__.py @@ -21,4 +21,4 @@ ############################################################################## from . import models -from post_install import set_default_initiating_party +from .post_install import set_default_initiating_party From d58bbfa6e8cf0734890a8cb233df0d48245723c9 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 2 Jun 2015 11:13:26 +0200 Subject: [PATCH 3/4] Replace SQL by code that uses the ORM, as suggested by Pedro Move part of the migration code to res_company.py, so that it's possible to inherit in other modules --- .../migrations/8.0.0.2/post-migration.py | 4 +- .../models/res_company.py | 35 +++++++++++++++- account_banking_pain_base/post_install.py | 41 ++++--------------- 3 files changed, 45 insertions(+), 35 deletions(-) diff --git a/account_banking_pain_base/migrations/8.0.0.2/post-migration.py b/account_banking_pain_base/migrations/8.0.0.2/post-migration.py index eae959b03..bb6322681 100644 --- a/account_banking_pain_base/migrations/8.0.0.2/post-migration.py +++ b/account_banking_pain_base/migrations/8.0.0.2/post-migration.py @@ -21,10 +21,12 @@ from openerp.addons.account_banking_pain_base.post_install\ import set_default_initiating_party +from openerp import pooler def migrate(cr, version): if not version: return - set_default_initiating_party(cr, None) + pool = pooler.get_pool(cr.dbname) + set_default_initiating_party(cr, pool) diff --git a/account_banking_pain_base/models/res_company.py b/account_banking_pain_base/models/res_company.py index 465984559..bb656b55a 100644 --- a/account_banking_pain_base/models/res_company.py +++ b/account_banking_pain_base/models/res_company.py @@ -22,7 +22,10 @@ # ############################################################################## -from openerp import models, fields +from openerp import models, fields, api +import logging + +logger = logging.getLogger(__name__) class ResCompany(models.Model): @@ -36,3 +39,33 @@ class ResCompany(models.Model): string='Initiating Party Identifier', size=35, help="This will be used as the 'Initiating Party Identifier' in " "the PAIN files generated by Odoo.") + + @api.model + def _default_initiating_party(self, company): + '''This method is called from post_install.py, which itself is also + called from migrations/8.0.0.2/post-migration.py''' + party_issuer_per_country = { + 'BE': 'KBO-BCE', # KBO-BCE = the registry of companies in Belgium + } + logger.debug( + 'Calling _default_initiating_party on company %s', company.name) + country_code = company.country_id.code + if not company.initiating_party_issuer: + if country_code and country_code in party_issuer_per_country: + company.write({ + 'initiating_party_issuer': + party_issuer_per_country[country_code]}) + logger.info( + 'Updated initiating_party_issuer on company %s', + company.name) + party_identifier = False + if not company.initiating_party_identifier: + if company.vat and country_code: + if country_code == 'BE': + party_identifier = company.vat[2:].replace(' ', '') + if party_identifier: + company.write({ + 'initiating_party_identifier': party_identifier}) + logger.info( + 'Updated initiating_party_identifier on company %s', + company.name) diff --git a/account_banking_pain_base/post_install.py b/account_banking_pain_base/post_install.py index 2ae817710..d48fd2f63 100644 --- a/account_banking_pain_base/post_install.py +++ b/account_banking_pain_base/post_install.py @@ -20,38 +20,13 @@ # ############################################################################## +from openerp import SUPERUSER_ID -def set_default_initiating_party(cr, registry): - party_issuer_per_country = { - 'BE': 'KBO-BCE', # KBO-BCE = the registry of companies in Belgium - } - cr.execute(''' - SELECT - res_company.id, - res_country.code AS country_code, - res_partner.vat, - res_company.initiating_party_identifier, - res_company.initiating_party_issuer - FROM res_company - LEFT JOIN res_partner ON res_partner.id = res_company.partner_id - LEFT JOIN res_country ON res_country.id = res_partner.country_id - ''') - for company in cr.dictfetchall(): - country_code = company['country_code'] - if not company['initiating_party_issuer']: - if country_code and country_code in party_issuer_per_country: - cr.execute( - 'UPDATE res_company SET initiating_party_issuer=%s ' - 'WHERE id=%s', - (party_issuer_per_country[country_code], company['id'])) - party_identifier = False - if not company['initiating_party_identifier']: - if company['vat'] and country_code: - if country_code == 'BE': - party_identifier = company['vat'][2:].replace(' ', '') - if party_identifier: - cr.execute( - 'UPDATE res_company SET initiating_party_identifier=%s ' - 'WHERE id=%s', - (party_identifier, company['id'])) + +def set_default_initiating_party(cr, pool): + company_ids = pool['res.company'].search(cr, SUPERUSER_ID, []) + companies = pool['res.company'].browse(cr, SUPERUSER_ID, company_ids) + for company in companies: + pool['res.company']._default_initiating_party( + cr, SUPERUSER_ID, company) return From 74b9c46c3780709f481e5ab2af74e5d64ddf585e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 2 Jun 2015 12:24:49 +0200 Subject: [PATCH 4/4] Add hook to block in localization modules that want raise if initiating_party is not set --- .../models/banking_export_pain.py | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/account_banking_pain_base/models/banking_export_pain.py b/account_banking_pain_base/models/banking_export_pain.py index 8d70f2480..2e13fc0f6 100644 --- a/account_banking_pain_base/models/banking_export_pain.py +++ b/account_banking_pain_base/models/banking_export_pain.py @@ -257,6 +257,11 @@ class BankingExportPain(orm.AbstractModel): requested_date_2_17.text = requested_date return payment_info_2_0, nb_of_transactions_2_4, control_sum_2_5 + def _must_have_initiating_party(self, cr, uid, gen_args, context=None): + '''This method is designed to be inherited in localization modules for + countries in which the initiating party is required''' + return False + def generate_initiating_party_block( self, cr, uid, parent_node, gen_args, context=None): my_company_name = self._prepare_field( @@ -267,18 +272,12 @@ class BankingExportPain(orm.AbstractModel): initiating_party_1_8 = etree.SubElement(parent_node, 'InitgPty') initiating_party_name = etree.SubElement(initiating_party_1_8, 'Nm') initiating_party_name.text = my_company_name - initiating_party_identifier = self._prepare_field( - cr, uid, 'Initiating Party Identifier', - 'sepa_export.payment_order_ids[0].company_id.' - 'initiating_party_identifier', - {'sepa_export': gen_args['sepa_export']}, - 35, gen_args=gen_args, context=context) - initiating_party_issuer = self._prepare_field( - cr, uid, 'Initiating Party Issuer', - 'sepa_export.payment_order_ids[0].company_id.' - 'initiating_party_issuer', - {'sepa_export': gen_args['sepa_export']}, - 35, gen_args=gen_args, context=context) + initiating_party_identifier =\ + gen_args['sepa_export'].payment_order_ids[0].company_id.\ + initiating_party_identifier + initiating_party_issuer =\ + gen_args['sepa_export'].payment_order_ids[0].company_id.\ + initiating_party_issuer if initiating_party_identifier and initiating_party_issuer: iniparty_id = etree.SubElement(initiating_party_1_8, 'Id') iniparty_org_id = etree.SubElement(iniparty_id, 'OrgId') @@ -288,6 +287,14 @@ class BankingExportPain(orm.AbstractModel): iniparty_org_other_issuer = etree.SubElement( iniparty_org_other, 'Issr') iniparty_org_other_issuer.text = initiating_party_issuer + elif self._must_have_initiating_party(cr, uid, gen_args, + context=context): + raise orm.except_orm( + _('Error:'), + _("Missing 'Initiating Party Issuer' and/or " + "'Initiating Party Identifier' for the company '%s'. " + "Both fields must have a value.") + % gen_args['sepa_export'].payment_order_ids[0].company_id.name) return True def generate_party_agent(