From d2d50ba63bae1c38378385c7694fcf2e5d652bca Mon Sep 17 00:00:00 2001 From: "Paolo (pgi)" Date: Wed, 9 Feb 2022 15:13:53 +0000 Subject: [PATCH] [ADD] l10n_it_edi_sdicoop: user settings for demo mode - A new flag is added to the Setting (l10n_it_edi_sdicoop_demo_mode) that is computed from the ir.config_parameter 'account_edi_proxy_client.demo'. If the flag is 'demo', Odoo will not send invoices through the EDI, if the flag is 'test', Odoo will send invoices to an IAP test server instance that operates with a test SDICoop service if the flag is 'prod', Odoo will send invoices to production IAP, that routes them to the official SDICoop service. - Some minor UI rework for the EDI parameters on res.company The EDI settings in the res_company form, under the 'Electronic Invoicing' tab, must stay on the left closes odoo/odoo#84925 X-original-commit: c5d049c55d21f9885e79182df2bd5f433c5bb782 Signed-off-by: Josse Colpaert --- .../data/config_demo.xml | 2 +- addons/l10n_it_edi/views/l10n_it_view.xml | 16 ++++++---------- .../models/res_config_settings.py | 16 ++++++++++++++++ .../views/res_config_settings_views.xml | 16 ++++++++++++++++ 4 files changed, 39 insertions(+), 11 deletions(-) diff --git a/addons/account_edi_proxy_client/data/config_demo.xml b/addons/account_edi_proxy_client/data/config_demo.xml index 40fbed3d19c..ea4b802d62c 100644 --- a/addons/account_edi_proxy_client/data/config_demo.xml +++ b/addons/account_edi_proxy_client/data/config_demo.xml @@ -3,7 +3,7 @@ account_edi_proxy_client.demo - True + demo diff --git a/addons/l10n_it_edi/views/l10n_it_view.xml b/addons/l10n_it_edi/views/l10n_it_view.xml index 94ec8a82f23..7b48f53933c 100644 --- a/addons/l10n_it_edi/views/l10n_it_view.xml +++ b/addons/l10n_it_edi/views/l10n_it_view.xml @@ -78,13 +78,11 @@ - - - - - - - + + + + + @@ -95,9 +93,7 @@ - - - + diff --git a/addons/l10n_it_edi_sdicoop/models/res_config_settings.py b/addons/l10n_it_edi_sdicoop/models/res_config_settings.py index 04d7874315d..7e76b7740d6 100644 --- a/addons/l10n_it_edi_sdicoop/models/res_config_settings.py +++ b/addons/l10n_it_edi_sdicoop/models/res_config_settings.py @@ -7,6 +7,22 @@ class ResConfigSettings(models.TransientModel): _inherit = 'res.config.settings' is_edi_proxy_active = fields.Boolean(compute='_compute_is_edi_proxy_active') + l10n_it_edi_sdicoop_demo_mode = fields.Selection( + [('demo', 'Demo'), + ('test', 'Test (experimental)'), + ('prod', 'Official')], + compute='_compute_l10n_it_edi_sdicoop_demo_mode', + inverse='_set_l10n_it_edi_sdicoop_demo_mode', + readonly=False) + + @api.depends("is_edi_proxy_active") + def _compute_l10n_it_edi_sdicoop_demo_mode(self): + for config in self: + config.l10n_it_edi_sdicoop_demo_mode = self.env['account_edi_proxy_client.user']._get_demo_state() + + def _set_l10n_it_edi_sdicoop_demo_mode(self): + for config in self: + self.env['ir.config_parameter'].set_param('account_edi_proxy_client.demo', config.l10n_it_edi_sdicoop_demo_mode) @api.depends('company_id.account_edi_proxy_client_ids', 'company_id.account_edi_proxy_client_ids.active') def _compute_is_edi_proxy_active(self): diff --git a/addons/l10n_it_edi_sdicoop/views/res_config_settings_views.xml b/addons/l10n_it_edi_sdicoop/views/res_config_settings_views.xml index 3929c555ae3..777e2f7923e 100644 --- a/addons/l10n_it_edi_sdicoop/views/res_config_settings_views.xml +++ b/addons/l10n_it_edi_sdicoop/views/res_config_settings_views.xml @@ -36,6 +36,22 @@ +
+
+
+ + Fattura Elettronica mode + +
+ In demo mode Odoo will just simulate the sending of invoices to the government.
+ In test mode (experimental) Odoo will send the invoices to a non-production service. +
+ +
+
+