From fba0ff5092206a0856c109677620683aad78b41d Mon Sep 17 00:00:00 2001 From: ilo Date: Wed, 8 Mar 2023 11:22:45 -0300 Subject: [PATCH] [MIG] bi_view_editor: Migration to 15.0 --- bi_view_editor/__manifest__.py | 14 ++++++-- bi_view_editor/models/bve_view.py | 2 +- bi_view_editor/models/ir_model.py | 4 ++- bi_view_editor/readme/CONTRIBUTORS.rst | 1 + .../static/src/xml/bi_view_editor.xml | 22 ++++++------ bi_view_editor/templates/assets_template.xml | 28 --------------- bi_view_editor/tests/test_bi_view.py | 34 ++++++++++++------- .../wizard/wizard_ir_model_menu_create.py | 2 +- 8 files changed, 51 insertions(+), 56 deletions(-) delete mode 100644 bi_view_editor/templates/assets_template.xml diff --git a/bi_view_editor/__manifest__.py b/bi_view_editor/__manifest__.py index d30045a1c5..dd4ecf602b 100644 --- a/bi_view_editor/__manifest__.py +++ b/bi_view_editor/__manifest__.py @@ -18,10 +18,20 @@ "data": [ "security/ir.model.access.csv", "security/rules.xml", - "templates/assets_template.xml", "views/bve_view.xml", ], - "qweb": ["static/src/xml/bi_view_editor.xml"], + "assets": { + "web.assets_backend": [ + "bi_view_editor/static/src/css/bve.css", + "bi_view_editor/static/src/js/bi_view_editor.js", + "bi_view_editor/static/src/js/bi_view_editor.JoinNodeDialog.js", + "bi_view_editor/static/src/js/bi_view_editor.ModelList.js", + "bi_view_editor/static/src/js/bi_view_editor.FieldList.js", + ], + "web.assets_qweb": [ + "bi_view_editor/static/src/xml/bi_view_editor.xml", + ], + }, "uninstall_hook": "uninstall_hook", "installable": True, } diff --git a/bi_view_editor/models/bve_view.py b/bi_view_editor/models/bve_view.py index 5e08777878..6392a97395 100644 --- a/bi_view_editor/models/bve_view.py +++ b/bi_view_editor/models/bve_view.py @@ -393,7 +393,7 @@ def action_translations(self): if self.state != "created": return self = self.sudo() - model = self.env["ir.model"].search([("model", "=", self.model_name)]) + model = self.env["ir.model"].sudo().search([("model", "=", self.model_name)]) IrTranslation = self.env["ir.translation"] IrTranslation.translate_fields("ir.model", model.id) for field in model.field_id: diff --git a/bi_view_editor/models/ir_model.py b/bi_view_editor/models/ir_model.py index 8feeaf4adc..16b501c64b 100644 --- a/bi_view_editor/models/ir_model.py +++ b/bi_view_editor/models/ir_model.py @@ -69,7 +69,9 @@ def _check_unknown(model_name): count_check += _check_contains(model_model) count_check += _check_unknown(model_name) if not count_check: - return self.env["ir.model.access"].check(model["model"], "read", False) + return ( + self.env["ir.model.access"].sudo().check(model["model"], "read", False) + ) return False def get_model_list(self, model_table_map): diff --git a/bi_view_editor/readme/CONTRIBUTORS.rst b/bi_view_editor/readme/CONTRIBUTORS.rst index 14cc58d68b..92632b85a4 100644 --- a/bi_view_editor/readme/CONTRIBUTORS.rst +++ b/bi_view_editor/readme/CONTRIBUTORS.rst @@ -6,3 +6,4 @@ * Andrea Stirpe * Antonio Esposito * Jordi Ballester Alomar +* Italo LOPES diff --git a/bi_view_editor/static/src/xml/bi_view_editor.xml b/bi_view_editor/static/src/xml/bi_view_editor.xml index 569d834e66..c69828e554 100644 --- a/bi_view_editor/static/src/xml/bi_view_editor.xml +++ b/bi_view_editor/static/src/xml/bi_view_editor.xml @@ -42,11 +42,11 @@ > Use the field - + - + new @@ -58,11 +58,11 @@ > Use the field - + - + @@ -86,14 +86,14 @@
- +
- +
@@ -190,7 +190,7 @@ /> - + - + - + - + - + - -