From ff10a89814a9e4195cf6f0860d8b4254c8899cbd Mon Sep 17 00:00:00 2001 From: Victor Champonnois Date: Fri, 12 Jul 2024 15:17:49 +0200 Subject: [PATCH 1/4] [REF] move company settings to main settings --- cooperator/__manifest__.py | 2 +- cooperator/models/__init__.py | 1 + cooperator/models/res_config_settings.py | 125 ++++ cooperator/models/subscription_request.py | 1 + cooperator/views/res_company_view.xml | 76 --- cooperator/views/res_config_settings_view.xml | 600 ++++++++++++++++++ 6 files changed, 728 insertions(+), 77 deletions(-) create mode 100644 cooperator/models/res_config_settings.py delete mode 100644 cooperator/views/res_company_view.xml create mode 100644 cooperator/views/res_config_settings_view.xml diff --git a/cooperator/__manifest__.py b/cooperator/__manifest__.py index 5a739af34..76a55287b 100644 --- a/cooperator/__manifest__.py +++ b/cooperator/__manifest__.py @@ -40,7 +40,7 @@ "views/operation_request_view.xml", "views/account_move_views.xml", "views/product_view.xml", - "views/res_company_view.xml", + "views/res_config_settings_view.xml", "views/account_journal_views.xml", "views/cooperative_membership_view.xml", "views/menus.xml", diff --git a/cooperator/models/__init__.py b/cooperator/models/__init__.py index f1b70f3ff..68818c038 100644 --- a/cooperator/models/__init__.py +++ b/cooperator/models/__init__.py @@ -12,6 +12,7 @@ from . import operation_request from . import product_template from . import res_company +from . import res_config_settings from . import res_partner from . import share_line from . import subscription_register diff --git a/cooperator/models/res_config_settings.py b/cooperator/models/res_config_settings.py new file mode 100644 index 000000000..83b169450 --- /dev/null +++ b/cooperator/models/res_config_settings.py @@ -0,0 +1,125 @@ +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + coop_email_contact = fields.Char( + related="company_id.coop_email_contact", readonly=False + ) + subscription_maximum_amount = fields.Float( + related="company_id.subscription_maximum_amount", readonly=False + ) + # default_ is a special prefix, so I renamed putting default at the end + capital_release_request_payment_term_default = fields.Many2one( + related="company_id.default_capital_release_request_payment_term", + readonly=False, + ) + country_id_default = fields.Many2one( + related="company_id.default_country_id", readonly=False + ) + lang_id_default = fields.Many2one( + related="company_id.default_lang_id", readonly=False + ) + allow_id_card_upload = fields.Boolean( + related="company_id.allow_id_card_upload", readonly=False + ) + create_user = fields.Boolean(related="company_id.create_user", readonly=False) + board_representative = fields.Char( + related="company_id.board_representative", readonly=False + ) + signature_scan = fields.Binary(related="company_id.signature_scan", readonly=False) + property_cooperator_account = fields.Many2one( + related="company_id.property_cooperator_account", readonly=False + ) + subscription_journal_id = fields.Many2one( + related="company_id.subscription_journal_id", readonly=False + ) + unmix_share_type = fields.Boolean( + related="company_id.unmix_share_type", readonly=False + ) + display_logo1 = fields.Boolean(related="company_id.display_logo1", readonly=False) + display_logo2 = fields.Boolean(related="company_id.display_logo2", readonly=False) + bottom_logo1 = fields.Binary(related="company_id.bottom_logo1", readonly=False) + bottom_logo2 = fields.Binary(related="company_id.bottom_logo2", readonly=False) + logo_url = fields.Char(related="company_id.logo_url", readonly=False) + display_data_policy_approval = fields.Boolean( + related="company_id.display_data_policy_approval", readonly=False + ) + data_policy_approval_required = fields.Boolean( + related="company_id.data_policy_approval_required", readonly=False + ) + data_policy_approval_text = fields.Html( + related="company_id.data_policy_approval_text", readonly=False + ) + display_internal_rules_approval = fields.Boolean( + related="company_id.display_internal_rules_approval", readonly=False + ) + internal_rules_approval_required = fields.Boolean( + related="company_id.internal_rules_approval_required", readonly=False + ) + internal_rules_approval_text = fields.Html( + related="company_id.internal_rules_approval_text", readonly=False + ) + display_financial_risk_approval = fields.Boolean( + related="company_id.display_financial_risk_approval", readonly=False + ) + financial_risk_approval_required = fields.Boolean( + related="company_id.financial_risk_approval_required", readonly=False + ) + financial_risk_approval_text = fields.Html( + related="company_id.financial_risk_approval_text", readonly=False + ) + display_generic_rules_approval = fields.Boolean( + related="company_id.display_generic_rules_approval", readonly=False + ) + generic_rules_approval_required = fields.Boolean( + related="company_id.generic_rules_approval_required", readonly=False + ) + generic_rules_approval_text = fields.Html( + related="company_id.generic_rules_approval_text", readonly=False + ) + cooperator_certificate_mail_template = fields.Many2one( + related="company_id.cooperator_certificate_mail_template", readonly=False + ) + cooperator_certificate_increase_mail_template = fields.Many2one( + related="company_id.cooperator_certificate_increase_mail_template", + readonly=False, + ) + send_certificate_email = fields.Boolean( + related="company_id.send_certificate_email", readonly=False + ) + cooperator_confirmation_mail_template = fields.Many2one( + related="company_id.cooperator_confirmation_mail_template", readonly=False + ) + send_confirmation_email = fields.Boolean( + related="company_id.send_confirmation_email", readonly=False + ) + cooperator_capital_release_mail_template = fields.Many2one( + related="company_id.cooperator_capital_release_mail_template", readonly=False + ) + send_capital_release_email = fields.Boolean( + related="company_id.send_capital_release_email", readonly=False + ) + cooperator_waiting_list_mail_template = fields.Many2one( + related="company_id.cooperator_waiting_list_mail_template", readonly=False + ) + send_waiting_list_email = fields.Boolean( + related="company_id.send_waiting_list_email", readonly=False + ) + cooperator_share_transfer_mail_template = fields.Many2one( + related="company_id.cooperator_share_transfer_mail_template", readonly=False + ) + cooperator_share_update_no_shares_mail_template = fields.Many2one( + related="company_id.cooperator_share_update_no_shares_mail_template", + readonly=False, + ) + send_share_transfer_email = fields.Boolean( + related="company_id.send_share_transfer_email", readonly=False + ) + cooperator_share_update_mail_template = fields.Many2one( + related="company_id.cooperator_share_update_mail_template", readonly=False + ) + send_share_update_email = fields.Boolean( + related="company_id.send_share_update_email", readonly=False + ) diff --git a/cooperator/models/subscription_request.py b/cooperator/models/subscription_request.py index a6bab1788..f9b8d0ee7 100644 --- a/cooperator/models/subscription_request.py +++ b/cooperator/models/subscription_request.py @@ -325,6 +325,7 @@ def _compute_subscription_amount(self): required=True, readonly=True, states={"draft": [("readonly", False)]}, + default=lambda self: self.env.company.default_country_id.code, ) phone = fields.Char(readonly=True, states={"draft": [("readonly", False)]}) user_id = fields.Many2one( diff --git a/cooperator/views/res_company_view.xml b/cooperator/views/res_company_view.xml deleted file mode 100644 index 863e08782..000000000 --- a/cooperator/views/res_company_view.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - res.company.form.easymy.coop - - res.company - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cooperator/views/res_config_settings_view.xml b/cooperator/views/res_config_settings_view.xml new file mode 100644 index 000000000..7441c4432 --- /dev/null +++ b/cooperator/views/res_config_settings_view.xml @@ -0,0 +1,600 @@ + + + + Cooperators + res.config.settings + + + + +
+

