parent
b5f53e2cc9
commit
6f089afa35
|
@ -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).
|
||||
|
||||
{
|
||||
|
@ -8,8 +8,8 @@
|
|||
"author": "Onestein,Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"website": "https://github.com/OCA/reporting-engine",
|
||||
"category": "Reporting",
|
||||
"version": "13.0.1.0.0",
|
||||
"category": "Productivity",
|
||||
"version": "14.0.1.0.0",
|
||||
"development_status": "Beta",
|
||||
"depends": ["web"],
|
||||
"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).
|
||||
|
||||
import base64
|
||||
|
@ -320,7 +320,11 @@ class BveView(models.Model):
|
|||
try:
|
||||
with self.env.cr.savepoint():
|
||||
self.env.cr.execute(
|
||||
"CREATE or REPLACE VIEW %s as (%s)", (AsIs(view_name), AsIs(query),)
|
||||
"CREATE or REPLACE VIEW %s as (%s)",
|
||||
(
|
||||
AsIs(view_name),
|
||||
AsIs(query),
|
||||
),
|
||||
)
|
||||
except Exception as e:
|
||||
raise UserError(
|
||||
|
@ -541,7 +545,7 @@ class BveView(models.Model):
|
|||
self.env["ir.model"].sudo().search([("model", "=", self.model_name)])
|
||||
)
|
||||
if models_to_delete:
|
||||
models_to_delete.unlink()
|
||||
models_to_delete.with_context(_force_unlink=True).unlink()
|
||||
|
||||
table_name = self.model_name.replace(".", "_")
|
||||
tools.drop_view_if_exists(self.env.cr, table_name)
|
||||
|
|
|
@ -44,11 +44,12 @@ class BveViewLine(models.Model):
|
|||
@api.constrains("row", "column", "measure")
|
||||
def _constrains_options_check(self):
|
||||
measure_types = ["float", "integer", "monetary"]
|
||||
lines = self.filtered(lambda l: l.join_model_id or l.ttype in measure_types)
|
||||
if lines.filtered(lambda l: l.row or l.column):
|
||||
for line in self.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.")
|
||||
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.")
|
||||
raise ValidationError(err_msg)
|
||||
|
||||
|
@ -56,8 +57,16 @@ class BveViewLine(models.Model):
|
|||
def _constrains_unique_fields_check(self):
|
||||
seen = set()
|
||||
for line in self.mapped("bve_view_id.field_ids"):
|
||||
if (line.table_alias, line.field_id.id,) not in seen:
|
||||
seen.add((line.table_alias, line.field_id.id,))
|
||||
if (
|
||||
line.table_alias,
|
||||
line.field_id.id,
|
||||
) not in seen:
|
||||
seen.add(
|
||||
(
|
||||
line.table_alias,
|
||||
line.field_id.id,
|
||||
)
|
||||
)
|
||||
else:
|
||||
raise ValidationError(
|
||||
_("Field %s/%s is duplicated.\n" "Please remove the duplications.")
|
||||
|
|
|
@ -85,7 +85,11 @@ class IrModel(models.Model):
|
|||
for field in fields:
|
||||
for table_alias in model_table_map[field.model_id.id]:
|
||||
model_list.append(
|
||||
dict(dict_for_field(field), table_alias=table_alias, join_node=-1,)
|
||||
dict(
|
||||
dict_for_field(field),
|
||||
table_alias=table_alias,
|
||||
join_node=-1,
|
||||
)
|
||||
)
|
||||
return model_list
|
||||
|
||||
|
@ -133,8 +137,7 @@ class IrModel(models.Model):
|
|||
|
||||
@api.model
|
||||
def get_models(self, table_model_map=None):
|
||||
""" Return list of model dicts for all available models.
|
||||
"""
|
||||
"""Return list of model dicts for all available models."""
|
||||
self = self.with_context(lang=self.env.user.lang)
|
||||
model_table_map = defaultdict(list)
|
||||
for k, v in (table_model_map or {}).items():
|
||||
|
|
|
@ -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).
|
||||
|
||||
import logging
|
||||
|
@ -37,13 +37,6 @@ models.BaseModel._auto_init = _auto_init
|
|||
class Base(models.AbstractModel):
|
||||
_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
|
||||
def _read_group_process_groupby(self, gb, query):
|
||||
if not _bi_view(self._name):
|
||||
|
@ -53,9 +46,3 @@ class Base(models.AbstractModel):
|
|||
if split[0] not in self._fields:
|
||||
raise UserError(_("No data to be displayed."))
|
||||
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()
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<field name="name">bve_view read access</field>
|
||||
<field name="model_id" search="[('model','=','bve.view')]" model="ir.model" />
|
||||
<field name="global" eval="True" />
|
||||
<field
|
||||
name="domain_force"
|
||||
> ['|',('user_ids','=',False),('user_ids','in',user.id)]</field>
|
||||
<field name="domain_force">
|
||||
['|',('user_ids','=',False),('user_ids','in',user.id)]
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
|
@ -126,9 +126,7 @@ odoo.define("bi_view_editor.FieldList", function(require) {
|
|||
return $.makeArray(
|
||||
this.$el.find("tbody tr").map(function () {
|
||||
var field = $(this).data("field");
|
||||
field.description = $(this)
|
||||
.find('input[name="description"]')
|
||||
.val();
|
||||
field.description = $(this).find('input[name="description"]').val();
|
||||
return field;
|
||||
})
|
||||
);
|
||||
|
|
|
@ -122,9 +122,7 @@ odoo.define("bi_view_editor.ModelList", function(require) {
|
|||
return;
|
||||
}
|
||||
var model = $el.data("model");
|
||||
$el.parent()
|
||||
.find(".field")
|
||||
.remove();
|
||||
$el.parent().find(".field").remove();
|
||||
if (this.isActive(model.id)) {
|
||||
this.removeAsActive(model.id);
|
||||
} else {
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
<div class="oe_form_field_bi_editor">
|
||||
<div class="body">
|
||||
<div class="left">
|
||||
|
||||
</div>
|
||||
<div class="right">
|
||||
|
||||
|
@ -13,9 +14,10 @@
|
|||
<div class="footer">
|
||||
<div class="left" />
|
||||
<div class="right">
|
||||
<button class="clear-btn d-none"><span
|
||||
class="fa fa-eraser"
|
||||
/> Clear</button>
|
||||
<button class="clear-btn d-none">
|
||||
<span class="fa fa-eraser" />
|
||||
Clear
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -76,6 +78,7 @@
|
|||
<input type="text" class="search-bar" />
|
||||
</div>
|
||||
<div class="class-list">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
|
@ -106,6 +109,7 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -165,7 +169,8 @@
|
|||
type="checkbox"
|
||||
data-for="join_left"
|
||||
class="checkbox-join-left"
|
||||
/> Join Left
|
||||
/>
|
||||
Join Left
|
||||
</label>
|
||||
</div>
|
||||
</li>
|
||||
|
|
|
@ -354,7 +354,7 @@ class TestBiViewEditor(TransactionCase):
|
|||
uninstall_hook(self.cr, self.env)
|
||||
|
||||
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.update({"name": "Test View1"})
|
||||
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).
|
||||
|
||||
from odoo import api, models
|
||||
|
|
Loading…
Reference in New Issue