Browse Source
[MIG+IMP] bi_view_editor: Migration to v10 + enhancements
[MIG+IMP] bi_view_editor: Migration to v10 + enhancements
* Add menu items creation feature * Added selection of fields of a tree view * Improved usability and strings made translatable * Avoid display duplicated nodes * Robustness * Updated Dutch translation * Avoid possible sql injection in bi_view_editor * Removed deprecated RegistryManagerpull/202/head
Andrea
8 years ago
committed by
Pedro M. Baeza
81 changed files with 662 additions and 468 deletions
-
8bi_view_editor/README.rst
-
1bi_view_editor/__init__.py
-
7bi_view_editor/__manifest__.py
-
2bi_view_editor/i18n/am.po
-
2bi_view_editor/i18n/ar.po
-
2bi_view_editor/i18n/bg.po
-
2bi_view_editor/i18n/bs.po
-
2bi_view_editor/i18n/ca.po
-
2bi_view_editor/i18n/cs.po
-
2bi_view_editor/i18n/da.po
-
2bi_view_editor/i18n/de.po
-
2bi_view_editor/i18n/el_GR.po
-
2bi_view_editor/i18n/en_GB.po
-
2bi_view_editor/i18n/es.po
-
2bi_view_editor/i18n/es_AR.po
-
2bi_view_editor/i18n/es_CL.po
-
2bi_view_editor/i18n/es_CO.po
-
2bi_view_editor/i18n/es_CR.po
-
2bi_view_editor/i18n/es_DO.po
-
2bi_view_editor/i18n/es_EC.po
-
2bi_view_editor/i18n/es_ES.po
-
2bi_view_editor/i18n/es_MX.po
-
2bi_view_editor/i18n/es_PE.po
-
2bi_view_editor/i18n/es_PY.po
-
2bi_view_editor/i18n/es_VE.po
-
2bi_view_editor/i18n/et.po
-
2bi_view_editor/i18n/eu.po
-
2bi_view_editor/i18n/fa.po
-
2bi_view_editor/i18n/fi.po
-
2bi_view_editor/i18n/fr.po
-
2bi_view_editor/i18n/fr_CA.po
-
2bi_view_editor/i18n/fr_CH.po
-
2bi_view_editor/i18n/gl.po
-
2bi_view_editor/i18n/gl_ES.po
-
2bi_view_editor/i18n/he.po
-
2bi_view_editor/i18n/hr.po
-
2bi_view_editor/i18n/hr_HR.po
-
2bi_view_editor/i18n/hu.po
-
2bi_view_editor/i18n/id.po
-
2bi_view_editor/i18n/it.po
-
2bi_view_editor/i18n/ja.po
-
2bi_view_editor/i18n/ko.po
-
2bi_view_editor/i18n/lt.po
-
2bi_view_editor/i18n/lt_LT.po
-
2bi_view_editor/i18n/lv.po
-
2bi_view_editor/i18n/mk.po
-
2bi_view_editor/i18n/mn.po
-
2bi_view_editor/i18n/nb.po
-
2bi_view_editor/i18n/nb_NO.po
-
64bi_view_editor/i18n/nl.po
-
2bi_view_editor/i18n/nl_BE.po
-
2bi_view_editor/i18n/pl.po
-
2bi_view_editor/i18n/pt.po
-
2bi_view_editor/i18n/pt_BR.po
-
2bi_view_editor/i18n/pt_PT.po
-
2bi_view_editor/i18n/ro.po
-
2bi_view_editor/i18n/ru.po
-
2bi_view_editor/i18n/sk.po
-
2bi_view_editor/i18n/sl.po
-
2bi_view_editor/i18n/sr.po
-
2bi_view_editor/i18n/sr@latin.po
-
2bi_view_editor/i18n/sv.po
-
2bi_view_editor/i18n/th.po
-
2bi_view_editor/i18n/tr.po
-
2bi_view_editor/i18n/tr_TR.po
-
2bi_view_editor/i18n/uk.po
-
2bi_view_editor/i18n/vi.po
-
2bi_view_editor/i18n/vi_VN.po
-
2bi_view_editor/i18n/zh_CN.po
-
2bi_view_editor/i18n/zh_TW.po
-
1bi_view_editor/models/__init__.py
-
346bi_view_editor/models/bve_view.py
-
189bi_view_editor/models/ir_model.py
-
61bi_view_editor/models/models.py
-
1bi_view_editor/security/ir.model.access.csv
-
164bi_view_editor/static/src/js/bve.js
-
2bi_view_editor/templates/qweb_template.xml
-
7bi_view_editor/tests/test_bi_view.py
-
1bi_view_editor/views/bve_view.xml
-
5bi_view_editor/wizard/__init__.py
-
39bi_view_editor/wizard/wizard_ir_model_menu_create.py
@ -0,0 +1,61 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2017 Onestein (<http://www.onestein.eu>) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from odoo import api, models |
|||
from odoo.exceptions import UserError |
|||
from odoo.tools.translate import _ |
|||
|
|||
|
|||
class Base(models.AbstractModel): |
|||
_inherit = 'base' |
|||
|
|||
@api.model |
|||
def _bi_view(self): |
|||
return self._name[0:6] == 'x_bve.' |
|||
|
|||
@api.model |
|||
def _auto_end(self): |
|||
if not self._bi_view(): |
|||
super(Base, self)._auto_end() |
|||
|
|||
@api.model |
|||
def _auto_init(self): |
|||
if not self._bi_view(): |
|||
super(Base, self)._auto_init() |
|||
|
|||
@api.model |
|||
def _setup_complete(self): |
|||
if not self._bi_view(): |
|||
super(Base, self)._setup_complete() |
|||
else: |
|||
self.pool.models[self._name]._log_access = False |
|||
|
|||
@api.model |
|||
def _read_group_process_groupby(self, gb, query): |
|||
if not self._bi_view(): |
|||
return super(Base, self)._read_group_process_groupby(gb, query) |
|||
|
|||
split = gb.split(':') |
|||
if split[0] not in self._fields: |
|||
raise UserError( |
|||
_('No data to be displayed.')) |
|||
return super(Base, self)._read_group_process_groupby(gb, query) |
|||
|
|||
@api.model |
|||
def _add_magic_fields(self): |
|||
if self._bi_view(): |
|||
self._log_access = False |
|||
return super(Base, self)._add_magic_fields() |
|||
|
|||
@api.model_cr |
|||
def _table_exist(self): |
|||
if not self._bi_view(): |
|||
return super(Base, self)._table_exist() |
|||
return 1 |
|||
|
|||
# @api.model_cr |
|||
# def _create_table(self): |
|||
# if not self._bi_view(): |
|||
# return super(Base, self)._create_table() |
|||
# return 1 |
@ -1,3 +1,2 @@ |
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
|||
access_bve_view_everyone,bve.view,bi_view_editor.model_bve_view,,1,1,1,1 |
|||
access_bve_view_technical_settings,bve.view,bi_view_editor.model_bve_view,base.group_no_one,1,1,1,1 |
@ -0,0 +1,5 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2017 Onestein (<http://www.onestein.eu>) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from . import wizard_ir_model_menu_create |
@ -0,0 +1,39 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# Copyright 2017 Onestein (<http://www.onestein.eu>) |
|||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|||
|
|||
from odoo import api, models |
|||
|
|||
|
|||
class WizardModelMenuCreate(models.TransientModel): |
|||
_inherit = 'wizard.ir.model.menu.create' |
|||
|
|||
@api.multi |
|||
def menu_create(self): |
|||
if self._context.get('active_model') == 'bve.view': |
|||
self.ensure_one() |
|||
active_id = self._context.get('active_id') |
|||
bve_view = self.env['bve.view'].browse(active_id) |
|||
menu = self.env['ir.ui.menu'].create({ |
|||
'name': self.name, |
|||
'parent_id': self.menu_id.id, |
|||
'action': 'ir.actions.act_window,%d' % (bve_view.action_id,) |
|||
}) |
|||
self.env['ir.model.data'].create({ |
|||
'name': bve_view.name + ', id=' + str(menu.id), |
|||
'noupdate': True, |
|||
'module': 'bi_view_editor', |
|||
'model': 'ir.ui.menu', |
|||
'res_id': menu.id, |
|||
}) |
|||
return {'type': 'ir.actions.client', 'tag': 'reload'} |
|||
return super(WizardModelMenuCreate, self).menu_create() |
|||
|
|||
@api.model |
|||
def default_get(self, fields_list): |
|||
defaults = super(WizardModelMenuCreate, self).default_get(fields_list) |
|||
if self._context.get('active_model') == 'bve.view': |
|||
active_id = self._context.get('active_id') |
|||
bve_view = self.env['bve.view'].browse(active_id) |
|||
defaults.setdefault('name', bve_view.name) |
|||
return defaults |
Write
Preview
Loading…
Cancel
Save
Reference in new issue