General Settings

+
+ +
+
+ +
+
+ + Create users for cooperators +
+ Automatically create a portal user for cooperators +
+
+
+
+
+ +
+
+ + One share type per cooperator + +
+ Force cooperators to have only one type of share +
+
+
+
+
+ + Maximum amount + +
+ Maximum authorised subscription amount +
+
+ +
+
+
+
+
+ + Default language + +
+ Default language in subscription forms +
+
+ +
+
+
+
+
+ + Default country + +
+ Default country in subscription forms +
+
+ +
+
+
+
+

Report template

+
+
+
+ +
+
+ + Display logo 1 + +
+
+
+
+
+
+ + Logo 1 + +
+
+
+ +
+
+
+
+
+ +
+
+ + Display logo 2 + +
+
+
+
+
+
+ + Logo 2 + +
+
+
+ +
+
+
+
+
+ + Board representative name + +
+
+
+ +
+
+
+
+
+ + Board representative signature + +
+
+
+ +
+
+
+
+

Accounting

+
+ +
+
+ + Subscription Journal + +
+
+
+ +
+
+
+
+
+ + Cooperator Account + +
+ This account will be the default one as the receivable account + for + the cooperators
+
+ +
+
+
+ +
+
+ + Default Payment Term + +
+ Default payment term to use for capital release requests +
+
+ +
+
+
+ +
+

