Olivier Jossen
6 years ago
75 changed files with 1797 additions and 1788 deletions
-
8base_export_manager/README.rst
-
6base_export_manager/__manifest__.py
-
52base_export_manager/i18n/ar.po
-
46base_export_manager/i18n/base_export_manager.pot
-
52base_export_manager/i18n/bg.po
-
52base_export_manager/i18n/bs.po
-
52base_export_manager/i18n/ca.po
-
52base_export_manager/i18n/cs.po
-
48base_export_manager/i18n/da.po
-
52base_export_manager/i18n/de.po
-
52base_export_manager/i18n/el_GR.po
-
52base_export_manager/i18n/en_GB.po
-
52base_export_manager/i18n/es.po
-
52base_export_manager/i18n/es_AR.po
-
52base_export_manager/i18n/es_CL.po
-
52base_export_manager/i18n/es_CO.po
-
52base_export_manager/i18n/es_CR.po
-
52base_export_manager/i18n/es_DO.po
-
52base_export_manager/i18n/es_EC.po
-
52base_export_manager/i18n/es_ES.po
-
52base_export_manager/i18n/es_MX.po
-
52base_export_manager/i18n/es_PE.po
-
52base_export_manager/i18n/es_PY.po
-
52base_export_manager/i18n/es_VE.po
-
52base_export_manager/i18n/et.po
-
52base_export_manager/i18n/eu.po
-
52base_export_manager/i18n/fa.po
-
52base_export_manager/i18n/fi.po
-
52base_export_manager/i18n/fr.po
-
46base_export_manager/i18n/fr_CA.po
-
52base_export_manager/i18n/fr_CH.po
-
52base_export_manager/i18n/fr_FR.po
-
52base_export_manager/i18n/gl.po
-
52base_export_manager/i18n/he.po
-
48base_export_manager/i18n/hr.po
-
46base_export_manager/i18n/hr_HR.po
-
52base_export_manager/i18n/hu.po
-
52base_export_manager/i18n/id.po
-
48base_export_manager/i18n/it.po
-
52base_export_manager/i18n/ja.po
-
52base_export_manager/i18n/ko.po
-
52base_export_manager/i18n/lt.po
-
52base_export_manager/i18n/lv.po
-
52base_export_manager/i18n/mk.po
-
52base_export_manager/i18n/mn.po
-
52base_export_manager/i18n/nb.po
-
52base_export_manager/i18n/nl.po
-
52base_export_manager/i18n/nl_BE.po
-
48base_export_manager/i18n/nl_NL.po
-
52base_export_manager/i18n/pl.po
-
52base_export_manager/i18n/pt.po
-
52base_export_manager/i18n/pt_BR.po
-
52base_export_manager/i18n/pt_PT.po
-
52base_export_manager/i18n/ro.po
-
52base_export_manager/i18n/ru.po
-
52base_export_manager/i18n/sk.po
-
52base_export_manager/i18n/sl.po
-
52base_export_manager/i18n/sr.po
-
52base_export_manager/i18n/sr@latin.po
-
52base_export_manager/i18n/sv.po
-
52base_export_manager/i18n/th.po
-
52base_export_manager/i18n/tr.po
-
52base_export_manager/i18n/tr_TR.po
-
52base_export_manager/i18n/uk.po
-
52base_export_manager/i18n/vi.po
-
52base_export_manager/i18n/zh_CN.po
-
52base_export_manager/i18n/zh_TW.po
-
1base_export_manager/models/__init__.py
-
13base_export_manager/models/ir_exports_line.py
-
18base_export_manager/models/ir_http.py
-
3base_export_manager/models/res_users.py
-
1base_export_manager/readme/CONTRIBUTORS.rst
-
2base_export_manager/static/description/index.html
-
46base_export_manager/static/src/js/base_export_manager.js
-
3base_export_manager/views/res_groups.xml
@ -1,2 +1,3 @@ |
|||||
from . import ir_exports, ir_exports_line |
from . import ir_exports, ir_exports_line |
||||
from . import ir_model_access, res_users |
from . import ir_model_access, res_users |
||||
|
from . import ir_http |
@ -0,0 +1,18 @@ |
|||||
|
# Copyright 2019 brain-tec AG - Olivier Jossen |
||||
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
||||
|
|
||||
|
from odoo import models |
||||
|
from odoo.http import request |
||||
|
|
||||
|
|
||||
|
class Http(models.AbstractModel): |
||||
|
_inherit = 'ir.http' |
||||
|
|
||||
|
def session_info(self): |
||||
|
res = super(Http, self).session_info() |
||||
|
user = request.env.user |
||||
|
export_models = user.fetch_export_models() |
||||
|
res.update({ |
||||
|
'export_models': export_models, |
||||
|
}) |
||||
|
return res |
@ -1,47 +1,23 @@ |
|||||
/* Copyright 2015 Antiun Ingenieria, SL (Madrid, Spain, http://www.antiun.com) |
|
||||
|
/* Copyright 2019 brain-tec AG (Brig, Switzerland, http://www.braintec-group.com) |
||||
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
* License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
*/ |
*/ |
||||
|
|
||||
odoo.define('base_export_manager.base_export_manager', function(require) { |
odoo.define('base_export_manager.base_export_manager', function(require) { |
||||
'use strict'; |
'use strict'; |
||||
|
|
||||
var core = require('web.core'); |
|
||||
var Model = require('web.DataModel'); |
|
||||
var ListView = require('web.ListView'); |
|
||||
var Sidebar = require('web.Sidebar'); |
|
||||
|
var core = require("web.core"); |
||||
|
var Sidebar = require("web.Sidebar"); |
||||
|
var session = require("web.session"); |
||||
var _t = core._t; |
var _t = core._t; |
||||
|
|
||||
ListView.include({ |
|
||||
/** |
|
||||
* Instantiate and render the sidebar. |
|
||||
* Sets this.sidebar |
|
||||
* @param {jQuery} [$node] a jQuery node where the sidebar should be inserted |
|
||||
* $node may be undefined, in which case the ListView inserts the sidebar in |
|
||||
* this.options.$sidebar or in a div of its template |
|
||||
**/ |
|
||||
render_sidebar: function($node) { |
|
||||
var self = this; |
|
||||
this._super($node); |
|
||||
var Users = new Model('res.users'); |
|
||||
Users.call('fetch_export_models', []).done(function(export_models){ |
|
||||
self.export_models = export_models; |
|
||||
self.render_export_enable = jQuery.inArray( self.model, self.export_models ); |
|
||||
if(self.sidebar && self.sidebar.items && self.sidebar.items.other){ |
|
||||
var items_data = []; |
|
||||
_.each(self.sidebar.items.other,function(rec){ |
|
||||
if(rec.label != _t("Export")){ |
|
||||
items_data.push(rec); |
|
||||
|
Sidebar.include({ |
||||
|
_addItems: function (sectionCode, items) { |
||||
|
var _items = items; |
||||
|
var render_export_enalble = jQuery.inArray( this.env.model, session.export_models) |
||||
|
if (!session.is_superuser && sectionCode === 'other' && items.length && render_export_enalble < 0) { |
||||
|
_items = _.reject(_items, {label:_t("Export")}); |
||||
} |
} |
||||
}); |
|
||||
self.sidebar.items.other = items_data; |
|
||||
self.sidebar.add_items('other', _.compact([ |
|
||||
self.render_export_enable >= 0 && { |
|
||||
label: _t("Export"), |
|
||||
callback: self.on_sidebar_export |
|
||||
}, |
|
||||
])); |
|
||||
} |
|
||||
}); |
|
||||
|
this._super(sectionCode, _items); |
||||
}, |
}, |
||||
}); |
}); |
||||
}); |
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue