From 55db77be6608a7d516295c71b868d6efefaf84a9 Mon Sep 17 00:00:00 2001 From: chaule97 Date: Mon, 28 Oct 2024 10:31:13 +0700 Subject: [PATCH] [MIG] web_m2x_options_manager: Migration to 18.0 --- web_m2x_options_manager/README.rst | 6 ++++++ web_m2x_options_manager/__manifest__.py | 2 +- web_m2x_options_manager/demo/res_partner_demo_view.xml | 8 +++----- .../models/m2x_create_edit_option.py | 10 +++++----- web_m2x_options_manager/readme/CREDITS.md | 1 + web_m2x_options_manager/static/description/index.html | 10 ++++++++-- web_m2x_options_manager/views/ir_model.xml | 6 ++---- 7 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 web_m2x_options_manager/readme/CREDITS.md diff --git a/web_m2x_options_manager/README.rst b/web_m2x_options_manager/README.rst index b046c0956..eba45e91e 100644 --- a/web_m2x_options_manager/README.rst +++ b/web_m2x_options_manager/README.rst @@ -75,6 +75,12 @@ Contributors - Duong (Tran Quoc) - Chau Le +Other credits +------------- + +The migration of this module from 17.0 to 18.0 was financially supported +by Camptocamp + Maintainers ----------- diff --git a/web_m2x_options_manager/__manifest__.py b/web_m2x_options_manager/__manifest__.py index 704d34411..f1b5982d4 100644 --- a/web_m2x_options_manager/__manifest__.py +++ b/web_m2x_options_manager/__manifest__.py @@ -6,7 +6,7 @@ "summary": 'Adds an interface to manage the "Create" and' ' "Create and Edit" options for specific models and' " fields.", - "version": "17.0.1.0.0", + "version": "18.0.1.0.0", "author": "Camptocamp, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Web", diff --git a/web_m2x_options_manager/demo/res_partner_demo_view.xml b/web_m2x_options_manager/demo/res_partner_demo_view.xml index 8a53c630c..6e0b82bdf 100644 --- a/web_m2x_options_manager/demo/res_partner_demo_view.xml +++ b/web_m2x_options_manager/demo/res_partner_demo_view.xml @@ -1,6 +1,5 @@ - res.partner.demo.form.view res.partner @@ -15,15 +14,14 @@ - - + + - + - diff --git a/web_m2x_options_manager/models/m2x_create_edit_option.py b/web_m2x_options_manager/models/m2x_create_edit_option.py index 4b55f3654..7adb8b7c7 100644 --- a/web_m2x_options_manager/models/m2x_create_edit_option.py +++ b/web_m2x_options_manager/models/m2x_create_edit_option.py @@ -1,7 +1,7 @@ # Copyright 2021 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import _, api, fields, models +from odoo import api, fields, models from odoo.exceptions import ValidationError from odoo.tools.cache import ormcache from odoo.tools.safe_eval import safe_eval @@ -123,7 +123,7 @@ class M2xCreateEditOption(models.Model): def _check_field_in_model(self): for opt in self: if opt.field_id.model_id != opt.model_id: - msg = _( + msg = self.env._( "'%(field_name)s' is not a valid field for model '%(model_name)s'!", field_name=opt.field_name, model_name=opt.model_name, @@ -134,7 +134,7 @@ class M2xCreateEditOption(models.Model): def _check_field_type(self): ttypes = ("many2many", "many2one") if any(o.field_id.ttype not in ttypes for o in self): - msg = _("Only Many2many and Many2one fields can be chosen!") + msg = self.env._("Only Many2many and Many2one fields can be chosen!") raise ValidationError(msg) def _apply_options(self, node): @@ -145,14 +145,14 @@ class M2xCreateEditOption(models.Model): options = safe_eval(options, dict(self.env.context or [])) or {} for k in ("create", "create_edit"): - opt = self["option_%s" % k] + opt = self[f"option_{k}"] if opt == "none": continue mode, val = opt.split("_") if k not in options: options[k] = val == "true" if mode == "force": - options["no_%s" % k] = val == "false" + options[f"no_{k}"] = val == "false" if not self.option_create_edit_wizard: options["no_quick_create"] = True node.set("options", str(options)) diff --git a/web_m2x_options_manager/readme/CREDITS.md b/web_m2x_options_manager/readme/CREDITS.md new file mode 100644 index 000000000..e2327d929 --- /dev/null +++ b/web_m2x_options_manager/readme/CREDITS.md @@ -0,0 +1 @@ +The migration of this module from 17.0 to 18.0 was financially supported by Camptocamp diff --git a/web_m2x_options_manager/static/description/index.html b/web_m2x_options_manager/static/description/index.html index 2fd618dac..d8d5e1c00 100644 --- a/web_m2x_options_manager/static/description/index.html +++ b/web_m2x_options_manager/static/description/index.html @@ -380,7 +380,8 @@ Many2one and Many2many fields directly from the ir.model form view.

  • Credits
  • @@ -420,8 +421,13 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • Chau Le <chaulb@trobz.com>
  • +
    +

    Other credits

    +

    The migration of this module from 17.0 to 18.0 was financially supported +by Camptocamp

    +