From 04970f28253ce4aa99bf39b9ab7aa92ba8bcbed7 Mon Sep 17 00:00:00 2001 From: Lindsay Date: Fri, 14 Jun 2024 10:38:25 +0200 Subject: [PATCH] [IMP] Allow to use the storage either from the payment mode or from the payment method --- .../account_payment_method_fs_storage.pot | 79 ----- account_payment_method_fs_storage/i18n/es.po | 84 ----- account_payment_method_fs_storage/i18n/it.po | 84 ----- .../models/__init__.py | 3 - .../models/account_payment_method.py | 25 -- .../models/fs_storage.py | 28 -- .../tests/__init__.py | 1 - .../test_account_payment_method_fs_storage.py | 129 -------- .../views/fs_storage.xml | 18 -- .../README.rst | 17 +- .../__init__.py | 0 .../__manifest__.py | 11 +- .../migrations/16.0.1.0.4/post-migrate.py | 18 ++ .../models/__init__.py | 5 + .../models/account_payment_method.py | 38 +++ .../models/account_payment_mode.py | 36 +++ .../models/account_payment_order.py | 13 +- .../models/res_company.py | 18 ++ .../models/res_config_settings.py | 67 ++++ .../readme/CONFIGURE.rst | 2 +- .../readme/CONTRIBUTORS.rst | 1 + .../readme/DESCRIPTION.rst | 0 .../readme/INSTALL.rst | 0 .../readme/USAGE.rst | 0 .../static/description/icon.png | Bin .../static/description/index.html | 26 +- .../tests/__init__.py | 1 + ...count_payment_method_or_mode_fs_storage.py | 293 ++++++++++++++++++ .../views/account_payment_method.xml | 2 +- .../views/account_payment_mode.xml | 21 ++ .../views/res_config_settings.xml | 74 +++++ .../addons/account_payment_method_fs_storage | 1 - .../account_payment_method_or_mode_fs_storage | 1 + .../setup.py | 0 34 files changed, 616 insertions(+), 480 deletions(-) delete mode 100644 account_payment_method_fs_storage/i18n/account_payment_method_fs_storage.pot delete mode 100644 account_payment_method_fs_storage/i18n/es.po delete mode 100644 account_payment_method_fs_storage/i18n/it.po delete mode 100644 account_payment_method_fs_storage/models/__init__.py delete mode 100644 account_payment_method_fs_storage/models/account_payment_method.py delete mode 100644 account_payment_method_fs_storage/models/fs_storage.py delete mode 100644 account_payment_method_fs_storage/tests/__init__.py delete mode 100644 account_payment_method_fs_storage/tests/test_account_payment_method_fs_storage.py delete mode 100644 account_payment_method_fs_storage/views/fs_storage.xml rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/README.rst (84%) rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/__init__.py (100%) rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/__manifest__.py (61%) create mode 100644 account_payment_method_or_mode_fs_storage/migrations/16.0.1.0.4/post-migrate.py create mode 100644 account_payment_method_or_mode_fs_storage/models/__init__.py create mode 100644 account_payment_method_or_mode_fs_storage/models/account_payment_method.py create mode 100644 account_payment_method_or_mode_fs_storage/models/account_payment_mode.py rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/models/account_payment_order.py (84%) create mode 100644 account_payment_method_or_mode_fs_storage/models/res_company.py create mode 100644 account_payment_method_or_mode_fs_storage/models/res_config_settings.py rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/readme/CONFIGURE.rst (64%) rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/readme/CONTRIBUTORS.rst (68%) rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/readme/DESCRIPTION.rst (100%) rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/readme/INSTALL.rst (100%) rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/readme/USAGE.rst (100%) rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/static/description/icon.png (100%) rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/static/description/index.html (87%) create mode 100644 account_payment_method_or_mode_fs_storage/tests/__init__.py create mode 100644 account_payment_method_or_mode_fs_storage/tests/test_account_payment_method_or_mode_fs_storage.py rename {account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/views/account_payment_method.xml (96%) create mode 100644 account_payment_method_or_mode_fs_storage/views/account_payment_mode.xml create mode 100644 account_payment_method_or_mode_fs_storage/views/res_config_settings.xml delete mode 120000 setup/account_payment_method_fs_storage/odoo/addons/account_payment_method_fs_storage create mode 120000 setup/account_payment_method_or_mode_fs_storage/odoo/addons/account_payment_method_or_mode_fs_storage rename setup/{account_payment_method_fs_storage => account_payment_method_or_mode_fs_storage}/setup.py (100%) diff --git a/account_payment_method_fs_storage/i18n/account_payment_method_fs_storage.pot b/account_payment_method_fs_storage/i18n/account_payment_method_fs_storage.pot deleted file mode 100644 index 22f92983ec27..000000000000 --- a/account_payment_method_fs_storage/i18n/account_payment_method_fs_storage.pot +++ /dev/null @@ -1,79 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * account_payment_method_fs_storage -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.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_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_fs_storage -msgid "FS Storage" -msgstr "" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "Generate and export" -msgstr "" - -#. module: account_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_account_payment_method -msgid "Payment Methods" -msgstr "" - -#. module: account_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_account_payment_order -msgid "Payment Order" -msgstr "" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,field_description:account_payment_method_fs_storage.field_account_payment_method__storage -msgid "Storage" -msgstr "" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/fs_storage.py:0 -#, python-format -msgid "Storage is already used on at least one payment method" -msgstr "" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,help:account_payment_method_fs_storage.field_account_payment_method__storage -msgid "Storage where to put the file after generation" -msgstr "" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,help:account_payment_method_fs_storage.field_fs_storage__use_on_payment_method -msgid "Tells if storage can be set on payment methods" -msgstr "" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "The file has been generated and dropped on the storage." -msgstr "" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "" -"Unknown issue to upload the file on the storage:\n" -"{details}" -msgstr "" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,field_description:account_payment_method_fs_storage.field_fs_storage__use_on_payment_method -msgid "Use On Payment Method" -msgstr "" diff --git a/account_payment_method_fs_storage/i18n/es.po b/account_payment_method_fs_storage/i18n/es.po deleted file mode 100644 index 94ecade28949..000000000000 --- a/account_payment_method_fs_storage/i18n/es.po +++ /dev/null @@ -1,84 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * account_payment_method_fs_storage -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2024-04-23 00:03+0000\n" -"Last-Translator: Ivorra78 \n" -"Language-Team: none\n" -"Language: es\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 4.17\n" - -#. module: account_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_fs_storage -msgid "FS Storage" -msgstr "Almacenamiento FS" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "Generate and export" -msgstr "Generar y exportar" - -#. module: account_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_account_payment_method -msgid "Payment Methods" -msgstr "Métodos de Pago" - -#. module: account_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_account_payment_order -msgid "Payment Order" -msgstr "Orden de Pago" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,field_description:account_payment_method_fs_storage.field_account_payment_method__storage -msgid "Storage" -msgstr "Almacenamiento" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/fs_storage.py:0 -#, python-format -msgid "Storage is already used on at least one payment method" -msgstr "El almacenamiento ya se utiliza en al menos un método de pago" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,help:account_payment_method_fs_storage.field_account_payment_method__storage -msgid "Storage where to put the file after generation" -msgstr "Almacenamiento donde poner el archivo después de la generación" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,help:account_payment_method_fs_storage.field_fs_storage__use_on_payment_method -msgid "Tells if storage can be set on payment methods" -msgstr "Indica si el almacenamiento se puede establecer en los métodos de pago" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "The file has been generated and dropped on the storage." -msgstr "El archivo ha sido generado y depositado en el almacén." - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "" -"Unknown issue to upload the file on the storage:\n" -"{details}" -msgstr "" -"Problema desconocido para cargar el archivo en el almacenamiento:\n" -"{details}" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,field_description:account_payment_method_fs_storage.field_fs_storage__use_on_payment_method -msgid "Use On Payment Method" -msgstr "Utilizar en Método de Pago" diff --git a/account_payment_method_fs_storage/i18n/it.po b/account_payment_method_fs_storage/i18n/it.po deleted file mode 100644 index 5bf31476b580..000000000000 --- a/account_payment_method_fs_storage/i18n/it.po +++ /dev/null @@ -1,84 +0,0 @@ -# Translation of Odoo Server. -# This file contains the translation of the following modules: -# * account_payment_method_fs_storage -# -msgid "" -msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" -"Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2024-05-03 17:35+0000\n" -"Last-Translator: mymage \n" -"Language-Team: none\n" -"Language: it\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 4.17\n" - -#. module: account_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_fs_storage -msgid "FS Storage" -msgstr "Deposito FS" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "Generate and export" -msgstr "Genera ed esporta" - -#. module: account_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_account_payment_method -msgid "Payment Methods" -msgstr "Metodi di pagamento" - -#. module: account_payment_method_fs_storage -#: model:ir.model,name:account_payment_method_fs_storage.model_account_payment_order -msgid "Payment Order" -msgstr "Ordine di pagamento" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,field_description:account_payment_method_fs_storage.field_account_payment_method__storage -msgid "Storage" -msgstr "Deposito" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/fs_storage.py:0 -#, python-format -msgid "Storage is already used on at least one payment method" -msgstr "Deposito utilizzato almeno in un metodo di pagamento" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,help:account_payment_method_fs_storage.field_account_payment_method__storage -msgid "Storage where to put the file after generation" -msgstr "Deposito dove salvare il file dopo la generazione" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,help:account_payment_method_fs_storage.field_fs_storage__use_on_payment_method -msgid "Tells if storage can be set on payment methods" -msgstr "Indica se il deposito può essere impostato in un metodo di pagamento" - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "The file has been generated and dropped on the storage." -msgstr "Il file è stato generato e salvato nel deposito." - -#. module: account_payment_method_fs_storage -#. odoo-python -#: code:addons/account_payment_method_fs_storage/models/account_payment_order.py:0 -#, python-format -msgid "" -"Unknown issue to upload the file on the storage:\n" -"{details}" -msgstr "" -"Problema sconosciuto nel caricamento del file nel deposito:\n" -"{details}" - -#. module: account_payment_method_fs_storage -#: model:ir.model.fields,field_description:account_payment_method_fs_storage.field_fs_storage__use_on_payment_method -msgid "Use On Payment Method" -msgstr "Utilizza nel metodo di pagamento" diff --git a/account_payment_method_fs_storage/models/__init__.py b/account_payment_method_fs_storage/models/__init__.py deleted file mode 100644 index ed752e7bb67a..000000000000 --- a/account_payment_method_fs_storage/models/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from . import account_payment_order -from . import account_payment_method -from . import fs_storage diff --git a/account_payment_method_fs_storage/models/account_payment_method.py b/account_payment_method_fs_storage/models/account_payment_method.py deleted file mode 100644 index 433788acbc95..000000000000 --- a/account_payment_method_fs_storage/models/account_payment_method.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2024 ACSONE SA/NV -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from odoo import fields, models - - -class AccountPaymentMethod(models.Model): - - _inherit = "account.payment.method" - - storage = fields.Selection( - selection="_get_selection_storage", - help="Storage where to put the file after generation", - ) - - def _get_selection_storage(self): - """ - This is to avoid giving access to the model fs.storage - at groups other than base.group_system - """ - storages = ( - self.env["fs.storage"].sudo().search([("use_on_payment_method", "=", True)]) - ) - - return [(str(r.id), r.display_name) for r in storages] diff --git a/account_payment_method_fs_storage/models/fs_storage.py b/account_payment_method_fs_storage/models/fs_storage.py deleted file mode 100644 index bc5a3c138651..000000000000 --- a/account_payment_method_fs_storage/models/fs_storage.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2024 ACSONE SA/NV -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). - -from odoo import _, api, fields, models -from odoo.exceptions import UserError - - -class FsStorage(models.Model): - - _inherit = "fs.storage" - - use_on_payment_method = fields.Boolean( - help="Tells if storage can be set on payment methods", - ) - - @api.constrains("use_on_payment_method") - def _check_use_on_payment_method(self): - storage_not_on_payment = self.filtered(lambda r: not r.use_on_payment_method) - storage_not_on_payment_str_ids = [str(r.id) for r in storage_not_on_payment] - data = self.env["account.payment.method"].read_group( - domain=[("storage", "in", storage_not_on_payment_str_ids)], - fields=["storage"], - groupby=["storage"], - ) - mapped_data = {r["storage"]: r["storage_count"] for r in data} - - if any(mapped_data.get(str(rec.id), 0) > 0 for rec in storage_not_on_payment): - raise UserError(_("Storage is already used on at least one payment method")) diff --git a/account_payment_method_fs_storage/tests/__init__.py b/account_payment_method_fs_storage/tests/__init__.py deleted file mode 100644 index be4eb6652063..000000000000 --- a/account_payment_method_fs_storage/tests/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import test_account_payment_method_fs_storage diff --git a/account_payment_method_fs_storage/tests/test_account_payment_method_fs_storage.py b/account_payment_method_fs_storage/tests/test_account_payment_method_fs_storage.py deleted file mode 100644 index 99594187ab55..000000000000 --- a/account_payment_method_fs_storage/tests/test_account_payment_method_fs_storage.py +++ /dev/null @@ -1,129 +0,0 @@ -# Copyright 2024 ACSONE SA/NV -# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from contextlib import contextmanager -from datetime import date -from unittest.mock import patch - -from odoo.exceptions import UserError -from odoo.tests import tagged - -from odoo.addons.account.tests.common import AccountTestInvoicingCommon - - -@tagged("-at_install", "post_install") -class TestAccountPaymentMethodFsStorage(AccountTestInvoicingCommon): - @classmethod - def setUpClass(cls): - super().setUpClass() - cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) - cls.company = cls.company_data["company"] - - cls.fs_storage = cls.env.ref("fs_storage.default_fs_storage") - - cls.fs_storage.write( - { - "use_on_payment_method": True, - } - ) - cls.payment_method = cls.env.ref( - "account.account_payment_method_manual_out" - ).copy( - { - "storage": str(cls.fs_storage.id), - "name": "method test", - "code": "test", - } - ) - - cls.creation_mode = cls.env["account.payment.mode"].create( - { - "name": "Test Direct Debit of suppliers from Société Générale", - "company_id": cls.company.id, - "bank_account_link": "variable", - "payment_method_id": cls.payment_method.id, - } - ) - cls.bank_journal = cls.company_data["default_journal_bank"] - cls.partner = cls.env["res.partner"].create( - { - "name": "Test Partner", - } - ) - - # create payment order with payment method and fs storage - - @contextmanager - def with_custom_method(self): - path = ( - "odoo.addons.account_payment_order.models" - ".account_payment_order.AccountPaymentOrder.generate_payment_file" - ) - with patch( - path, - new=lambda self: (b"Content", "Filename"), - create=not hasattr( - self.env["account.payment.order"], "generate_payment_file" - ), - ): - yield - - def test_payment_method_fs_storage(self): - order_vals = { - "payment_type": "outbound", - "payment_mode_id": self.creation_mode.id, - "journal_id": self.bank_journal.id, - } - - order = self.env["account.payment.order"].create(order_vals) - - vals = { - "order_id": order.id, - "partner_id": self.partner.id, - "communication": "manual line and manual date", - "currency_id": order.payment_mode_id.company_id.currency_id.id, - "amount_currency": 200, - "date": date.today(), - } - self.env["account.payment.line"].create(vals) - - order.draft2open() - with self.with_custom_method(): - action = order.open2generated() - - self.assertDictEqual( - action, - { - "type": "ir.actions.client", - "tag": "display_notification", - "params": { - "type": "success", - "title": "Generate and export", - "message": "The file has been generated and dropped on the storage.", - "sticky": True, - "next": { - "type": "ir.actions.client", - "tag": "reload", - }, - }, - }, - ) - - attachment = self.env["ir.attachment"].search( - [("res_model", "=", "account.payment.order"), ("res_id", "=", order.id)] - ) - - self.assertEqual(len(attachment), 1) - - def test_check_use_on_payment_method(self): - self.assertEqual(self.payment_method.storage, str(self.fs_storage.id)) - - with self.assertRaisesRegex( - UserError, "Storage is already used on at least one payment method" - ): - self.fs_storage.write({"use_on_payment_method": False}) - - self.payment_method.write({"storage": False}) - self.fs_storage.write({"use_on_payment_method": False}) - - self.assertFalse(self.payment_method.storage) - self.assertFalse(self.fs_storage.use_on_payment_method) diff --git a/account_payment_method_fs_storage/views/fs_storage.xml b/account_payment_method_fs_storage/views/fs_storage.xml deleted file mode 100644 index 891aaef007da..000000000000 --- a/account_payment_method_fs_storage/views/fs_storage.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - fs.storage - - - - - - - - - - - diff --git a/account_payment_method_fs_storage/README.rst b/account_payment_method_or_mode_fs_storage/README.rst similarity index 84% rename from account_payment_method_fs_storage/README.rst rename to account_payment_method_or_mode_fs_storage/README.rst index 53c6bc46cfa0..0592a9f36de8 100644 --- a/account_payment_method_fs_storage/README.rst +++ b/account_payment_method_or_mode_fs_storage/README.rst @@ -1,6 +1,6 @@ -================================= -Account Payment Method Fs Storage -================================= +========================================= +Account Payment Method Or Mode Fs Storage +========================================= .. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -17,10 +17,10 @@ Account Payment Method Fs Storage :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fbank--payment-lightgray.png?logo=github - :target: https://github.com/OCA/bank-payment/tree/16.0/account_payment_method_fs_storage + :target: https://github.com/OCA/bank-payment/tree/16.0/account_payment_method_or_mode_fs_storage :alt: OCA/bank-payment .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_payment_method_fs_storage + :target: https://translation.odoo-community.org/projects/bank-payment-16-0/bank-payment-16-0-account_payment_method_or_mode_fs_storage :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/bank-payment&target_branch=16.0 @@ -52,7 +52,7 @@ Configuration For setting the Storage: -#. Activate "Use On Payment Method" on storage (boolean on form of Storage) +#. Activate "Use On Payment Method/Mode" on storage (boolean on form of Storage) #. Go to Invoicing/Accounting > Configuration > Payment Methods #. You can specify your storage on the payment method @@ -68,7 +68,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -85,6 +85,7 @@ Contributors * François Honoré * Zina Rasoamanana +* Lindsay Marion Maintainers ~~~~~~~~~~~ @@ -99,6 +100,6 @@ 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/bank-payment `_ project on GitHub. +This module is part of the `OCA/bank-payment `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/account_payment_method_fs_storage/__init__.py b/account_payment_method_or_mode_fs_storage/__init__.py similarity index 100% rename from account_payment_method_fs_storage/__init__.py rename to account_payment_method_or_mode_fs_storage/__init__.py diff --git a/account_payment_method_fs_storage/__manifest__.py b/account_payment_method_or_mode_fs_storage/__manifest__.py similarity index 61% rename from account_payment_method_fs_storage/__manifest__.py rename to account_payment_method_or_mode_fs_storage/__manifest__.py index 73cdd04a04dd..7fdc44824ec0 100644 --- a/account_payment_method_fs_storage/__manifest__.py +++ b/account_payment_method_or_mode_fs_storage/__manifest__.py @@ -2,21 +2,24 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { - "name": "Account Payment Method Fs Storage", + "name": "Account Payment Method Or Mode Fs Storage", "summary": """ - Add the possibility to specify on the payment method, + Add the possibility to specify on the payment method or on the + payment mode depending on the company, a storage where files generated will be pushed to upon payment """, - "version": "16.0.1.0.2", + "version": "16.0.1.0.4", "license": "AGPL-3", "author": "ACSONE SA/NV,Odoo Community Association (OCA)", "website": "https://github.com/OCA/bank-payment", "depends": [ "account_banking_sepa_credit_transfer", "fs_storage", + "account_payment_mode", ], "data": [ - "views/fs_storage.xml", + "views/res_config_settings.xml", + "views/account_payment_mode.xml", "views/account_payment_method.xml", ], "demo": [], diff --git a/account_payment_method_or_mode_fs_storage/migrations/16.0.1.0.4/post-migrate.py b/account_payment_method_or_mode_fs_storage/migrations/16.0.1.0.4/post-migrate.py new file mode 100644 index 000000000000..5e15dbc10041 --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/migrations/16.0.1.0.4/post-migrate.py @@ -0,0 +1,18 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +from openupgradelib import openupgrade + + +def _rename_modules(env): + modules = [ + ( + "account_payment_method_fs_storage", + "account_payment_method_or_mode_fs_storage", + ) + ] + openupgrade.update_module_names(env.cr, modules, merge_modules=True) + + +@openupgrade.migrate() +def migrate(env, version): + _rename_modules(env) diff --git a/account_payment_method_or_mode_fs_storage/models/__init__.py b/account_payment_method_or_mode_fs_storage/models/__init__.py new file mode 100644 index 000000000000..da4e0379cf9d --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/models/__init__.py @@ -0,0 +1,5 @@ +from . import account_payment_order +from . import account_payment_method +from . import account_payment_mode +from . import res_config_settings +from . import res_company diff --git a/account_payment_method_or_mode_fs_storage/models/account_payment_method.py b/account_payment_method_or_mode_fs_storage/models/account_payment_method.py new file mode 100644 index 000000000000..fb04bf993168 --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/models/account_payment_method.py @@ -0,0 +1,38 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +import ast + +from odoo import fields, models + + +class AccountPaymentMethod(models.Model): + + _inherit = "account.payment.method" + + storage = fields.Selection( + selection="_get_selection_storage", + default="", + company_dependent=True, + help="Storage where to put the file after generation", + ) + + def _get_selection_storage(self): + """ + This is to avoid giving access to the model fs.storage + at groups other than base.group_system + """ + fs_storage_source = self.env.company.fs_storage_source_payment + if fs_storage_source == "method": + ids = ( + self.env["ir.config_parameter"] + .sudo() + .get_param( + "account_payment_method_or_mode_fs_storage" + f".fs_storage_ids_{self.env.company.id}" + ) + ) + if ids: + storages = self.env["fs.storage"].browse(ast.literal_eval(ids)) + return [(str(r.id), r.display_name) for r in storages] + return [] diff --git a/account_payment_method_or_mode_fs_storage/models/account_payment_mode.py b/account_payment_method_or_mode_fs_storage/models/account_payment_mode.py new file mode 100644 index 000000000000..a1f754ce83a5 --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/models/account_payment_mode.py @@ -0,0 +1,36 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import ast + +from odoo import fields, models + + +class AccountPaymentMode(models.Model): + + _inherit = "account.payment.mode" + + storage = fields.Selection( + selection="_get_selection_storage", + help="Storage where to put the file after generation", + ) + + def _get_selection_storage(self): + """ + This is to avoid giving access to the model fs.storage + at groups other than base.group_system + """ + fs_storage_source = self.env.company.fs_storage_source_payment + if fs_storage_source == "mode": + ids = ( + self.env["ir.config_parameter"] + .sudo() + .get_param( + "account_payment_method_or_mode_fs_storage" + f".fs_storage_ids_{self.env.company.id}" + ) + ) + if ids: + storages = self.env["fs.storage"].browse(ast.literal_eval(ids)) + return [(str(r.id), r.display_name) for r in storages] + return [] diff --git a/account_payment_method_fs_storage/models/account_payment_order.py b/account_payment_method_or_mode_fs_storage/models/account_payment_order.py similarity index 84% rename from account_payment_method_fs_storage/models/account_payment_order.py rename to account_payment_method_or_mode_fs_storage/models/account_payment_order.py index 55f8d681f915..4bc7b0f45fb1 100644 --- a/account_payment_method_fs_storage/models/account_payment_order.py +++ b/account_payment_method_or_mode_fs_storage/models/account_payment_order.py @@ -12,14 +12,21 @@ class AccountPaymentOrder(models.Model): _inherit = "account.payment.order" + def _get_storage(self): + if self.env.company.fs_storage_source_payment == "mode": + return self.payment_mode_id.storage + else: + return self.payment_method_id.storage + return "" + def _must_be_exported_to_storage(self): self.ensure_one() - return bool(self.payment_method_id.storage) + return bool(self._get_storage()) def _export_to_storage(self, file_content, filename): - storage_id = int(self.payment_method_id.storage) + storage_id = int(self._get_storage()) # user that confirms order may not have access to storage - export_storage = self.env["fs.storage"].sudo().search([("id", "=", storage_id)]) + export_storage = self.env["fs.storage"].sudo().browse([storage_id]) try: storage = export_storage._get_filesystem() storage.pipe_file(filename, file_content) diff --git a/account_payment_method_or_mode_fs_storage/models/res_company.py b/account_payment_method_or_mode_fs_storage/models/res_company.py new file mode 100644 index 000000000000..23414954e0a5 --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/models/res_company.py @@ -0,0 +1,18 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + + _inherit = "res.company" + + fs_storage_source_payment = fields.Selection( + string="fs storage source payment", + selection=[ + ("mode", "Mode"), + ("method", "Method"), + ], + default="mode", + ) diff --git a/account_payment_method_or_mode_fs_storage/models/res_config_settings.py b/account_payment_method_or_mode_fs_storage/models/res_config_settings.py new file mode 100644 index 000000000000..a9ba215a8843 --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/models/res_config_settings.py @@ -0,0 +1,67 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +import ast + +from odoo import Command, _, api, fields, models +from odoo.exceptions import UserError + + +class ResConfigSettings(models.TransientModel): + + _inherit = "res.config.settings" + fs_storage_source_payment = fields.Selection( + string="fs storage source payment", + related="company_id.fs_storage_source_payment", + readonly=False, + ) + + fs_storage_ids = fields.Many2many("fs.storage", string="Fs Storage allowed") + + @api.model + def get_values(self): + res = super().get_values() + fs_storage_ids = ( + self.env["ir.config_parameter"] + .sudo() + .get_param( + "account_payment_method_or_mode_fs_storage" + f".fs_storage_ids_{self.env.company.id}" + ) + ) + + res.update( + fs_storage_ids=[Command.set(ast.literal_eval(fs_storage_ids))] + if fs_storage_ids + else False + ) + return res + + @api.model + def set_values(self): + self.env["ir.config_parameter"].sudo().set_param( + f"account_payment_method_or_mode_fs_storage.fs_storage_ids_{self.env.company.id}", + self.fs_storage_ids.ids, + ) + return super().set_values() + + @api.constrains("fs_storage_ids") + def _check_fs_storage_ids(self): + fs_storage_source = self.fs_storage_source_payment + if fs_storage_source == "mode": + used_storages = ( + self.env["account.payment.mode"].search([]).mapped("storage") + ) + else: + used_storages = ( + self.env["account.payment.method"].search([]).mapped("storage") + ) + if any(used_storages): + ids = [int(storage_id) for storage_id in used_storages if storage_id] + allowed_storages = self.fs_storage_ids + if not set(allowed_storages.ids).issuperset([i for i in ids]): + raise UserError( + _( + f"Storage is already used on at least one payment {fs_storage_source}" + ) + ) diff --git a/account_payment_method_fs_storage/readme/CONFIGURE.rst b/account_payment_method_or_mode_fs_storage/readme/CONFIGURE.rst similarity index 64% rename from account_payment_method_fs_storage/readme/CONFIGURE.rst rename to account_payment_method_or_mode_fs_storage/readme/CONFIGURE.rst index e4c327ab1328..03a99fb1e2ad 100644 --- a/account_payment_method_fs_storage/readme/CONFIGURE.rst +++ b/account_payment_method_or_mode_fs_storage/readme/CONFIGURE.rst @@ -1,5 +1,5 @@ For setting the Storage: -#. Activate "Use On Payment Method" on storage (boolean on form of Storage) +#. Activate "Use On Payment Method/Mode" on storage (boolean on form of Storage) #. Go to Invoicing/Accounting > Configuration > Payment Methods #. You can specify your storage on the payment method diff --git a/account_payment_method_fs_storage/readme/CONTRIBUTORS.rst b/account_payment_method_or_mode_fs_storage/readme/CONTRIBUTORS.rst similarity index 68% rename from account_payment_method_fs_storage/readme/CONTRIBUTORS.rst rename to account_payment_method_or_mode_fs_storage/readme/CONTRIBUTORS.rst index 5efd87d78346..2b19f7942323 100644 --- a/account_payment_method_fs_storage/readme/CONTRIBUTORS.rst +++ b/account_payment_method_or_mode_fs_storage/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * François Honoré * Zina Rasoamanana +* Lindsay Marion diff --git a/account_payment_method_fs_storage/readme/DESCRIPTION.rst b/account_payment_method_or_mode_fs_storage/readme/DESCRIPTION.rst similarity index 100% rename from account_payment_method_fs_storage/readme/DESCRIPTION.rst rename to account_payment_method_or_mode_fs_storage/readme/DESCRIPTION.rst diff --git a/account_payment_method_fs_storage/readme/INSTALL.rst b/account_payment_method_or_mode_fs_storage/readme/INSTALL.rst similarity index 100% rename from account_payment_method_fs_storage/readme/INSTALL.rst rename to account_payment_method_or_mode_fs_storage/readme/INSTALL.rst diff --git a/account_payment_method_fs_storage/readme/USAGE.rst b/account_payment_method_or_mode_fs_storage/readme/USAGE.rst similarity index 100% rename from account_payment_method_fs_storage/readme/USAGE.rst rename to account_payment_method_or_mode_fs_storage/readme/USAGE.rst diff --git a/account_payment_method_fs_storage/static/description/icon.png b/account_payment_method_or_mode_fs_storage/static/description/icon.png similarity index 100% rename from account_payment_method_fs_storage/static/description/icon.png rename to account_payment_method_or_mode_fs_storage/static/description/icon.png diff --git a/account_payment_method_fs_storage/static/description/index.html b/account_payment_method_or_mode_fs_storage/static/description/index.html similarity index 87% rename from account_payment_method_fs_storage/static/description/index.html rename to account_payment_method_or_mode_fs_storage/static/description/index.html index b14e4e8cc093..0e57aea17f0e 100644 --- a/account_payment_method_fs_storage/static/description/index.html +++ b/account_payment_method_or_mode_fs_storage/static/description/index.html @@ -3,15 +3,16 @@ -Account Payment Method Fs Storage +Account Payment Method Or Mode Fs Storage -
-

Account Payment Method Fs Storage

+
+

Account Payment Method Or Mode Fs Storage

-

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

+

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

This Odoo addon enhances the payment mode functionality by introducing the ability to designate a specific storage location. Users can now specify a storage destination within the payment method, facilitating the automatic transfer of generated files to the designated location upon completing a payment transaction.

@@ -400,7 +401,7 @@

Installation

Configuration

For setting the Storage:

    -
  1. Activate “Use On Payment Method” on storage (boolean on form of Storage)
  2. +
  3. Activate “Use On Payment Method/Mode” on storage (boolean on form of Storage)
  4. Go to Invoicing/Accounting > Configuration > Payment Methods
  5. You can specify your storage on the payment method
@@ -415,7 +416,7 @@

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.

+feedback.

Do not contact contributors directly about support or help with technical issues.

@@ -431,16 +432,19 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +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/bank-payment project on GitHub.

+

This module is part of the OCA/bank-payment project on GitHub.

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

diff --git a/account_payment_method_or_mode_fs_storage/tests/__init__.py b/account_payment_method_or_mode_fs_storage/tests/__init__.py new file mode 100644 index 000000000000..195ba44acf3c --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/tests/__init__.py @@ -0,0 +1 @@ +from . import test_account_payment_method_or_mode_fs_storage diff --git a/account_payment_method_or_mode_fs_storage/tests/test_account_payment_method_or_mode_fs_storage.py b/account_payment_method_or_mode_fs_storage/tests/test_account_payment_method_or_mode_fs_storage.py new file mode 100644 index 000000000000..478cda802257 --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/tests/test_account_payment_method_or_mode_fs_storage.py @@ -0,0 +1,293 @@ +# Copyright 2024 ACSONE SA/NV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from contextlib import contextmanager +from datetime import date +from unittest.mock import patch + +from odoo.exceptions import UserError +from odoo.tests import tagged + +from odoo.addons.account.tests.common import AccountTestInvoicingCommon + + +@tagged("-at_install", "post_install") +class TestAccountPaymentMethodOrModeFsStorage(AccountTestInvoicingCommon): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.company = cls.company_data["company"] + + cls.other_company = cls.company_data_2["company"] + cls.fs_storage_method = cls.env.ref("fs_storage.default_fs_storage") + cls.fs_storage_mode = cls.fs_storage_method.copy() + cls.payment_method = cls.env.ref( + "account.account_payment_method_manual_out" + ).copy( + { + "name": "method test", + "code": "test", + } + ) + + cls.creation_mode = cls.env["account.payment.mode"].create( + { + "name": "Test Direct Debit of suppliers from Société Générale", + "company_id": cls.company.id, + "bank_account_link": "variable", + "payment_method_id": cls.payment_method.id, + } + ) + cls.creation_mode2 = cls.env["account.payment.mode"].create( + { + "name": "Test Direct Debit of suppliers from Société Générale", + "company_id": cls.other_company.id, + "bank_account_link": "variable", + "payment_method_id": cls.payment_method.id, + } + ) + cls.bank_journal = cls.company_data["default_journal_bank"] + cls.bank_journal2 = cls.company_data_2["default_journal_bank"] + cls.partner = cls.env["res.partner"].create( + { + "name": "Test Partner", + } + ) + # create payment order with payment method and fs storage + + @contextmanager + def with_custom_method(self): + path = ( + "odoo.addons.account_payment_order.models" + ".account_payment_order.AccountPaymentOrder.generate_payment_file" + ) + with patch( + path, + new=lambda self: (b"Content", "Filename"), + create=not hasattr( + self.env["account.payment.order"], "generate_payment_file" + ), + ): + yield + + def test_payment_method_fs_storage(self): + self.env.user.company_id = self.company.id + self.company.update( + { + "fs_storage_source_payment": "method", + } + ) + self.env["ir.config_parameter"].sudo().set_param( + f"account_payment_method_or_mode_fs_storage.fs_storage_ids_{self.company.id}", + [self.fs_storage_method.id], + ) + self.payment_method.storage = str(self.fs_storage_method.id) + order_vals = { + "payment_type": "outbound", + "payment_mode_id": self.creation_mode.id, + "journal_id": self.bank_journal.id, + } + + order = self.env["account.payment.order"].create(order_vals) + + vals = { + "order_id": order.id, + "partner_id": self.partner.id, + "communication": "manual line and manual date", + "currency_id": order.payment_mode_id.company_id.currency_id.id, + "amount_currency": 200, + "date": date.today(), + } + self.env["account.payment.line"].create(vals) + + order.draft2open() + with self.with_custom_method(): + action = order.open2generated() + + self.assertDictEqual( + action, + { + "type": "ir.actions.client", + "tag": "display_notification", + "params": { + "type": "success", + "title": "Generate and export", + "message": "The file has been generated and dropped on the storage.", + "sticky": True, + "next": { + "type": "ir.actions.client", + "tag": "reload", + }, + }, + }, + ) + attachment = self.env["ir.attachment"].search( + [("res_model", "=", "account.payment.order"), ("res_id", "=", order.id)] + ) + self.assertEqual(len(attachment), 1) + + def test_check_use_on_payment_method(self): + self.env.user.company_id = self.company.id + self.company.update( + { + "fs_storage_source_payment": "method", + } + ) + method_config = self.env["res.config.settings"].create({}) + method_config.fs_storage_source_payment = "method" + method_config.fs_storage_ids = [self.fs_storage_method.id] + self.env["ir.config_parameter"].sudo().set_param( + f"account_payment_method_or_mode_fs_storage.fs_storage_ids_{self.company.id}", + [self.fs_storage_method.id], + ) + + self.payment_method.storage = str(self.fs_storage_method.id) + self.assertEqual(self.payment_method.storage, str(self.fs_storage_method.id)) + + with self.assertRaisesRegex( + UserError, "Storage is already used on at least one payment method" + ): + method_config.fs_storage_ids = False + + self.payment_method.write({"storage": False}) + method_config.fs_storage_ids = False + + def test_method_fs_storage_other_company(self): + self.env.user.company_id = self.other_company.id + self.other_company.update( + { + "fs_storage_source_payment": "method", + } + ) + self.env["ir.config_parameter"].sudo().set_param( + f"account_payment_method_or_mode_fs_storage.fs_storage_ids_{self.other_company.id}", + [self.fs_storage_method.id], + ) + self.payment_method.storage = str(self.fs_storage_method.id) + order_vals = { + "payment_type": "outbound", + "payment_mode_id": self.creation_mode2.id, + "journal_id": self.bank_journal2.id, + } + + order = self.env["account.payment.order"].create(order_vals) + + vals = { + "order_id": order.id, + "partner_id": self.partner.id, + "communication": "manual line and manual date", + "currency_id": order.payment_mode_id.company_id.currency_id.id, + "amount_currency": 200, + "date": date.today(), + } + self.env["account.payment.line"].create(vals) + + order.draft2open() + with self.with_custom_method(): + action = order.open2generated() + + self.assertDictEqual( + action, + { + "type": "ir.actions.client", + "tag": "display_notification", + "params": { + "type": "success", + "title": "Generate and export", + "message": "The file has been generated and dropped on the storage.", + "sticky": True, + "next": { + "type": "ir.actions.client", + "tag": "reload", + }, + }, + }, + ) + attachment = self.env["ir.attachment"].search( + [("res_model", "=", "account.payment.order"), ("res_id", "=", order.id)] + ) + self.assertEqual(len(attachment), 1) + + def test_payment_mode_fs_storage(self): + self.env.user.company_id = self.company.id + self.company.update( + { + "fs_storage_source_payment": "mode", + } + ) + + self.env["ir.config_parameter"].sudo().set_param( + f"account_payment_method_or_mode_fs_storage.fs_storage_ids_{self.company.id}", + [self.fs_storage_mode.id], + ) + self.creation_mode.storage = str(self.fs_storage_mode.id) + + order_vals = { + "payment_type": "outbound", + "payment_mode_id": self.creation_mode.id, + "journal_id": self.bank_journal.id, + } + + order = self.env["account.payment.order"].create(order_vals) + + vals = { + "order_id": order.id, + "partner_id": self.partner.id, + "communication": "manual line and manual date", + "currency_id": order.payment_mode_id.company_id.currency_id.id, + "amount_currency": 200, + "date": date.today(), + } + self.env["account.payment.line"].create(vals) + + order.draft2open() + with self.with_custom_method(): + action = order.open2generated() + + self.assertDictEqual( + action, + { + "type": "ir.actions.client", + "tag": "display_notification", + "params": { + "type": "success", + "title": "Generate and export", + "message": "The file has been generated and dropped on the storage.", + "sticky": True, + "next": { + "type": "ir.actions.client", + "tag": "reload", + }, + }, + }, + ) + attachment = self.env["ir.attachment"].search( + [("res_model", "=", "account.payment.order"), ("res_id", "=", order.id)] + ) + self.assertEqual(len(attachment), 1) + + def test_check_use_on_payment_mode(self): + self.env.user.company_id = self.company.id + self.company.update( + { + "fs_storage_source_payment": "mode", + } + ) + mode_config = self.env["res.config.settings"].create({}) + mode_config.fs_storage_source_payment = "mode" + mode_config.fs_storage_ids = [self.fs_storage_mode.id] + self.env["ir.config_parameter"].sudo().set_param( + f"account_payment_method_or_mode_fs_storage.fs_storage_ids_{self.company.id}", + [self.fs_storage_mode.id], + ) + + self.creation_mode.storage = str(self.fs_storage_mode.id) + self.assertEqual(self.creation_mode.storage, str(self.fs_storage_mode.id)) + + with self.assertRaisesRegex( + UserError, "Storage is already used on at least one payment mode" + ): + mode_config.fs_storage_ids = False + + self.creation_mode.write({"storage": False}) + mode_config.fs_storage_ids = False diff --git a/account_payment_method_fs_storage/views/account_payment_method.xml b/account_payment_method_or_mode_fs_storage/views/account_payment_method.xml similarity index 96% rename from account_payment_method_fs_storage/views/account_payment_method.xml rename to account_payment_method_or_mode_fs_storage/views/account_payment_method.xml index 9dde8dfc5aa7..2fcfe5dfe581 100644 --- a/account_payment_method_fs_storage/views/account_payment_method.xml +++ b/account_payment_method_or_mode_fs_storage/views/account_payment_method.xml @@ -6,7 +6,7 @@ account.payment.method.form (in account_payment_method_fs_storage) + >account.payment.method.form (in account_payment_method_or_mode_fs_storage) account.payment.method + + + + + account.payment.mode.form (in account_payment_method_or_mode_fs_storage) + account.payment.mode + + + + + + + + + + + diff --git a/account_payment_method_or_mode_fs_storage/views/res_config_settings.xml b/account_payment_method_or_mode_fs_storage/views/res_config_settings.xml new file mode 100644 index 000000000000..b275feec4f5e --- /dev/null +++ b/account_payment_method_or_mode_fs_storage/views/res_config_settings.xml @@ -0,0 +1,74 @@ + + + + + res.config.settings.form (in account_payment_method_or_mode_fs_storage) + res.config.settings + + + + +

Origin of fs storage for payment

+
+
+
+
+ fs storage source payment: + +
+ Select where the information about the storage is taken +
+
+ +
+
+ Allowed storage: + +
+ Select the storages allowed +
+
+ +
+
+
+
+
+ + + + + + + diff --git a/setup/account_payment_method_fs_storage/odoo/addons/account_payment_method_fs_storage b/setup/account_payment_method_fs_storage/odoo/addons/account_payment_method_fs_storage deleted file mode 120000 index b9c8bd8942d9..000000000000 --- a/setup/account_payment_method_fs_storage/odoo/addons/account_payment_method_fs_storage +++ /dev/null @@ -1 +0,0 @@ -../../../../account_payment_method_fs_storage \ No newline at end of file diff --git a/setup/account_payment_method_or_mode_fs_storage/odoo/addons/account_payment_method_or_mode_fs_storage b/setup/account_payment_method_or_mode_fs_storage/odoo/addons/account_payment_method_or_mode_fs_storage new file mode 120000 index 000000000000..7c99221cdf92 --- /dev/null +++ b/setup/account_payment_method_or_mode_fs_storage/odoo/addons/account_payment_method_or_mode_fs_storage @@ -0,0 +1 @@ +../../../../account_payment_method_or_mode_fs_storage \ No newline at end of file diff --git a/setup/account_payment_method_fs_storage/setup.py b/setup/account_payment_method_or_mode_fs_storage/setup.py similarity index 100% rename from setup/account_payment_method_fs_storage/setup.py rename to setup/account_payment_method_or_mode_fs_storage/setup.py