Website form

+
+
+
+ +
+
+ + Allow ID Card upload + +
+
+
+
+
+
+ +
+
+ + Display data policy +
+ Choose to display a data policy checkbox on the cooperator + website form +
+
+
+
+
+ +
+
+ + Require data policy approval + +
+
+
+
+
+
+ + Data policy text + +
+ Text to display aside the checkbox to approve data policy
+
+ +
+
+
+
+
+ +
+
+ + Display internal rules + +
+
+
+
+
+
+ +
+
+ + Require internal rules approval + +
+
+
+
+
+
+ + Internal rules text + +
+ Text to display aside the checkbox to approve internal rules. +
+
+ +
+
+
+
+
+ +
+
+ + Display financial risk + +
+
+
+
+
+
+ +
+
+ + Require financial risk approval + +
+
+
+
+
+
+ + Financial risk text + +
+ Text to display aside the checkbox to approve financial risk. +
+
+ +
+
+
+
+
+ +
+
+ + Display generic rules + +
+
+
+
+
+
+ +
+
+ + Require generic rules approval + +
+
+
+
+
+
+ + Generic rules text + +
+ Text to display aside the checkbox to approve the generic rules.
+
+ +
+
+
+
+

Email

+
+ +
+
+ + Contact email + +
+ Contact email address for the cooperator +
+
+ +
+
+
+ +
+
+ + Certificate email template + +
+ If left empty, the default global mail template will be used. +
+
+ +
+
+
+
+
+ + Certificate increase email template + +
+ If left empty, the default global mail template will be used. +
+
+ +
+
+
+
+
+ +
+
+ + Send certificate email + +
+ Automatically send the cooperator certificate when validating + share payment +
+
+
+
+
+ + Share confirmation email template + +
+ If left empty, the default global mail template will be used. +
+
+ +
+
+
+
+
+ +
+
+ + Send confirmation email + +
+ Automatically send a confirmation when a share subscription is + received. +
+
+
+
+
+ + Capital release email template + +
+ If left empty, the default global mail template will be used. +
+
+ +
+
+
+
+
+ +
+
+ + Send Capital Release email + +
+ Automatically send the a capital release email when a + subscription is validated. +
+
+
+
+
+ + Waiting list email template + +
+ If left empty, the default global mail template will be used. +
+
+ +
+
+
+
+
+ +
+
+ + Send Waiting List email + +
+ Automatically send an email when the subscription is put on the + waiting list. +
+
+
+
+
+ + Share transfer email template + +
+ If left empty, the default global mail template will be used. +
+
+ +
+
+
+
+
+ + Share transfer (no remaining shares) email template + +
+ If left empty, the default global mail template will be used. +
+
+ +
+
+
+
+
+ +
+
+ + Send share transfer email + +
+ Automatically send an email to the cooperator when a share has + been transfered. +
+
+
+
+
+ + Share update email template + +
+ If left empty, the default global mail template will be used. +
+
+ +
+
+
+
+
+ +
+
+ + Send share update email + +
+ Automatically send an email to the cooperator when a share has + been updated. +
+
+
+
+
+
+
+
+ +
From 94096e6519cf4d7b05ba9f538c3c6da6231ee46d Mon Sep 17 00:00:00 2001 From: Victor Champonnois Date: Fri, 12 Jul 2024 16:36:07 +0200 Subject: [PATCH 2/4] [IMP] improve settings layout --- cooperator/views/res_config_settings_view.xml | 684 ++++++++++-------- 1 file changed, 387 insertions(+), 297 deletions(-) diff --git a/cooperator/views/res_config_settings_view.xml b/cooperator/views/res_config_settings_view.xml index 7441c4432..42cd5b855 100644 --- a/cooperator/views/res_config_settings_view.xml +++ b/cooperator/views/res_config_settings_view.xml @@ -87,52 +87,59 @@
-
-
- - Display logo 1 - -
-
-
-
-
Logo 1
+ First logo to be displayed on the pdf reports
-
- +
+
+
+ +
+
+ +
+
- -
-
- - Display logo 2 - -
-
-
-
Logo 2
+ Second logo to be displayed on the pdf reports
-
- +
+
+
+ +
+
+ +
+
+
@@ -212,160 +219,203 @@ >
- -
-
- - Allow ID Card upload - -
-
-
-
-
-
- -
-
- - Display data policy -
- Choose to display a data policy checkbox on the cooperator - website form -
-
-
-
-
- -
-
- - Require data policy approval - -
-
-
-
-
-
- - Data policy text - -
- Text to display aside the checkbox to approve data policy
-
- -
-
-
-
-
-
- Display internal rules - -
+ Data policy + +
+ Data policy consent on the cooperator website form +
+
+
+
+ +
+
+ +
+
+
+
+
-
- Require internal rules approval - -
-
-
-
-
-
- - Internal rules text - -
- Text to display aside the checkbox to approve internal rules. -
-
- + Internal rules + +
+ Internal rules consent on the cooperator website form +
+
+
+
+ +
+
+ +
+
+
+
-
- Display financial risk - -
-
-
-
-
-
- -
-
- - Require financial risk approval - -
-
-
-
-
-
- - Financial risk text - -
- Text to display aside the checkbox to approve financial risk. -
-
- + Financial risk + +
+ Financial risk consent on the cooperator website form +
+
+
+
+ +
+
+ +
+
+
+
+
-
- Display generic rules - -
+ Generic rules + +
+ Generic rules consent on the cooperator website form +
+
+
+
+ +
+
+ +
+
+
+
- -
-
- - Require generic rules approval - -
-
+
-
-
- Generic rules text + Allow ID Card upload
- Text to display aside the checkbox to approve the generic rules.
-
-
@@ -386,208 +436,248 @@
- -
-
- - Certificate email template - -
- If left empty, the default global mail template will be used. -
-
- -
-
-
-
-
- - Certificate increase email template - -
- If left empty, the default global mail template will be used. -
-
- -
-
-
-
- Send certificate email - -
- Automatically send the cooperator certificate when validating - share payment -
-
-
-
-
- - Share confirmation email template - -
- If left empty, the default global mail template will be used. -
-
- + Certificate email + +
+
+
+ +
+
+
+
+
+
+
+ If empty, default template will be used +
+
+
-
- Send confirmation email - -
- Automatically send a confirmation when a share subscription is - received. -
-
-
-
-
- - Capital release email template - -
- If left empty, the default global mail template will be used. -
-
- + Share subscription confirmation email + +
+
+
+ +
+
+
+
+
+ If empty, default template will be used +
+
+
-
- Send Capital Release email - -
- Automatically send the a capital release email when a - subscription is validated. -
-
-
-
-
- - Waiting list email template - -
- If left empty, the default global mail template will be used. -
-
- + Capital release request email + +
+
+
+ +
+
+
+
+
+ If empty, default template will be used +
+
+
- -
-
- - Send Waiting List email - -
- Automatically send an email when the subscription is put on the - waiting list. -
-
-
-
-
- - Share transfer email template - -
- If left empty, the default global mail template will be used. -
-
- -
-
-
- Share transfer (no remaining shares) email template - -
- If left empty, the default global mail template will be used. -
-
- + Waiting list email + +
+
+
+ +
+
+
+
+
+ If empty, default template will be used +
+
+
-
- Send share transfer email + Share transfer email -
- Automatically send an email to the cooperator when a share has - been transfered. -
-
-
-
-
- - Share update email template - -
- If left empty, the default global mail template will be used. -
-
- +
+
+
+ +
+
+
+
+
+ If empty, default template will be used +
+
+
-
- Send share update email - -
- Automatically send an email to the cooperator when a share has - been updated. + Share update email + +
+
+
+ +
+
+
+
+
+
+
+ If empty, default template will be used +
+
+
From 7eec21c6859bd56858c1f8b3a45fc05d89c5996b Mon Sep 17 00:00:00 2001 From: Victor Champonnois Date: Fri, 12 Jul 2024 16:36:35 +0200 Subject: [PATCH 3/4] [ADD] menu to cooperator settings --- cooperator/views/menus.xml | 8 ++++++++ cooperator/views/res_config_settings_view.xml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/cooperator/views/menus.xml b/cooperator/views/menus.xml index b9af16831..3a51e92e8 100644 --- a/cooperator/views/menus.xml +++ b/cooperator/views/menus.xml @@ -111,6 +111,14 @@ SPDX-License-Identifier: AGPL-3.0-or-later sequence="100" groups="cooperator_group_manager" /> + + + + Settings + ir.actions.act_window + res.config.settings + form + inline + {'module' : 'cooperator', 'bin_size': False} + From f81ff91d19a4850dc5babbcba506ac8366468fc9 Mon Sep 17 00:00:00 2001 From: Victor Champonnois Date: Fri, 12 Jul 2024 17:03:01 +0200 Subject: [PATCH 4/4] [FIX] national number settings --- .../__manifest__.py | 5 +- .../models/__init__.py | 1 + .../models/res_config_settings.py | 12 +++++ .../views/res_company_view.xml | 17 ------ .../views/res_config_settings.xml | 53 +++++++++++++++++++ 5 files changed, 70 insertions(+), 18 deletions(-) create mode 100644 l10n_be_cooperator_national_number/models/res_config_settings.py delete mode 100644 l10n_be_cooperator_national_number/views/res_company_view.xml create mode 100644 l10n_be_cooperator_national_number/views/res_config_settings.xml diff --git a/l10n_be_cooperator_national_number/__manifest__.py b/l10n_be_cooperator_national_number/__manifest__.py index dc564548b..25177083c 100644 --- a/l10n_be_cooperator_national_number/__manifest__.py +++ b/l10n_be_cooperator_national_number/__manifest__.py @@ -9,6 +9,9 @@ "category": "Cooperative management", "website": "https://github.com/OCA/cooperative", "license": "AGPL-3", - "data": ["views/subscription_request_view.xml", "views/res_company_view.xml"], + "data": [ + "views/subscription_request_view.xml", + "views/res_config_settings.xml", + ], "demo": [], } diff --git a/l10n_be_cooperator_national_number/models/__init__.py b/l10n_be_cooperator_national_number/models/__init__.py index f229a2afd..269d03a48 100644 --- a/l10n_be_cooperator_national_number/models/__init__.py +++ b/l10n_be_cooperator_national_number/models/__init__.py @@ -4,4 +4,5 @@ from . import subscription_request from . import res_company +from . import res_config_settings from . import res_partner diff --git a/l10n_be_cooperator_national_number/models/res_config_settings.py b/l10n_be_cooperator_national_number/models/res_config_settings.py new file mode 100644 index 000000000..3d5802a99 --- /dev/null +++ b/l10n_be_cooperator_national_number/models/res_config_settings.py @@ -0,0 +1,12 @@ +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + display_national_number = fields.Boolean( + related="company_id.display_national_number", readonly=False + ) + require_national_number = fields.Boolean( + related="company_id.require_national_number", readonly=False + ) diff --git a/l10n_be_cooperator_national_number/views/res_company_view.xml b/l10n_be_cooperator_national_number/views/res_company_view.xml deleted file mode 100644 index 6f223c666..000000000 --- a/l10n_be_cooperator_national_number/views/res_company_view.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - res.company.form.easymy.coop - - res.company - - - - - - - - diff --git a/l10n_be_cooperator_national_number/views/res_config_settings.xml b/l10n_be_cooperator_national_number/views/res_config_settings.xml new file mode 100644 index 000000000..d18bd8e86 --- /dev/null +++ b/l10n_be_cooperator_national_number/views/res_config_settings.xml @@ -0,0 +1,53 @@ + + + + Cooperators national number + res.config.settings + + + +
+
+
+
+ + National Number + +
+ Add a national number field on share subscription +
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+