Add support for plugins and add translate view as example

issue7942
review54461002
This commit is contained in:
Cédric Krier committed 2019-01-18 10:23:13 +01:00
1 parent 1b2e479538
commit 9b07e6a7bc
5 files changed
+95 -7

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
/* This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. */
(function() {
'use strict';
var Translate = {};
Translate.translate_view = function(data) {
var model = data.model;
Sao.Tab.create({
model: 'ir.translation',
domain: [['model', '=', model]],
mode: ['tree', 'form'],
name: Sao.i18n.gettext('Translate view'),
});
};
Translate.get_plugins = function(model) {
var access = Sao.common.MODELACCESS.get(model);
if (access.create && access.write) {
return [
[Sao.i18n.gettext('Translate view'), Translate.translate_view],
];
} else {
return [];
}
};
Sao.Plugins.push(Translate);
}());