diff --git a/README.md b/README.md index 25bb777..0f4945b 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ Available addons ---------------- addon | version | maintainers | summary --- | --- | --- | --- -[account_ebics](account_ebics/) | 18.0.1.1.2 | | EBICS banking protocol +[account_ebics](account_ebics/) | 18.0.1.2.0 | | EBICS banking protocol [account_ebics_batch](account_ebics_batch/) | 18.0.1.0.0 | | EBICS Files automated import and processing -[account_ebics_batch_payment](account_ebics_batch_payment/) | 18.0.1.0.0 | | Upload Batch Payment via EBICS +[account_ebics_batch_payment](account_ebics_batch_payment/) | 18.0.1.1.0 | | Upload Batch Payment via EBICS [account_ebics_oca_statement_import](account_ebics_oca_statement_import/) | 18.0.1.0.0 | | Use OCA Bank Statement Import with account_ebics [account_ebics_oe](account_ebics_oe/) | 18.0.1.0.0 | | Deploy account_ebics module on Odoo Enterprise -[account_ebics_payment_order](account_ebics_payment_order/) | 18.0.1.1.0 | | Upload Payment Order via EBICS +[account_ebics_payment_order](account_ebics_payment_order/) | 18.0.1.2.0 | | Upload Payment Order via EBICS [//]: # (end addons) diff --git a/account_ebics/__manifest__.py b/account_ebics/__manifest__.py index e436404..561e5b6 100644 --- a/account_ebics/__manifest__.py +++ b/account_ebics/__manifest__.py @@ -3,7 +3,7 @@ { "name": "EBICS banking protocol", - "version": "18.0.1.1.2", + "version": "18.0.1.2.0", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics/i18n/account_ebics.pot b/account_ebics/i18n/account_ebics.pot index 592c97b..b1baaea 100644 --- a/account_ebics/i18n/account_ebics.pot +++ b/account_ebics/i18n/account_ebics.pot @@ -177,6 +177,7 @@ msgstr "" #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_change_passphrase_view_form #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_download +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_upload msgid "Cancel" msgstr "" @@ -601,6 +602,11 @@ msgstr "" msgid "EBICS Manager" msgstr "" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "EBICS Mark as Downloaded" +msgstr "" + #. module: account_ebics #. odoo-python #: code:addons/account_ebics/wizards/ebics_xfer.py:0 @@ -788,6 +794,12 @@ msgstr "" msgid "EBICS version mismatch." msgstr "" +#. module: account_ebics +#: model:ir.model.fields,field_description:account_ebics.field_account_journal__ebics_config_id +#: model:ir.model.fields,field_description:account_ebics.field_account_journal__ebics_config_ids +msgid "Ebics Config" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,field_description:account_ebics.field_ebics_userid__ebics_keys_fn msgid "Ebics Keys Fn" @@ -1011,6 +1023,11 @@ msgstr "" msgid "Invalid XML file." msgstr "" +#. module: account_ebics +#: model:ir.model,name:account_ebics.model_account_journal +msgid "Journal" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,field_description:account_ebics.field_ebics_admin_order__write_uid #: model:ir.model.fields,field_description:account_ebics.field_ebics_change_passphrase__write_uid @@ -1038,6 +1055,17 @@ msgstr "" msgid "Locality Name [L]" msgstr "" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "Mark as Downloaded" +msgstr "" + +#. module: account_ebics +#: model:ir.actions.act_window,name:account_ebics.ebics_xfer_action_mark_as_downloaded +#: model:ir.ui.menu,name:account_ebics.ebics_xfer_menu_mark_as_downloaded +msgid "Mark files as Downloaded" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,help:account_ebics.field_ebics_file_format__btf_format msgid "" @@ -1291,6 +1319,7 @@ msgstr "" #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_download +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_upload msgid "Select your bank :" msgstr "" @@ -1440,6 +1469,14 @@ msgstr "" msgid "Test Mode" msgstr "" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "" +"The EBICS Files (Bank Statements) selected via this screen will not become available in Odoo as EBICS files but will be marked by your bank as downloaded.\n" +" \n" +" As a consequence, these Bank Statements will not be retrieved by the next 'EBICS Batch Import' scheduled action." +msgstr "" + #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_config_view_form msgid "" diff --git a/account_ebics/i18n/fr.po b/account_ebics/i18n/fr.po index 3643f54..d73127d 100644 --- a/account_ebics/i18n/fr.po +++ b/account_ebics/i18n/fr.po @@ -186,6 +186,7 @@ msgstr "Relevés" #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_change_passphrase_view_form #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_download +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_upload msgid "Cancel" msgstr "Annuler" @@ -616,6 +617,11 @@ msgstr "" msgid "EBICS Manager" msgstr "" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "EBICS Mark as Downloaded" +msgstr "" + #. module: account_ebics #. odoo-python #: code:addons/account_ebics/wizards/ebics_xfer.py:0 @@ -803,6 +809,12 @@ msgstr "" msgid "EBICS version mismatch." msgstr "" +#. module: account_ebics +#: model:ir.model.fields,field_description:account_ebics.field_account_journal__ebics_config_id +#: model:ir.model.fields,field_description:account_ebics.field_account_journal__ebics_config_ids +msgid "Ebics Config" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,field_description:account_ebics.field_ebics_userid__ebics_keys_fn msgid "Ebics Keys Fn" @@ -1029,6 +1041,11 @@ msgstr "" msgid "Invalid XML file." msgstr "" +#. module: account_ebics +#: model:ir.model,name:account_ebics.model_account_journal +msgid "Journal" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,field_description:account_ebics.field_ebics_admin_order__write_uid #: model:ir.model.fields,field_description:account_ebics.field_ebics_change_passphrase__write_uid @@ -1056,6 +1073,17 @@ msgstr "Dernière mise à jour le" msgid "Locality Name [L]" msgstr "" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "Mark as Downloaded" +msgstr "" + +#. module: account_ebics +#: model:ir.actions.act_window,name:account_ebics.ebics_xfer_action_mark_as_downloaded +#: model:ir.ui.menu,name:account_ebics.ebics_xfer_menu_mark_as_downloaded +msgid "Mark files as Downloaded" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,help:account_ebics.field_ebics_file_format__btf_format msgid "" @@ -1315,6 +1343,7 @@ msgstr "" #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_download +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_upload msgid "Select your bank :" msgstr "" @@ -1464,6 +1493,17 @@ msgstr "" msgid "Test Mode" msgstr "Mode de test" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "" +"The EBICS Files (Bank Statements) selected via this screen will not become " +"available in Odoo as EBICS files but will be marked by your bank as " +"downloaded.\n" +" \n" +" As a consequence, these Bank Statements will not be " +"retrieved by the next 'EBICS Batch Import' scheduled action." +msgstr "" + #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_config_view_form msgid "" diff --git a/account_ebics/i18n/nl.po b/account_ebics/i18n/nl.po index 270f7b5..b7fa6d8 100644 --- a/account_ebics/i18n/nl.po +++ b/account_ebics/i18n/nl.po @@ -186,6 +186,7 @@ msgstr "Afschriften" #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_change_passphrase_view_form #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_download +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_upload msgid "Cancel" msgstr "Annuleer" @@ -616,6 +617,11 @@ msgstr "" msgid "EBICS Manager" msgstr "" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "EBICS Mark as Downloaded" +msgstr "" + #. module: account_ebics #. odoo-python #: code:addons/account_ebics/wizards/ebics_xfer.py:0 @@ -803,6 +809,12 @@ msgstr "" msgid "EBICS version mismatch." msgstr "" +#. module: account_ebics +#: model:ir.model.fields,field_description:account_ebics.field_account_journal__ebics_config_id +#: model:ir.model.fields,field_description:account_ebics.field_account_journal__ebics_config_ids +msgid "Ebics Config" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,field_description:account_ebics.field_ebics_userid__ebics_keys_fn msgid "Ebics Keys Fn" @@ -1029,6 +1041,11 @@ msgstr "" msgid "Invalid XML file." msgstr "" +#. module: account_ebics +#: model:ir.model,name:account_ebics.model_account_journal +msgid "Journal" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,field_description:account_ebics.field_ebics_admin_order__write_uid #: model:ir.model.fields,field_description:account_ebics.field_ebics_change_passphrase__write_uid @@ -1056,6 +1073,17 @@ msgstr "Laatst bijgewerkt op" msgid "Locality Name [L]" msgstr "" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "Mark as Downloaded" +msgstr "" + +#. module: account_ebics +#: model:ir.actions.act_window,name:account_ebics.ebics_xfer_action_mark_as_downloaded +#: model:ir.ui.menu,name:account_ebics.ebics_xfer_menu_mark_as_downloaded +msgid "Mark files as Downloaded" +msgstr "" + #. module: account_ebics #: model:ir.model.fields,help:account_ebics.field_ebics_file_format__btf_format msgid "" @@ -1315,6 +1343,7 @@ msgstr "" #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_download +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_upload msgid "Select your bank :" msgstr "" @@ -1464,6 +1493,17 @@ msgstr "" msgid "Test Mode" msgstr "" +#. module: account_ebics +#: model_terms:ir.ui.view,arch_db:account_ebics.ebics_xfer_view_form_mark_as_downloaded +msgid "" +"The EBICS Files (Bank Statements) selected via this screen will not become " +"available in Odoo as EBICS files but will be marked by your bank as " +"downloaded.\n" +" \n" +" As a consequence, these Bank Statements will not be " +"retrieved by the next 'EBICS Batch Import' scheduled action." +msgstr "" + #. module: account_ebics #: model_terms:ir.ui.view,arch_db:account_ebics.ebics_config_view_form msgid "" diff --git a/account_ebics/models/__init__.py b/account_ebics/models/__init__.py index 0a211c1..4b04a91 100644 --- a/account_ebics/models/__init__.py +++ b/account_ebics/models/__init__.py @@ -1,5 +1,6 @@ from . import fintech_ebics_register from . import account_bank_statement +from . import account_journal from . import ebics_config from . import ebics_file from . import ebics_file_format diff --git a/account_ebics/models/account_journal.py b/account_ebics/models/account_journal.py new file mode 100644 index 0000000..199858c --- /dev/null +++ b/account_ebics/models/account_journal.py @@ -0,0 +1,26 @@ +# Copyright 2026 Noviat. +# License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). + +from odoo import api, fields, models + + +class AccountJournal(models.Model): + _inherit = "account.journal" + + ebics_config_ids = fields.Many2many( + comodel_name="ebics.config", + relation="account_journal_ebics_config_rel", + readonly=True, + ) + ebics_config_id = fields.Many2one( + comodel_name="ebics.config", + compute="_compute_ebics_config_id", + compute_sudo=True, + ) + + @api.depends("ebics_config_ids") + def _compute_ebics_config_id(self): + for rec in self: + rec.ebics_config_id = rec.ebics_config_ids.filtered( + lambda r: r.state == "confirm" + )[:1] diff --git a/account_ebics/models/ebics_config.py b/account_ebics/models/ebics_config.py index 26fab66..7da7e4d 100644 --- a/account_ebics/models/ebics_config.py +++ b/account_ebics/models/ebics_config.py @@ -120,7 +120,8 @@ class EbicsConfig(models.Model): comodel_name="res.company", relation="ebics_config_res_company_rel", string="Companies", - readonly=True, + compute="_compute_company_ids", + store=True, help="Companies sharing this EBICS contract.", ) @@ -154,26 +155,10 @@ class EbicsConfig(models.Model): ) ) - def write(self, vals): - """ - Due to the multi-company nature of the EBICS config we - need to adapt the company_ids in the write method. - """ - if "journal_ids" not in vals: - return super().write(vals) + @api.depends("journal_ids.company_id") + def _compute_company_ids(self): for rec in self: - old_company_ids = rec.journal_ids.mapped("company_id").ids - super(EbicsConfig, rec).write(vals) - new_company_ids = rec.journal_ids.mapped("company_id").ids - updates = [] - for cid in new_company_ids: - if cid in old_company_ids: - old_company_ids.remove(cid) - else: - updates += [(4, cid)] - updates += [(3, x) for x in old_company_ids] - super(EbicsConfig, rec).write({"company_ids": updates}) - return True + rec.company_ids = rec.journal_ids.mapped("company_id") def unlink(self): for ebics_config in self: diff --git a/account_ebics/views/menu.xml b/account_ebics/views/menu.xml index 3969fc4..5a92812 100644 --- a/account_ebics/views/menu.xml +++ b/account_ebics/views/menu.xml @@ -80,4 +80,13 @@ groups="account_ebics.group_ebics_manager" sequence="30" /> + + diff --git a/account_ebics/wizards/ebics_xfer.py b/account_ebics/wizards/ebics_xfer.py index 1c0ad01..97c0d03 100644 --- a/account_ebics/wizards/ebics_xfer.py +++ b/account_ebics/wizards/ebics_xfer.py @@ -236,8 +236,8 @@ class EbicsXfer(models.TransientModel): date_from = self.date_from and self.date_from.isoformat() or None date_to = self.date_to and self.date_to.isoformat() or None for df in download_formats: + success = False try: - success = False if df.order_type == "BTD": btf = BusinessTransactionFormat( df.btf_service, @@ -262,7 +262,8 @@ class EbicsXfer(models.TransientModel): } } data = client.download(df.order_type, params=params) - ebics_files += self._handle_download_data(data, df) + if not self.env.context.get("ebics_mark_as_downloaded"): + ebics_files += self._handle_download_data(data, df) success = True except EbicsFunctionalError: err_cnt += 1 @@ -321,7 +322,7 @@ class EbicsXfer(models.TransientModel): ) tb = "".join(format_exception(*exc_info())) self.note += f"\n{tb}" - else: + finally: # mark received data so that it is not included in further # downloads trans_id = client.last_trans_id diff --git a/account_ebics/wizards/ebics_xfer.xml b/account_ebics/wizards/ebics_xfer.xml index 517023f..c7d838c 100644 --- a/account_ebics/wizards/ebics_xfer.xml +++ b/account_ebics/wizards/ebics_xfer.xml @@ -145,6 +145,75 @@ + + Mark EBICS files as Downloaded + ebics.xfer + 1 + + + + The EBICS Files (Bank Statements) selected via this screen will not become available in Odoo as EBICS files but will be marked by your bank as downloaded. + + As a consequence, these Bank Statements will not be retrieved by the next 'EBICS Batch Import' scheduled action. + + + + + + + + + + + + + + + + + Mark files as Downloaded + ir.actions.act_window + ebics.xfer + form + new + {'ebics_download': 1, 'ebics_mark_as_downloaded': 1} + + + EBICS File Transfer - Download ir.actions.act_window diff --git a/account_ebics_batch_payment/__manifest__.py b/account_ebics_batch_payment/__manifest__.py index 0cd591b..91d1b6e 100644 --- a/account_ebics_batch_payment/__manifest__.py +++ b/account_ebics_batch_payment/__manifest__.py @@ -1,9 +1,9 @@ -# Copyright 2009-2024 Noviat. +# Copyright 2020 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). { "name": "Upload Batch Payment via EBICS", - "version": "18.0.1.0.0", + "version": "18.0.1.1.0", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics_batch_payment/i18n/account_ebics_batch_payment.pot b/account_ebics_batch_payment/i18n/account_ebics_batch_payment.pot index a4bc135..06fc2ab 100644 --- a/account_ebics_batch_payment/i18n/account_ebics_batch_payment.pot +++ b/account_ebics_batch_payment/i18n/account_ebics_batch_payment.pot @@ -27,6 +27,11 @@ msgstr "" msgid "EBICS Upload" msgstr "" +#. module: account_ebics_batch_payment +#: model:ir.model.fields,field_description:account_ebics_batch_payment.field_account_batch_payment__hide_ebics_upload +msgid "Hide Ebics Upload" +msgstr "" + #. module: account_ebics_batch_payment #. odoo-python #: code:addons/account_ebics_batch_payment/models/account_batch_payment.py:0 diff --git a/account_ebics_batch_payment/i18n/fr.po b/account_ebics_batch_payment/i18n/fr.po index f478351..7133d30 100644 --- a/account_ebics_batch_payment/i18n/fr.po +++ b/account_ebics_batch_payment/i18n/fr.po @@ -11,8 +11,8 @@ msgstr "" "PO-Revision-Date: 2025-09-02 00:02+0000\n" "Last-Translator: Weblate Translation Memory \n" -"Language-Team: French \n" +"Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -34,6 +34,11 @@ msgstr "Paiement par lot" msgid "EBICS Upload" msgstr "" +#. module: account_ebics_batch_payment +#: model:ir.model.fields,field_description:account_ebics_batch_payment.field_account_batch_payment__hide_ebics_upload +msgid "Hide Ebics Upload" +msgstr "" + #. module: account_ebics_batch_payment #. odoo-python #: code:addons/account_ebics_batch_payment/models/account_batch_payment.py:0 diff --git a/account_ebics_batch_payment/i18n/nl.po b/account_ebics_batch_payment/i18n/nl.po index 6cb7f9f..1053b04 100644 --- a/account_ebics_batch_payment/i18n/nl.po +++ b/account_ebics_batch_payment/i18n/nl.po @@ -11,8 +11,8 @@ msgstr "" "PO-Revision-Date: 2025-09-02 00:02+0000\n" "Last-Translator: Weblate Translation Memory \n" -"Language-Team: Dutch \n" +"Language-Team: Dutch \n" "Language: nl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -34,6 +34,11 @@ msgstr "Batchbetaling" msgid "EBICS Upload" msgstr "" +#. module: account_ebics_batch_payment +#: model:ir.model.fields,field_description:account_ebics_batch_payment.field_account_batch_payment__hide_ebics_upload +msgid "Hide Ebics Upload" +msgstr "" + #. module: account_ebics_batch_payment #. odoo-python #: code:addons/account_ebics_batch_payment/models/account_batch_payment.py:0 diff --git a/account_ebics_batch_payment/models/account_batch_payment.py b/account_ebics_batch_payment/models/account_batch_payment.py index fc98660..f6699de 100644 --- a/account_ebics_batch_payment/models/account_batch_payment.py +++ b/account_ebics_batch_payment/models/account_batch_payment.py @@ -1,34 +1,37 @@ -# Copyright 2009-2024 Noviat. +# Copyright 2020 Noviat. # License LGPL-3 or later (http://www.gnu.org/licenses/lgpl). -from odoo import models +from odoo import fields, models from odoo.exceptions import UserError class AccountBatchPayment(models.Model): _inherit = "account.batch.payment" + hide_ebics_upload = fields.Boolean(compute="_compute_hide_ebics_upload") + + def _compute_hide_ebics_upload(self): + for rec in self: + rec.hide_ebics_upload = ( + not rec.journal_id.ebics_config_id + or not rec.file_generation_enabled + or rec.state != "sent" + ) + def ebics_upload(self): self.ensure_one() ctx = self.env.context.copy() origin = self.env._("Batch Payment") + ": " + self.name - ebics_config = self.env["ebics.config"].search( - [ - ("journal_ids", "=", self.journal_id.id), - ("state", "=", "confirm"), - ] - ) - if not ebics_config: + if not self.journal_id.ebics_config_id: raise UserError( self.env._( "No active EBICS configuration available for the selected bank." ) ) - if len(ebics_config) == 1: - ctx["default_ebics_config_id"] = ebics_config.id ctx.update( { + "default_ebics_config_id": self.journal_id.ebics_config_id.id, "default_upload_data": self.export_file, "default_upload_fname": self.export_filename, "origin": origin, diff --git a/account_ebics_batch_payment/views/account_batch_payment_views.xml b/account_ebics_batch_payment/views/account_batch_payment_views.xml index 0f7c8f8..02398d1 100644 --- a/account_ebics_batch_payment/views/account_batch_payment_views.xml +++ b/account_ebics_batch_payment/views/account_batch_payment_views.xml @@ -9,7 +9,7 @@ diff --git a/account_ebics_payment_order/__manifest__.py b/account_ebics_payment_order/__manifest__.py index 92980d2..811b3e8 100644 --- a/account_ebics_payment_order/__manifest__.py +++ b/account_ebics_payment_order/__manifest__.py @@ -1,9 +1,9 @@ -# Copyright 2009-2024 Noviat. +# Copyright 2015 Noviat. # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). { "name": "Upload Payment Order via EBICS", - "version": "18.0.1.1.0", + "version": "18.0.1.2.0", "license": "LGPL-3", "author": "Noviat", "website": "https://www.noviat.com/", diff --git a/account_ebics_payment_order/i18n/account_ebics_payment_order.pot b/account_ebics_payment_order/i18n/account_ebics_payment_order.pot index b44f82e..2f80246 100644 --- a/account_ebics_payment_order/i18n/account_ebics_payment_order.pot +++ b/account_ebics_payment_order/i18n/account_ebics_payment_order.pot @@ -25,6 +25,11 @@ msgstr "" msgid "EBICS Upload" msgstr "" +#. module: account_ebics_payment_order +#: model:ir.model.fields,field_description:account_ebics_payment_order.field_account_payment_order__hide_ebics_upload +msgid "Hide Ebics Upload" +msgstr "" + #. module: account_ebics_payment_order #. odoo-python #: code:addons/account_ebics_payment_order/models/account_payment_order.py:0 @@ -66,6 +71,6 @@ msgstr "" #. odoo-python #: code:addons/account_ebics_payment_order/models/account_payment_order.py:0 msgid "" -"This payment order doesn't contains attachements.\n" -"Please generate first the Payment Order file first." +"This payment order doesn't contains attachments.\n" +"Please generate first the Payment Order file." msgstr "" diff --git a/account_ebics_payment_order/models/account_payment_mode.py b/account_ebics_payment_order/models/account_payment_mode.py index 9ab2dc6..00bec22 100644 --- a/account_ebics_payment_order/models/account_payment_mode.py +++ b/account_ebics_payment_order/models/account_payment_mode.py @@ -1,4 +1,4 @@ -# Copyright 2009-2024 Noviat. +# Copyright 2015 Noviat. # License LGPL-3 or later (https://www.gnu.org/licenses/lpgl). from odoo import fields, models diff --git a/account_ebics_payment_order/models/account_payment_order.py b/account_ebics_payment_order/models/account_payment_order.py index 0859f08..85d9bd3 100644 --- a/account_ebics_payment_order/models/account_payment_order.py +++ b/account_ebics_payment_order/models/account_payment_order.py @@ -1,20 +1,28 @@ -# Copyright 2009-2024 Noviat. +# Copyright 2015 Noviat. # License LGPL-3 or later (https://www.gnu.org/licenses/lgpl). -from odoo import _, models +from odoo import fields, models from odoo.exceptions import UserError class AccountPaymentOrder(models.Model): _inherit = "account.payment.order" + hide_ebics_upload = fields.Boolean(compute="_compute_hide_ebics_upload") + + def _compute_hide_ebics_upload(self): + for rec in self: + rec.hide_ebics_upload = ( + not rec.journal_id.ebics_config_id or rec.state != "generated" + ) + def ebics_upload(self): self.ensure_one() ctx = self.env.context.copy() ebics_format_id = self.payment_mode_id.ebics_format_id if not ebics_format_id: raise UserError( - _("Missing EBICS File Format setting on your Payment Mode.") + self.env._("Missing EBICS File Format setting on your Payment Mode.") ) ctx.update( { @@ -27,14 +35,14 @@ class AccountPaymentOrder(models.Model): ) if not attach: raise UserError( - _( - "This payment order doesn't contains attachements." - "\nPlease generate first the Payment Order file first." + self.env._( + "This payment order doesn't contains attachments." + "\nPlease generate first the Payment Order file." ) ) elif len(attach) > 1: raise UserError( - _( + self.env._( "This payment order contains multiple attachments." "\nPlease remove the obsolete attachments or upload " "the payment order file via the " @@ -42,24 +50,17 @@ class AccountPaymentOrder(models.Model): ) ) else: - origin = _("Payment Order") + ": " + self.name - ebics_config = self.env["ebics.config"].search( - [ - ("journal_ids", "=", self.journal_id.id), - ("state", "=", "confirm"), - ] - ) - if not ebics_config: + origin = self.env._("Payment Order") + ": " + self.name + if not self.journal_id.ebics_config_id: raise UserError( - _( + self.env._( "No active EBICS configuration available " "for the selected bank." ) ) - if len(ebics_config) == 1: - ctx["default_ebics_config_id"] = ebics_config.id ctx.update( { + "default_ebics_config_id": self.journal_id.ebics_config_id.id, "default_upload_data": attach.datas, "default_upload_fname": attach.name, "origin": origin, @@ -75,7 +76,7 @@ class AccountPaymentOrder(models.Model): ebics_xfer._onchange_upload_data() view = self.env.ref("account_ebics.ebics_xfer_view_form_upload") act = { - "name": _("EBICS Upload"), + "name": self.env._("EBICS Upload"), "view_mode": "form", "res_model": "ebics.xfer", "view_id": view.id, diff --git a/account_ebics_payment_order/views/account_payment_order_views.xml b/account_ebics_payment_order/views/account_payment_order_views.xml index a7ba6c8..b2c1f3f 100644 --- a/account_ebics_payment_order/views/account_payment_order_views.xml +++ b/account_ebics_payment_order/views/account_payment_order_views.xml @@ -12,7 +12,7 @@