Olivier Jossen
6 years ago
75 changed files with 1797 additions and 1788 deletions
-
8base_export_manager/README.rst
-
6base_export_manager/__manifest__.py
-
54base_export_manager/i18n/ar.po
-
46base_export_manager/i18n/base_export_manager.pot
-
54base_export_manager/i18n/bg.po
-
54base_export_manager/i18n/bs.po
-
54base_export_manager/i18n/ca.po
-
54base_export_manager/i18n/cs.po
-
50base_export_manager/i18n/da.po
-
54base_export_manager/i18n/de.po
-
54base_export_manager/i18n/el_GR.po
-
54base_export_manager/i18n/en_GB.po
-
54base_export_manager/i18n/es.po
-
54base_export_manager/i18n/es_AR.po
-
54base_export_manager/i18n/es_CL.po
-
54base_export_manager/i18n/es_CO.po
-
54base_export_manager/i18n/es_CR.po
-
54base_export_manager/i18n/es_DO.po
-
54base_export_manager/i18n/es_EC.po
-
54base_export_manager/i18n/es_ES.po
-
54base_export_manager/i18n/es_MX.po
-
54base_export_manager/i18n/es_PE.po
-
54base_export_manager/i18n/es_PY.po
-
54base_export_manager/i18n/es_VE.po
-
54base_export_manager/i18n/et.po
-
54base_export_manager/i18n/eu.po
-
54base_export_manager/i18n/fa.po
-
54base_export_manager/i18n/fi.po
-
54base_export_manager/i18n/fr.po
-
48base_export_manager/i18n/fr_CA.po
-
54base_export_manager/i18n/fr_CH.po
-
54base_export_manager/i18n/fr_FR.po
-
54base_export_manager/i18n/gl.po
-
54base_export_manager/i18n/he.po
-
50base_export_manager/i18n/hr.po
-
48base_export_manager/i18n/hr_HR.po
-
54base_export_manager/i18n/hu.po
-
54base_export_manager/i18n/id.po
-
50base_export_manager/i18n/it.po
-
54base_export_manager/i18n/ja.po
-
54base_export_manager/i18n/ko.po
-
54base_export_manager/i18n/lt.po
-
54base_export_manager/i18n/lv.po
-
54base_export_manager/i18n/mk.po
-
54base_export_manager/i18n/mn.po
-
54base_export_manager/i18n/nb.po
-
54base_export_manager/i18n/nl.po
-
54base_export_manager/i18n/nl_BE.po
-
50base_export_manager/i18n/nl_NL.po
-
54base_export_manager/i18n/pl.po
-
54base_export_manager/i18n/pt.po
-
54base_export_manager/i18n/pt_BR.po
-
54base_export_manager/i18n/pt_PT.po
-
54base_export_manager/i18n/ro.po
-
54base_export_manager/i18n/ru.po
-
54base_export_manager/i18n/sk.po
-
54base_export_manager/i18n/sl.po
-
54base_export_manager/i18n/sr.po
-
54base_export_manager/i18n/sr@latin.po
-
54base_export_manager/i18n/sv.po
-
54base_export_manager/i18n/th.po
-
54base_export_manager/i18n/tr.po
-
54base_export_manager/i18n/tr_TR.po
-
54base_export_manager/i18n/uk.po
-
54base_export_manager/i18n/vi.po
-
54base_export_manager/i18n/zh_CN.po
-
54base_export_manager/i18n/zh_TW.po
-
1base_export_manager/models/__init__.py
-
21base_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
-
48base_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_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).
|
|||
*/ |
|||
|
|||
odoo.define('base_export_manager.base_export_manager', function(require) { |
|||
'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; |
|||
|
|||
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); |
|||
} |
|||
}); |
|||
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 |
|||
}, |
|||
])); |
|||
} |
|||
}); |
|||
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")}); |
|||
} |
|||
this._super(sectionCode, _items); |
|||
}, |
|||
}); |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue