[14.0][MIG] bi_view_editor
parent
fd47f75e72
commit
9e215198d9
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2015-2019 Onestein (<https://www.onestein.eu>)
|
# Copyright 2015-2020 Onestein (<https://www.onestein.eu>)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -8,8 +8,8 @@
|
||||||
"author": "Onestein,Odoo Community Association (OCA)",
|
"author": "Onestein,Odoo Community Association (OCA)",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"website": "https://github.com/OCA/reporting-engine",
|
"website": "https://github.com/OCA/reporting-engine",
|
||||||
"category": "Reporting",
|
"category": "Productivity",
|
||||||
"version": "13.0.1.0.0",
|
"version": "14.0.1.0.0",
|
||||||
"development_status": "Beta",
|
"development_status": "Beta",
|
||||||
"depends": ["web"],
|
"depends": ["web"],
|
||||||
"data": [
|
"data": [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2015-2019 Onestein (<https://www.onestein.eu>)
|
# Copyright 2015-2020 Onestein (<https://www.onestein.eu>)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
@ -541,7 +541,7 @@ class BveView(models.Model):
|
||||||
self.env["ir.model"].sudo().search([("model", "=", self.model_name)])
|
self.env["ir.model"].sudo().search([("model", "=", self.model_name)])
|
||||||
)
|
)
|
||||||
if models_to_delete:
|
if models_to_delete:
|
||||||
models_to_delete.unlink()
|
models_to_delete.with_context(_force_unlink=True).unlink()
|
||||||
|
|
||||||
table_name = self.model_name.replace(".", "_")
|
table_name = self.model_name.replace(".", "_")
|
||||||
tools.drop_view_if_exists(self.env.cr, table_name)
|
tools.drop_view_if_exists(self.env.cr, table_name)
|
||||||
|
|
|
@ -44,11 +44,12 @@ class BveViewLine(models.Model):
|
||||||
@api.constrains("row", "column", "measure")
|
@api.constrains("row", "column", "measure")
|
||||||
def _constrains_options_check(self):
|
def _constrains_options_check(self):
|
||||||
measure_types = ["float", "integer", "monetary"]
|
measure_types = ["float", "integer", "monetary"]
|
||||||
lines = self.filtered(lambda l: l.join_model_id or l.ttype in measure_types)
|
for line in self.filtered(lambda l: l.row or l.column):
|
||||||
if lines.filtered(lambda l: l.row or l.column):
|
if line.join_model_id or line.ttype in measure_types:
|
||||||
err_msg = _("This field cannot be a row or a column.")
|
err_msg = _("This field cannot be a row or a column.")
|
||||||
raise ValidationError(err_msg)
|
raise ValidationError(err_msg)
|
||||||
if lines.filtered(lambda l: l.measure):
|
for line in self.filtered(lambda l: l.measure):
|
||||||
|
if line.join_model_id or line.ttype not in measure_types:
|
||||||
err_msg = _("This field cannot be a measure.")
|
err_msg = _("This field cannot be a measure.")
|
||||||
raise ValidationError(err_msg)
|
raise ValidationError(err_msg)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2017-2019 Onestein (<https://www.onestein.eu>)
|
# Copyright 2017-2020 Onestein (<https://www.onestein.eu>)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
@ -37,13 +37,6 @@ models.BaseModel._auto_init = _auto_init
|
||||||
class Base(models.AbstractModel):
|
class Base(models.AbstractModel):
|
||||||
_inherit = "base"
|
_inherit = "base"
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _setup_complete(self):
|
|
||||||
if not _bi_view(self._name):
|
|
||||||
super()._setup_complete()
|
|
||||||
else:
|
|
||||||
self.pool.models[self._name]._log_access = False
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _read_group_process_groupby(self, gb, query):
|
def _read_group_process_groupby(self, gb, query):
|
||||||
if not _bi_view(self._name):
|
if not _bi_view(self._name):
|
||||||
|
@ -53,9 +46,3 @@ class Base(models.AbstractModel):
|
||||||
if split[0] not in self._fields:
|
if split[0] not in self._fields:
|
||||||
raise UserError(_("No data to be displayed."))
|
raise UserError(_("No data to be displayed."))
|
||||||
return super()._read_group_process_groupby(gb, query)
|
return super()._read_group_process_groupby(gb, query)
|
||||||
|
|
||||||
@api.model
|
|
||||||
def _add_magic_fields(self):
|
|
||||||
if _bi_view(self._name):
|
|
||||||
self._log_access = False
|
|
||||||
return super()._add_magic_fields()
|
|
||||||
|
|
|
@ -354,7 +354,7 @@ class TestBiViewEditor(TransactionCase):
|
||||||
uninstall_hook(self.cr, self.env)
|
uninstall_hook(self.cr, self.env)
|
||||||
|
|
||||||
def test_18_action_translations(self):
|
def test_18_action_translations(self):
|
||||||
self.env["res.lang"].load_lang("it_IT")
|
self.env["res.lang"]._activate_lang("it_IT")
|
||||||
vals = self.bi_view1_vals
|
vals = self.bi_view1_vals
|
||||||
vals.update({"name": "Test View1"})
|
vals.update({"name": "Test View1"})
|
||||||
bi_view1 = self.env["bve.view"].create(vals)
|
bi_view1 = self.env["bve.view"].create(vals)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright 2017-2019 Onestein (<https://www.onestein.eu>)
|
# Copyright 2017-2020 Onestein (<https://www.onestein.eu>)
|
||||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||||
|
|
||||||
from odoo import api, models
|
from odoo import api, models
|
||||||
|
@ -21,7 +21,7 @@ class WizardModelMenuCreate(models.TransientModel):
|
||||||
)
|
)
|
||||||
self.env["ir.model.data"].create(
|
self.env["ir.model.data"].create(
|
||||||
{
|
{
|
||||||
"name": bve_view.name + ", id=" + str(menu.id),
|
"name": bve_view.name + ",id=" + str(menu.id),
|
||||||
"noupdate": True,
|
"noupdate": True,
|
||||||
"module": "bi_view_editor",
|
"module": "bi_view_editor",
|
||||||
"model": "ir.ui.menu",
|
"model": "ir.ui.menu",
|
||||||
|
|
Loading…
Reference in New Issue