[MIG] bi_view_editor: Migration to 15.0
parent
2a8c2e8514
commit
c7fbaa4db2
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -393,7 +393,7 @@ class BveView(models.Model):
|
|||
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:
|
||||
|
|
|
@ -69,7 +69,9 @@ class IrModel(models.Model):
|
|||
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):
|
||||
|
|
|
@ -6,3 +6,4 @@
|
|||
* Andrea Stirpe <a.stirpe@onestein.nl>
|
||||
* Antonio Esposito <a.esposito@onestein.nl>
|
||||
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
|
||||
* Italo LOPES <italo.lopes@camptocamp.com>
|
||||
|
|
|
@ -42,11 +42,11 @@
|
|||
>
|
||||
Use the field
|
||||
<b>
|
||||
<t t-esc="choice.model_name" />
|
||||
<t t-out="choice.model_name" />
|
||||
</b>
|
||||
<i class="fa fa-caret-right" />
|
||||
<b>
|
||||
<t t-esc="choice.description" />
|
||||
<t t-out="choice.description" />
|
||||
</b>
|
||||
<span class="badge">new</span>
|
||||
</li>
|
||||
|
@ -58,11 +58,11 @@
|
|||
>
|
||||
Use the field
|
||||
<b>
|
||||
<t t-esc="choice.model_name" />
|
||||
<t t-out="choice.model_name" />
|
||||
</b>
|
||||
<i class="fa fa-caret-right" />
|
||||
<b>
|
||||
<t t-esc="choice.description" />
|
||||
<t t-out="choice.description" />
|
||||
</b>
|
||||
</li>
|
||||
</t>
|
||||
|
@ -86,14 +86,14 @@
|
|||
<t t-name="bi_view_editor.ModelListItem">
|
||||
<div class="class-container">
|
||||
<div class="class" t-attf-title="#{model}" t-attf-data-id="#{id}">
|
||||
<t t-esc="name" />
|
||||
<t t-out="name" />
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<!-- ModelListFieldItem-->
|
||||
<t t-name="bi_view_editor.ModelListFieldItem">
|
||||
<div class="field" t-attf-title="#{name}" t-attf-data-id="#{name}">
|
||||
<t t-esc="description" />
|
||||
<t t-out="description" />
|
||||
</div>
|
||||
</t>
|
||||
<!-- FieldList -->
|
||||
|
@ -190,7 +190,7 @@
|
|||
/>
|
||||
</td>
|
||||
<td>
|
||||
<t t-esc="field.model_name" />
|
||||
<t t-out="field.model_name" />
|
||||
</td>
|
||||
<td>
|
||||
<span
|
||||
|
@ -233,20 +233,20 @@
|
|||
/>
|
||||
<t t-if="field.join_node > field.table_alias">
|
||||
<b>
|
||||
<t t-esc="field.model_name" />
|
||||
<t t-out="field.model_name" />
|
||||
</b>
|
||||
<i class="fa fa-caret-right" />
|
||||
<small>
|
||||
<t t-esc="field.description" />
|
||||
<t t-out="field.description" />
|
||||
</small>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<small>
|
||||
<t t-esc="field.description" />
|
||||
<t t-out="field.description" />
|
||||
</small>
|
||||
<i class="fa fa-caret-left" />
|
||||
<b>
|
||||
<t t-esc="field.model_name" />
|
||||
<t t-out="field.model_name" />
|
||||
</b>
|
||||
</t>
|
||||
<span
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<template
|
||||
id="assets_backend"
|
||||
name="bi_view_editor assets"
|
||||
inherit_id="web.assets_backend"
|
||||
>
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet" href="/bi_view_editor/static/src/css/bve.css" />
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/bi_view_editor/static/src/js/bi_view_editor.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/bi_view_editor/static/src/js/bi_view_editor.JoinNodeDialog.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/bi_view_editor/static/src/js/bi_view_editor.ModelList.js"
|
||||
/>
|
||||
<script
|
||||
type="text/javascript"
|
||||
src="/bi_view_editor/static/src/js/bi_view_editor.FieldList.js"
|
||||
/>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
|
@ -15,13 +15,15 @@ class TestBiViewEditor(TransactionCase):
|
|||
def setUp(self):
|
||||
def _get_models(model_name_list):
|
||||
return (
|
||||
self.env["ir.model"].search([("model", "=", name)])
|
||||
self.env["ir.model"].sudo().search([("model", "=", name)])
|
||||
for name in model_name_list
|
||||
)
|
||||
|
||||
def _get_fields(model_field_list):
|
||||
return (
|
||||
self.env["ir.model.fields"].search(
|
||||
self.env["ir.model.fields"]
|
||||
.sudo()
|
||||
.search(
|
||||
[("model", "=", model_field[0]), ("name", "=", model_field[1])],
|
||||
limit=1,
|
||||
)
|
||||
|
@ -117,8 +119,10 @@ class TestBiViewEditor(TransactionCase):
|
|||
self.assertGreater(len(fields), 0)
|
||||
|
||||
def test_02_get_join_nodes(self):
|
||||
field_res_users = self.env["ir.model.fields"].search(
|
||||
[("name", "=", "login"), ("model", "=", "res.users")], limit=1
|
||||
field_res_users = (
|
||||
self.env["ir.model.fields"]
|
||||
.sudo()
|
||||
.search([("name", "=", "login"), ("model", "=", "res.users")], limit=1)
|
||||
)
|
||||
field_data = [
|
||||
{
|
||||
|
@ -223,8 +227,10 @@ class TestBiViewEditor(TransactionCase):
|
|||
|
||||
# create bve object
|
||||
bi_view.action_create()
|
||||
model = self.env["ir.model"].search(
|
||||
[("model", "=", "x_bve.testview4"), ("name", "=", "Test View4")]
|
||||
model = (
|
||||
self.env["ir.model"]
|
||||
.sudo()
|
||||
.search([("model", "=", "x_bve.testview4"), ("name", "=", "Test View4")])
|
||||
)
|
||||
self.assertEqual(len(model), 1)
|
||||
|
||||
|
@ -367,12 +373,16 @@ class TestBiViewEditor(TransactionCase):
|
|||
|
||||
@odoo.tests.tagged("post_install", "-at_install")
|
||||
def test_19_field_selection(self):
|
||||
field = self.env["ir.model.fields"].search(
|
||||
[
|
||||
("model", "=", self.company_model_name),
|
||||
("name", "=", "base_onboarding_company_state"),
|
||||
],
|
||||
limit=1,
|
||||
field = (
|
||||
self.env["ir.model.fields"]
|
||||
.sudo()
|
||||
.search(
|
||||
[
|
||||
("model", "=", self.company_model_name),
|
||||
("name", "=", "base_onboarding_company_state"),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
)
|
||||
selection_data = [
|
||||
{
|
||||
|
|
|
@ -19,9 +19,10 @@ class WizardModelMenuCreate(models.TransientModel):
|
|||
"action": "ir.actions.act_window,%d" % (bve_view.action_id,),
|
||||
}
|
||||
)
|
||||
self.env["ir.model.data"].create(
|
||||
self.env["ir.model.data"].sudo().create(
|
||||
{
|
||||
"name": bve_view.name + ",id=" + str(menu.id),
|
||||
"name": bve_view.name
|
||||
and str(bve_view.name).replace(" ", "") + ",id=" + str(menu.id),
|
||||
"noupdate": True,
|
||||
"module": "bi_view_editor",
|
||||
"model": "ir.ui.menu",
|
||||
|
|
Loading…
Reference in New Issue