[MERGE]merge with main branch and small fixes.
bzr revid: vme@tinyerp.com-20111109064506-bf79v49lfxmtchcy
This commit is contained in:
commit
b7f95c291a
|
@ -53,4 +53,7 @@
|
|||
"static/src/css/data_export.css",
|
||||
"static/src/css/data_import.css",
|
||||
],
|
||||
'qweb' : [
|
||||
"static/src/xml/*.xml",
|
||||
],
|
||||
}
|
||||
|
|
|
@ -24,19 +24,51 @@ openerpweb = web.common.http
|
|||
# OpenERP Web web Controllers
|
||||
#----------------------------------------------------------
|
||||
|
||||
def concat_files(file_list):
|
||||
""" Concatenate file content
|
||||
|
||||
def concat_xml(file_list):
|
||||
"""Concatenate xml files
|
||||
return (concat,timestamp)
|
||||
concat: concatenation of file content
|
||||
timestamp: max(os.path.getmtime of file_list)
|
||||
"""
|
||||
root = None
|
||||
files_timestamp = 0
|
||||
for fname in file_list:
|
||||
ftime = os.path.getmtime(fname)
|
||||
if ftime > files_timestamp:
|
||||
files_timestamp = ftime
|
||||
|
||||
xml = ElementTree.parse(fname).getroot()
|
||||
|
||||
if root is None:
|
||||
root = ElementTree.Element(xml.tag)
|
||||
#elif root.tag != xml.tag:
|
||||
# raise ValueError("Root tags missmatch: %r != %r" % (root.tag, xml.tag))
|
||||
|
||||
for child in xml.getchildren():
|
||||
root.append(child)
|
||||
return ElementTree.tostring(root, 'utf-8'), files_timestamp
|
||||
|
||||
|
||||
def concat_files(file_list, reader=None):
|
||||
""" Concatenate file content
|
||||
return (concat,timestamp)
|
||||
concat: concatenation of file content, read by `reader`
|
||||
timestamp: max(os.path.getmtime of file_list)
|
||||
"""
|
||||
if reader is None:
|
||||
def reader(f):
|
||||
with open(f) as fp:
|
||||
return fp.read()
|
||||
|
||||
files_content = []
|
||||
files_timestamp = 0
|
||||
for fname in file_list:
|
||||
ftime = os.path.getmtime(fname)
|
||||
if ftime > files_timestamp:
|
||||
files_timestamp = ftime
|
||||
files_content.append(open(fname).read())
|
||||
|
||||
files_content.append(reader(fname))
|
||||
files_concat = "".join(files_content)
|
||||
return files_concat,files_timestamp
|
||||
|
||||
|
@ -98,10 +130,42 @@ class WebClient(openerpweb.Controller):
|
|||
def jslist(self, req, mods=None):
|
||||
return self.manifest_list(req, mods, 'js')
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def qweblist(self, req, mods=None):
|
||||
return self.manifest_list(req, mods, 'qweb')
|
||||
|
||||
@openerpweb.httprequest
|
||||
def css(self, req, mods=None):
|
||||
files = [f[0] for f in self.manifest_glob(req, mods, 'css')]
|
||||
content,timestamp = concat_files(files)
|
||||
|
||||
files = list(self.manifest_glob(req, mods, 'css'))
|
||||
file_map = dict(files)
|
||||
|
||||
rx_import = re.compile(r"""@import\s+('|")(?!'|"|/|https?://)""", re.U)
|
||||
rx_url = re.compile(r"""url\s*\(\s*('|"|)(?!'|"|/|https?://)""", re.U)
|
||||
|
||||
|
||||
def reader(f):
|
||||
"""read the a css file and absolutify all relative uris"""
|
||||
with open(f) as fp:
|
||||
data = fp.read()
|
||||
|
||||
web_path = file_map[f]
|
||||
web_dir = os.path.dirname(web_path)
|
||||
|
||||
data = re.sub(
|
||||
rx_import,
|
||||
r"""@import \1%s/""" % (web_dir,),
|
||||
data,
|
||||
)
|
||||
|
||||
data = re.sub(
|
||||
rx_url,
|
||||
r"""url(\1%s/""" % (web_dir,),
|
||||
data,
|
||||
)
|
||||
return data
|
||||
|
||||
content,timestamp = concat_files((f[0] for f in files), reader)
|
||||
# TODO use timestamp to set Last mofified date and E-tag
|
||||
return req.make_response(content, [('Content-Type', 'text/css')])
|
||||
|
||||
|
@ -112,6 +176,14 @@ class WebClient(openerpweb.Controller):
|
|||
# TODO use timestamp to set Last mofified date and E-tag
|
||||
return req.make_response(content, [('Content-Type', 'application/javascript')])
|
||||
|
||||
@openerpweb.httprequest
|
||||
def qweb(self, req, mods=None):
|
||||
files = [f[0] for f in self.manifest_glob(req, mods, 'qweb')]
|
||||
content,timestamp = concat_xml(files)
|
||||
# TODO use timestamp to set Last mofified date and E-tag
|
||||
return req.make_response(content, [('Content-Type', 'text/xml')])
|
||||
|
||||
|
||||
@openerpweb.httprequest
|
||||
def home(self, req, s_action=None, **kw):
|
||||
js = "\n ".join('<script type="text/javascript" src="%s"></script>'%i for i in self.manifest_list(req, None, 'js'))
|
||||
|
@ -451,7 +523,7 @@ def clean_action(req, action, do_not_eval=False):
|
|||
# values come from the server, we can just eval them
|
||||
if isinstance(action.get('context'), basestring):
|
||||
action['context'] = eval( action['context'], eval_ctx ) or {}
|
||||
|
||||
|
||||
if isinstance(action.get('domain'), basestring):
|
||||
action['domain'] = eval( action['domain'], eval_ctx ) or []
|
||||
else:
|
||||
|
|
|
@ -8,13 +8,13 @@ msgstr ""
|
|||
"Project-Id-Version: openerp-web\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2011-10-07 10:38+0200\n"
|
||||
"PO-Revision-Date: 2011-11-04 16:13+0000\n"
|
||||
"Last-Translator: kifcaliph <kifcaliph@hotmail.com>\n"
|
||||
"PO-Revision-Date: 2011-11-08 05:44+0000\n"
|
||||
"Last-Translator: Ahmad Khayyat <Unknown>\n"
|
||||
"Language-Team: Arabic <ar@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-11-05 06:04+0000\n"
|
||||
"X-Launchpad-Export-Date: 2011-11-08 06:12+0000\n"
|
||||
"X-Generator: Launchpad (build 14231)\n"
|
||||
|
||||
#: addons/web/static/src/js/view_form.js:355
|
||||
|
@ -210,7 +210,8 @@ msgid ""
|
|||
"Today's enterprise challenges are multiple. We provide one module for each "
|
||||
"need."
|
||||
msgstr ""
|
||||
"تتعدد تحديات المنشآت اليوم، و لذلك نوفر العديد من وحدات الأكواد لكل إحتياج."
|
||||
"تتعدد تحديات المنشآت اليوم، و لذلك نوفر العديد من الوحدات البرمجية لكل "
|
||||
"احتياج."
|
||||
|
||||
#: addons/web/static/src/xml/base.xml:0
|
||||
msgid "Open Source"
|
||||
|
@ -265,7 +266,7 @@ msgstr "إخفاء هذه الملحوظة"
|
|||
|
||||
#: addons/web/static/src/xml/base.xml:0
|
||||
msgid "Disable all tips"
|
||||
msgstr "تعطيل جميع النصائح"
|
||||
msgstr "تعطيل جميع الإرشادات"
|
||||
|
||||
#: addons/web/static/src/xml/base.xml:0
|
||||
msgid "View#"
|
||||
|
|
|
@ -1088,7 +1088,7 @@ label.error {
|
|||
list-style: none;
|
||||
}
|
||||
.openerp .oe-view-manager-logs li:before {
|
||||
content: '→ ';
|
||||
content: '\2192 ';
|
||||
}
|
||||
.openerp .oe-view-manager-logs a {
|
||||
text-decoration: none;
|
||||
|
@ -1448,3 +1448,4 @@ ul.oe-arrow-list li.oe-arrow-list-selected .oe-arrow-list-after {
|
|||
.openerp .oe_view_editor_tree_grid a {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
|
|
@ -136,10 +136,10 @@ openerp.web.Dialog = openerp.web.OldWidget.extend(/** @lends openerp.web.Dialog#
|
|||
}
|
||||
});
|
||||
|
||||
openerp.web.CrashManager = openerp.web.SessionAware.extend({
|
||||
init: function(parent) {
|
||||
this._super((parent || {}).session);
|
||||
this.session.on_rpc_error.add(this.on_rpc_error);
|
||||
openerp.web.CrashManager = openerp.web.CallbackEnabled.extend({
|
||||
init: function() {
|
||||
this._super();
|
||||
openerp.connection.on_rpc_error.add(this.on_rpc_error);
|
||||
},
|
||||
on_rpc_error: function(error) {
|
||||
this.error = error;
|
||||
|
@ -959,17 +959,15 @@ openerp.web.WebClient = openerp.web.Widget.extend(/** @lends openerp.web.WebClie
|
|||
this._super(null, element_id);
|
||||
openerp.webclient = this;
|
||||
|
||||
QWeb.add_template("/web/static/src/xml/base.xml");
|
||||
var params = {};
|
||||
if(jQuery.param != undefined && jQuery.deparam(jQuery.param.querystring()).kitten != undefined) {
|
||||
this.$element.addClass("kitten-mode-activated");
|
||||
}
|
||||
this.$element.html(QWeb.render("Interface", params));
|
||||
|
||||
this.notification = new openerp.web.Notification();
|
||||
this.session = new openerp.web.Session();
|
||||
this.notification = new openerp.web.Notification(this);
|
||||
this.loading = new openerp.web.Loading(this,"oe_loading");
|
||||
this.crashmanager = new openerp.web.CrashManager(this);
|
||||
this.crashmanager = new openerp.web.CrashManager();
|
||||
|
||||
this.header = new openerp.web.Header(this);
|
||||
this.login = new openerp.web.Login(this);
|
||||
|
|
|
@ -237,8 +237,8 @@ openerp.web.Registry = openerp.web.Class.extend( /** @lends openerp.web.Registry
|
|||
* registry was created.
|
||||
*
|
||||
* An object path is simply a dotted name from the openerp root to the
|
||||
* object pointed to (e.g. ``"openerp.web.Session"`` for an OpenERP
|
||||
* session object).
|
||||
* object pointed to (e.g. ``"openerp.web.Connection"`` for an OpenERP
|
||||
* connection object).
|
||||
*
|
||||
* @constructs openerp.web.Registry
|
||||
* @param {Object} mapping a mapping of keys to object-paths
|
||||
|
@ -338,9 +338,9 @@ openerp.web.CallbackEnabled = openerp.web.Class.extend(/** @lends openerp.web.Ca
|
|||
}
|
||||
});
|
||||
|
||||
openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web.Session# */{
|
||||
openerp.web.Connection = openerp.web.CallbackEnabled.extend( /** @lends openerp.web.Connection# */{
|
||||
/**
|
||||
* @constructs openerp.web.Session
|
||||
* @constructs openerp.web.Connection
|
||||
* @extends openerp.web.CallbackEnabled
|
||||
*
|
||||
* @param {String} [server] JSON-RPC endpoint hostname
|
||||
|
@ -364,7 +364,9 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web
|
|||
// TODO: session should have an optional name indicating that they'll
|
||||
// be saved to (and revived from) cookies
|
||||
this.name = 'session';
|
||||
this.do_load_qweb(['/web/webclient/qweb']);
|
||||
},
|
||||
|
||||
start: function() {
|
||||
this.session_restore();
|
||||
},
|
||||
|
@ -487,9 +489,11 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web
|
|||
self.user_context = result.context;
|
||||
self.db = result.db;
|
||||
self.session_save();
|
||||
self.on_session_valid();
|
||||
return true;
|
||||
}).then(success_callback);
|
||||
},
|
||||
login: function() { this.session_login.apply(this, arguments); },
|
||||
/**
|
||||
* Reloads uid and session_id from local storage, if they exist
|
||||
*/
|
||||
|
@ -577,6 +581,7 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web
|
|||
self.rpc('/web/webclient/jslist', {"mods": modules}, function(files) {
|
||||
self.do_load_js(file_list.concat(files));
|
||||
});
|
||||
self.rpc('/web/webclient/qweblist', {"mods": modules}, self.do_load_qweb);
|
||||
openerp._modules_loaded = true;
|
||||
});
|
||||
});
|
||||
|
@ -610,6 +615,12 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web
|
|||
this.on_modules_loaded();
|
||||
}
|
||||
},
|
||||
do_load_qweb: function(files) {
|
||||
var self = this;
|
||||
_.each(files, function(file) {
|
||||
openerp.web.qweb.add_template(file);
|
||||
});
|
||||
},
|
||||
on_modules_loaded: function() {
|
||||
for(var j=0; j<this.module_list.length; j++) {
|
||||
var mod = this.module_list[j];
|
||||
|
@ -716,36 +727,6 @@ openerp.web.Session = openerp.web.CallbackEnabled.extend( /** @lends openerp.web
|
|||
}
|
||||
});
|
||||
|
||||
openerp.web.SessionAware = openerp.web.CallbackEnabled.extend(/** @lends openerp.web.SessionAware# */{
|
||||
/**
|
||||
* Utility class that any class is allowed to extend to easy common manipulations.
|
||||
*
|
||||
* It provides rpc calls, callback on all methods preceded by "on_" or "do_" and a
|
||||
* logging facility.
|
||||
*
|
||||
* @constructs openerp.web.SessionAware
|
||||
* @extends openerp.web.CallbackEnabled
|
||||
*
|
||||
* @param {openerp.web.Session} session
|
||||
*/
|
||||
init: function(session) {
|
||||
this._super();
|
||||
this.session = session;
|
||||
},
|
||||
/**
|
||||
* Performs a JSON-RPC call
|
||||
*
|
||||
* @param {String} url endpoint url
|
||||
* @param {Object} data RPC parameters
|
||||
* @param {Function} success RPC call success callback
|
||||
* @param {Function} error RPC call error callback
|
||||
* @returns {jQuery.Deferred} deferred object for the RPC call
|
||||
*/
|
||||
rpc: function(url, data, success, error) {
|
||||
return this.session.rpc(url, data, success, error);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Base class for all visual components. Provides a lot of functionalities helpful
|
||||
* for the management of a part of the DOM.
|
||||
|
@ -756,8 +737,6 @@ openerp.web.SessionAware = openerp.web.CallbackEnabled.extend(/** @lends openerp
|
|||
* destroyed too).
|
||||
* - Insertion in DOM.
|
||||
*
|
||||
* Widget also extends SessionAware for ease of use.
|
||||
*
|
||||
* Guide to create implementations of the Widget class:
|
||||
* ==============================================
|
||||
*
|
||||
|
@ -798,7 +777,7 @@ openerp.web.SessionAware = openerp.web.CallbackEnabled.extend(/** @lends openerp
|
|||
*
|
||||
* That will kill the widget in a clean way and erase its content from the dom.
|
||||
*/
|
||||
openerp.web.Widget = openerp.web.SessionAware.extend(/** @lends openerp.web.Widget# */{
|
||||
openerp.web.Widget = openerp.web.CallbackEnabled.extend(/** @lends openerp.web.Widget# */{
|
||||
/**
|
||||
* The name of the QWeb template that will be used for rendering. Must be
|
||||
* redefined in subclasses or the default render() method can not be used.
|
||||
|
@ -817,7 +796,7 @@ openerp.web.Widget = openerp.web.SessionAware.extend(/** @lends openerp.web.Widg
|
|||
* Construct the widget and set its parent if a parent is given.
|
||||
*
|
||||
* @constructs openerp.web.Widget
|
||||
* @extends openerp.web.SessionAware
|
||||
* @extends openerp.web.CallbackEnabled
|
||||
*
|
||||
* @param {openerp.web.Widget} parent Binds the current instance to the given Widget instance.
|
||||
* When that widget is destroyed by calling stop(), the current instance will be
|
||||
|
@ -828,7 +807,8 @@ openerp.web.Widget = openerp.web.SessionAware.extend(/** @lends openerp.web.Widg
|
|||
* for new components this argument should not be provided any more.
|
||||
*/
|
||||
init: function(parent, /** @deprecated */ element_id) {
|
||||
this._super((parent || {}).session);
|
||||
this._super();
|
||||
this.session = openerp.connection;
|
||||
// if given an element_id, try to get the associated DOM element and save
|
||||
// a reference in this.$element. Else just generate a unique identifier.
|
||||
this.element_id = element_id;
|
||||
|
@ -967,7 +947,7 @@ openerp.web.Widget = openerp.web.SessionAware.extend(/** @lends openerp.web.Widg
|
|||
rpc: function(url, data, success, error) {
|
||||
var def = $.Deferred().then(success, error);
|
||||
var self = this;
|
||||
this._super(url, data). then(function() {
|
||||
openerp.connection.rpc(url, data). then(function() {
|
||||
if (!self.widget_is_stopped)
|
||||
def.resolve.apply(def, arguments);
|
||||
}, function() {
|
||||
|
@ -1047,6 +1027,8 @@ if ($.blockUI) {
|
|||
$.blockUI.defaults.baseZ = 1100;
|
||||
$.blockUI.defaults.message = '<img src="/web/static/src/img/throbber2.gif">';
|
||||
}
|
||||
|
||||
/** Configure default qweb */
|
||||
openerp.web._t = new openerp.web.TranslationDataBase().build_translation_function();
|
||||
openerp.web.qweb = new QWeb2.Engine();
|
||||
openerp.web.qweb.debug = (window.location.search.indexOf('?debug') !== -1);
|
||||
|
@ -1067,6 +1049,9 @@ openerp.web.qweb.format_text_node = function(s) {
|
|||
return tr === ts ? s : tr;
|
||||
}
|
||||
|
||||
/** Setup default connection */
|
||||
openerp.connection = new openerp.web.Connection();
|
||||
|
||||
};
|
||||
|
||||
// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
|
||||
|
|
|
@ -32,7 +32,7 @@ openerp.web.DataGroup = openerp.web.Widget.extend( /** @lends openerp.web.DataG
|
|||
* @constructs openerp.web.DataGroup
|
||||
* @extends openerp.web.Widget
|
||||
*
|
||||
* @param {openerp.web.Session} session Current OpenERP session
|
||||
* @param {openerp.web.Widget} parent widget
|
||||
* @param {String} model name of the model managed by this DataGroup
|
||||
* @param {Array} domain search domain for this DataGroup
|
||||
* @param {Object} context context of the DataGroup's searches
|
||||
|
@ -785,11 +785,15 @@ openerp.web.ProxyDataSet = openerp.web.DataSetSearch.extend({
|
|||
on_unlink: function(ids) {}
|
||||
});
|
||||
|
||||
openerp.web.Model = openerp.web.SessionAware.extend({
|
||||
init: function(session, model_name) {
|
||||
this._super(session);
|
||||
openerp.web.Model = openerp.web.CallbackEnabled.extend({
|
||||
init: function(_, model_name) {
|
||||
this._super();
|
||||
this.model_name = model_name;
|
||||
},
|
||||
rpc: function() {
|
||||
var c = openerp.connection;
|
||||
return c.rpc.apply(c, arguments);
|
||||
},
|
||||
get_func: function(method_name) {
|
||||
var self = this;
|
||||
return function() {
|
||||
|
|
|
@ -433,6 +433,7 @@ openerp.web.search.Widget = openerp.web.Widget.extend( /** @lends openerp.web.se
|
|||
* @param view the ancestor view of this widget
|
||||
*/
|
||||
init: function (view) {
|
||||
this._super(view);
|
||||
this.view = view;
|
||||
},
|
||||
/**
|
||||
|
@ -473,10 +474,8 @@ openerp.web.search.Widget = openerp.web.Widget.extend( /** @lends openerp.web.se
|
|||
this._super();
|
||||
},
|
||||
render: function (defaults) {
|
||||
return QWeb.render(
|
||||
this.template, _.extend(this, {
|
||||
defaults: defaults
|
||||
}));
|
||||
// FIXME
|
||||
return this._super(_.extend(this, {defaults: defaults}));
|
||||
}
|
||||
});
|
||||
openerp.web.search.add_expand_listener = function($root) {
|
||||
|
|
|
@ -8,6 +8,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
this.dataset = new openerp.web.DataSetSearch(this, 'ir.ui.view', null, null);
|
||||
this.model = dataset.model;
|
||||
this.xml_element_id = 0;
|
||||
this.property = openerp.web.ViewEditor.property_widget;
|
||||
},
|
||||
start: function() {
|
||||
this.init_view_editor();
|
||||
|
@ -238,8 +239,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
obj.child_id.push(xpath_arch_object[0]);
|
||||
xpath_arch_object.pop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
_.each(arch_object, function(element) {
|
||||
self.inherit_apply(expr_list, element.child_id, xpath_arch_object);
|
||||
});
|
||||
|
@ -315,14 +315,18 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
var view_id;
|
||||
var view_xml_id;
|
||||
var view_find = side;
|
||||
var min_level = clicked_tr_level;
|
||||
while (1) {
|
||||
view_find = view_find.prev();
|
||||
if((self.edit_xml_dialog.$element.find(view_find).find('a').text()).search("view_id") != -1
|
||||
&& parseInt(view_find.attr('level')) < clicked_tr_level) {
|
||||
if ((self.edit_xml_dialog.$element.find(view_find).find('a').text()).search("view_id") != -1
|
||||
&& parseInt(view_find.attr('level')) < min_level ) {
|
||||
view_id = parseInt(($(view_find).find('a').text()).replace(/[^0-9]+/g, ''));
|
||||
view_xml_id = (view_find.attr('id')).split('-')[1];
|
||||
break;
|
||||
}
|
||||
if(view_find.attr('level') < min_level){
|
||||
min_level = parseInt(view_find.attr('level'));
|
||||
}
|
||||
}
|
||||
switch (this.id) {
|
||||
case "side-add":
|
||||
|
@ -330,6 +334,12 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
case "side-remove":
|
||||
break;
|
||||
case "side-edit":
|
||||
var tr = $(this).closest("tr[id^='viewedit-']").find('a').text();
|
||||
var tag = _.detect(_.keys(_PROPERTIES),function(res){
|
||||
return _.includes(tr, res);
|
||||
});
|
||||
var properties = _PROPERTIES[tag];
|
||||
self.on_edit_node(properties, clicked_tr_id, one_object, view_id, view_xml_id, clicked_tr_level);
|
||||
break;
|
||||
case "side-up":
|
||||
while (1) {
|
||||
|
@ -359,7 +369,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
_.each(tr_to_move, function(rec) {
|
||||
$(last_tr).before(rec);
|
||||
});
|
||||
self.save_move_arch(one_object, view_id, view_xml_id, clicked_tr_id, clicked_tr_level, "up");
|
||||
self.do_save_update_arch(one_object, view_id, view_xml_id, clicked_tr_id, clicked_tr_level, "up");
|
||||
}
|
||||
break;
|
||||
case "side-down":
|
||||
|
@ -374,10 +384,10 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
cur_tr = next_tr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
last_tr = cur_tr.next();
|
||||
}
|
||||
|
||||
if ((self.edit_xml_dialog.$element.find(last_tr).find('a').text()).search("view_id") != -1) {
|
||||
return;
|
||||
}
|
||||
|
@ -398,16 +408,18 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
_.each(tr_to_move, function(rec) {
|
||||
$(last_tr).after(rec);
|
||||
});
|
||||
self.save_move_arch(one_object, view_id, view_xml_id, clicked_tr_id, clicked_tr_level, "down");
|
||||
self.do_save_update_arch(one_object, view_id, view_xml_id, clicked_tr_id, clicked_tr_level, "down");
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
},
|
||||
save_move_arch: function(one_object, view_id, view_xml_id, clicked_tr_id, level, move_direct) {
|
||||
do_save_update_arch: function(one_object, view_id, view_xml_id, clicked_tr_id, clicked_tr_level, move_direct, update_values) {
|
||||
var self = this;
|
||||
var arch = _.detect(one_object['arch'], function(element) {return element.view_id == view_id;});
|
||||
console.log(arch);
|
||||
var obj = self.get_object_by_id(view_xml_id, one_object['main_object'], []);
|
||||
console.log(obj);
|
||||
//for finding xpath tag from inherit view
|
||||
var xml_arch = QWeb.load_xml(arch.arch);
|
||||
if (xml_arch.childNodes[0].tagName == "data") {
|
||||
|
@ -418,10 +430,9 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
if (insert.length == check_list.length ) {return xml_child;}
|
||||
});
|
||||
}
|
||||
return self.save_arch(arch.arch, obj[0].child_id[0], parseInt(clicked_tr_id), [], parseInt(level),
|
||||
parseInt(view_id), arch, move_direct);
|
||||
return self.do_save_xml(arch.arch, obj[0].child_id[0], parseInt(clicked_tr_id), [], parseInt(clicked_tr_level),
|
||||
parseInt(view_id), arch, move_direct, update_values);
|
||||
},
|
||||
|
||||
get_object_by_id: function(view_xml_id, one_object, result) {
|
||||
var self = this;
|
||||
if (result.length == 0 ) {
|
||||
|
@ -435,26 +446,34 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
save_arch: function(arch1, obj, id, child_list, level, view_id, arch, move_direct){
|
||||
do_save_xml: function(arch1, obj, id, child_list, level, view_id, arch, move_direct, update_values){
|
||||
var self = this;
|
||||
var children_list = $(arch1).children();
|
||||
var list_obj_xml = _.zip(children_list,obj.child_id);
|
||||
var list_obj_xml = _.zip(children_list, obj.child_id);
|
||||
if (id) {
|
||||
if (obj.id == id) {
|
||||
var id;
|
||||
var parent = $(arch1).parents();
|
||||
var index = _.indexOf(child_list, obj);
|
||||
var re_insert_obj = child_list.splice(index, 1);
|
||||
if (move_direct == "down") {
|
||||
var next = $(arch1).next();
|
||||
$(next).after(arch1);
|
||||
var re_insert_obj = child_list.splice(index, 1);
|
||||
child_list.splice(index+1, 0, re_insert_obj[0]);
|
||||
} else {
|
||||
} else if (move_direct == "up") {
|
||||
var prev = $(arch1).prev();
|
||||
$(prev).before(arch1);
|
||||
var re_insert_obj = child_list.splice(index, 1);
|
||||
child_list.splice(index-1, 0, re_insert_obj[0]);
|
||||
} else if (move_direct == "update_node") {
|
||||
_.each(update_values, function(val){
|
||||
$(arch1).attr(val[0],val[1]);
|
||||
});
|
||||
var new_obj = self.create_View_Node(arch1);
|
||||
new_obj.id = obj.id,new_obj.child_id = obj.child_id;
|
||||
self.edit_xml_dialog.$element.find("tr[id='viewedit-"+id+"']").find('a').text(new_obj.name);
|
||||
child_list.splice(index, 1, new_obj);
|
||||
}
|
||||
var parent = $(arch1).parents();
|
||||
var convert_to_utf = QWeb.tools.xml_node_to_string(parent[parent.length-1]);
|
||||
convert_to_utf = convert_to_utf.replace('xmlns="http://www.w3.org/1999/xhtml"', "");
|
||||
convert_to_utf = '<?xml version="1.0"?>' + convert_to_utf;
|
||||
|
@ -464,7 +483,7 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
}
|
||||
if (obj.level <= level) {
|
||||
_.each(list_obj_xml, function(child_node) {
|
||||
self.save_arch(child_node[0], child_node[1], id, obj.child_id, level, view_id, arch, move_direct);
|
||||
self.do_save_xml(child_node[0], child_node[1], id, obj.child_id, level, view_id, arch, move_direct, update_values);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -491,6 +510,285 @@ openerp.web.ViewEditor = openerp.web.Widget.extend({
|
|||
tr.find("img[id='parentimg-" + rec + "']").attr('src', '/web/static/src/img/expand.gif');
|
||||
tr.show();
|
||||
});
|
||||
},
|
||||
on_edit_node:function(properties, clicked_tr_id, obj, view_id, view_xml_id, clicked_tr_level){
|
||||
var self = this;
|
||||
this.edit_node_dialog = new openerp.web.Dialog(this,{
|
||||
modal: true,
|
||||
title: 'Properties',
|
||||
width: 500,
|
||||
height: 400,
|
||||
buttons: {
|
||||
"Update": function(){
|
||||
var update_values = [];
|
||||
_.each(self.edit_widget, function(widget) {
|
||||
var value = widget.get_value();
|
||||
if (value) {
|
||||
update_values.push(value);
|
||||
}
|
||||
});
|
||||
self.do_save_update_arch(obj, view_id, view_xml_id, clicked_tr_id, clicked_tr_level, "update_node", update_values);
|
||||
self.edit_node_dialog.close();
|
||||
},
|
||||
"Cancel": function(){
|
||||
self.edit_node_dialog.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
this.edit_node_dialog.start().open();
|
||||
var widget = _.keys(self.property.map);
|
||||
var arch_val = self.get_object_by_id(clicked_tr_id,obj['main_object'], []);
|
||||
this.edit_node_dialog.$element.append('<table id="rec_table" style="width:400px" class="oe_forms"></table>');
|
||||
this.edit_widget = [];
|
||||
_.each(properties, function(record) {
|
||||
var id = record,
|
||||
type_widget;
|
||||
self.ready = $.when(self.on_groups(id)).then(function () {
|
||||
if (_.include(widget,id)){
|
||||
type_widget = new (self.property.get_any(['undefined' , id, arch_val[0]['att_list'][0]])) (self.edit_node_dialog, arch_val, id);
|
||||
} else {
|
||||
type_widget = new openerp.web.ViewEditor.FieldChar (self.edit_node_dialog,arch_val, id);
|
||||
}
|
||||
self.edit_widget.push(type_widget);
|
||||
self.edit_node_dialog.$element.find('table[id=rec_table]').append('<tr><td align="right">'+id+':</td><td>'+type_widget.render()+'</td></tr>');
|
||||
var view_val = _.detect(arch_val[0]['att_list'],function(res) {
|
||||
return _.include(res, id);
|
||||
});
|
||||
var value = null;
|
||||
id == 'groups'? type_widget.set_value(self.groups, view_val): type_widget.set_value(value, view_val);
|
||||
type_widget.start();
|
||||
});
|
||||
});
|
||||
},
|
||||
//for getting groups
|
||||
on_groups: function(id){
|
||||
var self = this,
|
||||
def = $.Deferred();
|
||||
if (id != 'groups') {
|
||||
self.groups = false;
|
||||
return false;
|
||||
}
|
||||
var group_ids = [],
|
||||
group_names = {},
|
||||
groups = [];
|
||||
var res_groups = new openerp.web.DataSetSearch(this,'res.groups', null, null),
|
||||
model_data = new openerp.web.DataSetSearch(self,'ir.model.data', null, null);
|
||||
res_groups
|
||||
.read_slice([], {})
|
||||
.done(function(res_grp) {
|
||||
_.each(res_grp,function(res){
|
||||
var key = res.id;
|
||||
group_names[key]=res.name;
|
||||
group_ids.push(res.id);
|
||||
});
|
||||
model_data
|
||||
.read_slice([],{domain:[['res_id', 'in', group_ids],['model','=','res.groups']]})
|
||||
.done(function(model_grp) {
|
||||
_.each(model_grp,function(res_group){
|
||||
groups.push([res_group.name,group_names[res_group.res_id]]);
|
||||
});
|
||||
self.groups = groups;
|
||||
def.resolve();
|
||||
});
|
||||
})
|
||||
return def.promise();
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.Field = openerp.web.Class.extend({
|
||||
init: function(view, node, id) {
|
||||
this.$element = view.$element;
|
||||
this.node = node;
|
||||
this.dirty = false;
|
||||
this.name = id;
|
||||
},
|
||||
on_ui_change: function() {
|
||||
this.dirty = true;
|
||||
},
|
||||
render: function() {
|
||||
return QWeb.render(this.template, {widget: this});
|
||||
},
|
||||
});
|
||||
openerp.web.ViewEditor.FieldBoolean = openerp.web.ViewEditor.Field.extend({
|
||||
template : "vieweditor_boolean",
|
||||
start: function() {
|
||||
var self = this;
|
||||
this.$element.find("input[id="+ self.name+"]").change(function() {
|
||||
self.on_ui_change();
|
||||
});
|
||||
},
|
||||
set_value: function(value,view_val) {
|
||||
if (view_val) {
|
||||
this.$element.find("input[id=" + this.name+ "]").attr('checked', view_val[1]);
|
||||
}
|
||||
},
|
||||
get_value: function() {
|
||||
if (!this.dirty) {
|
||||
return false;
|
||||
}
|
||||
var value = this.$element.find("input[id=" + this.name + "]").is(':checked');
|
||||
return value ? [this.name, value] : [this.name, null];
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.FieldChar = openerp.web.ViewEditor.Field.extend({
|
||||
template : "vieweditor_char",
|
||||
start: function () {
|
||||
var self = this;
|
||||
this.$element.find("input[id="+ this.name+"]").css('width','100%').change(function() {
|
||||
self.on_ui_change();
|
||||
});
|
||||
},
|
||||
set_value: function(value,view_val) {
|
||||
view_val ? this.$element.find("input[id=" + this.name + "]").val(view_val[1]): this.$element.find("tr[id=" + this.name + "] input").val();
|
||||
},
|
||||
get_value: function() {
|
||||
if (!this.dirty) {
|
||||
return false;
|
||||
}
|
||||
var value= this.$element.find("input[id=" + this.name + "]").val();
|
||||
return value ? [this.name, value] : [this.name, ""];
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.FieldSelect = openerp.web.ViewEditor.Field.extend({
|
||||
template : "vieweditor_selection",
|
||||
start: function () {
|
||||
var self = this;
|
||||
this.$element.find("select[id=" + this.name + "]").css('width', '100%').change(function() {
|
||||
self.on_ui_change();
|
||||
});
|
||||
},
|
||||
set_value: function(value, view_val) {
|
||||
var self = this;
|
||||
_.each(value, function(item) {
|
||||
var select_val = view_val? (view_val[1] == ((typeof(item) == 'string')? item:item[0])?true: false): false;
|
||||
self.$element.find("select[id=" + self.name + "]").append($("<option/>", {
|
||||
value: (typeof(item) == 'string') ? item: item[0],
|
||||
text: (typeof(item) == 'string')? item: item[1],
|
||||
selected:select_val
|
||||
}));
|
||||
});
|
||||
},
|
||||
get_value: function() {
|
||||
if (!this.dirty) {
|
||||
return false;
|
||||
}
|
||||
var value = this.$element.find("select[id=" + this.name + "]").find("option:selected").val();
|
||||
return value ? [this.name, value] : [this.name, ""];
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.WidgetProperty = openerp.web.ViewEditor.FieldSelect.extend({
|
||||
init: function(view, node, id) {
|
||||
this._super(view, node, id);
|
||||
this.registry = openerp.web.form.widgets;
|
||||
},
|
||||
set_value: function(value, view_val) {
|
||||
value = _.keys(this.registry.map);
|
||||
value.push('');
|
||||
value.sort();
|
||||
this._super.apply(this,[value, view_val]);
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.IconProperty = openerp.web.ViewEditor.FieldSelect.extend({
|
||||
set_value: function(value, view_val) {
|
||||
this._super.apply(this,[icons, view_val]);
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.ButtonTargetProperty = openerp.web.ViewEditor.FieldSelect.extend({
|
||||
set_value: function(value, view_val) {
|
||||
value = [['', ''], ['new', 'New Window']];
|
||||
this._super.apply(this,[value, view_val]);
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.ButtonTypeProperty = openerp.web.ViewEditor.FieldSelect.extend({
|
||||
set_value: function(value, view_val) {
|
||||
value = [['', ''], ['action', 'Action'], ['object', 'Object'], ['workflow', 'Workflow'], ['server_action', 'Server Action']];
|
||||
this._super.apply(this,[value, view_val]);
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.AlignProperty = openerp.web.ViewEditor.FieldSelect.extend({
|
||||
set_value: function(value, view_val) {
|
||||
value = [['', ''], ['0.0', 'Left'], ['0.5', 'Center'], ['1.0', 'Right']];
|
||||
this._super.apply(this,[value, view_val]);
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.ButtonSpecialProperty = openerp.web.ViewEditor.FieldSelect.extend({
|
||||
set_value: function(value, view_val) {
|
||||
value = [['',''],['save', 'Save Button'], ['cancel', 'Cancel Button'], ['open', 'Open Button']];
|
||||
this._super.apply(this,[value, view_val]);
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.PositionProperty = openerp.web.ViewEditor.FieldSelect.extend({
|
||||
set_value: function(value, view_val) {
|
||||
value = [['',''],['after', 'After'],['before', 'Before'],['inside', 'Inside'],['replace', 'Replace']];
|
||||
this._super.apply(this,[value, view_val]);
|
||||
}
|
||||
});
|
||||
openerp.web.ViewEditor.GroupsProperty = openerp.web.ViewEditor.FieldSelect.extend({
|
||||
set_value: function(value, view_val) {
|
||||
this.$element.find("select[id="+ this.name +"]").attr('multiple', true).css('height','100px');
|
||||
this._super.apply(this,[value, view_val]);
|
||||
}
|
||||
});
|
||||
var _PROPERTIES = {
|
||||
'field' : ['name', 'string', 'required', 'readonly', 'domain', 'context', 'nolabel', 'completion',
|
||||
'colspan', 'widget', 'eval', 'ref', 'on_change', 'groups', 'attrs'],
|
||||
'form' : ['string', 'col', 'link'],
|
||||
'notebook' : ['colspan', 'position', 'groups'],
|
||||
'page' : ['string', 'states', 'attrs', 'groups'],
|
||||
'group' : ['string', 'col', 'colspan', 'states', 'attrs', 'groups'],
|
||||
'image' : ['filename', 'width', 'height', 'groups'],
|
||||
'separator' : ['string', 'colspan', 'groups'],
|
||||
'label': ['string', 'align', 'colspan', 'groups'],
|
||||
'button': ['name', 'string', 'icon', 'type', 'states', 'readonly', 'special', 'target', 'confirm', 'context', 'attrs', 'groups','colspan'],
|
||||
'newline' : [],
|
||||
'hpaned': ['position', 'groups'],
|
||||
'vpaned': ['position', 'groups'],
|
||||
'child1' : ['groups'],
|
||||
'child2' : ['groups'],
|
||||
'action' : ['name', 'string', 'colspan', 'groups'],
|
||||
'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows'],
|
||||
'graph' : ['string', 'type'],
|
||||
'calendar' : ['string', 'date_start', 'date_stop', 'date_delay', 'day_length', 'color', 'mode'],
|
||||
'view' : [],
|
||||
};
|
||||
var icons = ['','STOCK_ABOUT', 'STOCK_ADD', 'STOCK_APPLY', 'STOCK_BOLD',
|
||||
'STOCK_CANCEL', 'STOCK_CDROM', 'STOCK_CLEAR', 'STOCK_CLOSE', 'STOCK_COLOR_PICKER',
|
||||
'STOCK_CONNECT', 'STOCK_CONVERT', 'STOCK_COPY', 'STOCK_CUT', 'STOCK_DELETE',
|
||||
'STOCK_DIALOG_AUTHENTICATION', 'STOCK_DIALOG_ERROR', 'STOCK_DIALOG_INFO',
|
||||
'STOCK_DIALOG_QUESTION', 'STOCK_DIALOG_WARNING', 'STOCK_DIRECTORY', 'STOCK_DISCONNECT',
|
||||
'STOCK_DND', 'STOCK_DND_MULTIPLE', 'STOCK_EDIT', 'STOCK_EXECUTE', 'STOCK_FILE',
|
||||
'STOCK_FIND', 'STOCK_FIND_AND_REPLACE', 'STOCK_FLOPPY', 'STOCK_GOTO_BOTTOM',
|
||||
'STOCK_GOTO_FIRST', 'STOCK_GOTO_LAST', 'STOCK_GOTO_TOP', 'STOCK_GO_BACK',
|
||||
'STOCK_GO_DOWN', 'STOCK_GO_FORWARD', 'STOCK_GO_UP', 'STOCK_HARDDISK',
|
||||
'STOCK_HELP', 'STOCK_HOME', 'STOCK_INDENT', 'STOCK_INDEX', 'STOCK_ITALIC',
|
||||
'STOCK_JUMP_TO', 'STOCK_JUSTIFY_CENTER', 'STOCK_JUSTIFY_FILL',
|
||||
'STOCK_JUSTIFY_LEFT', 'STOCK_JUSTIFY_RIGHT', 'STOCK_MEDIA_FORWARD',
|
||||
'STOCK_MEDIA_NEXT', 'STOCK_MEDIA_PAUSE', 'STOCK_MEDIA_PLAY',
|
||||
'STOCK_MEDIA_PREVIOUS', 'STOCK_MEDIA_RECORD', 'STOCK_MEDIA_REWIND',
|
||||
'STOCK_MEDIA_STOP', 'STOCK_MISSING_IMAGE', 'STOCK_NETWORK', 'STOCK_NEW',
|
||||
'STOCK_NO', 'STOCK_OK', 'STOCK_OPEN', 'STOCK_PASTE', 'STOCK_PREFERENCES',
|
||||
'STOCK_PRINT', 'STOCK_PRINT_PREVIEW', 'STOCK_PROPERTIES', 'STOCK_QUIT',
|
||||
'STOCK_REDO', 'STOCK_REFRESH', 'STOCK_REMOVE', 'STOCK_REVERT_TO_SAVED',
|
||||
'STOCK_SAVE', 'STOCK_SAVE_AS', 'STOCK_SELECT_COLOR', 'STOCK_SELECT_FONT',
|
||||
'STOCK_SORT_ASCENDING', 'STOCK_SORT_DESCENDING', 'STOCK_SPELL_CHECK',
|
||||
'STOCK_STOP', 'STOCK_STRIKETHROUGH', 'STOCK_UNDELETE', 'STOCK_UNDERLINE',
|
||||
'STOCK_UNDO', 'STOCK_UNINDENT', 'STOCK_YES', 'STOCK_ZOOM_100',
|
||||
'STOCK_ZOOM_FIT', 'STOCK_ZOOM_IN', 'STOCK_ZOOM_OUT',
|
||||
'terp-account', 'terp-crm', 'terp-mrp', 'terp-product', 'terp-purchase',
|
||||
'terp-sale', 'terp-tools', 'terp-administration', 'terp-hr', 'terp-partner',
|
||||
'terp-project', 'terp-report', 'terp-stock', 'terp-calendar', 'terp-graph'
|
||||
];
|
||||
openerp.web.ViewEditor.property_widget = new openerp.web.Registry({
|
||||
'required' : 'openerp.web.ViewEditor.FieldBoolean',
|
||||
'readonly' : 'openerp.web.ViewEditor.FieldBoolean',
|
||||
'nolabel' : 'openerp.web.ViewEditor.FieldBoolean',
|
||||
'completion' : 'openerp.web.ViewEditor.FieldBoolean',
|
||||
'widget' : 'openerp.web.ViewEditor.WidgetProperty',
|
||||
'groups' : 'openerp.web.ViewEditor.GroupsProperty',
|
||||
'position': 'openerp.web.ViewEditor.PositionProperty',
|
||||
'icon': 'openerp.web.ViewEditor.IconProperty',
|
||||
'align': 'openerp.web.ViewEditor.AlignProperty',
|
||||
'special': 'openerp.web.ViewEditor.ButtonSpecialProperty',
|
||||
'type': 'openerp.web.ViewEditor.ButtonTypeProperty',
|
||||
'target': 'openerp.web.ViewEditor.ButtonTargetProperty'
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1330,7 +1330,15 @@
|
|||
<t t-call="view_editor.row"/>
|
||||
</t>
|
||||
</tr>
|
||||
|
||||
<t t-name="vieweditor_char">
|
||||
<input type="text" t-att-id="widget.name" class="field_char" size="50"/>
|
||||
</t>
|
||||
<t t-name="vieweditor_selection">
|
||||
<select t-att-id="widget.name"/>
|
||||
</t>
|
||||
<t t-name="vieweditor_boolean">
|
||||
<input type="checkbox" t-att-id="widget.name"/>
|
||||
</t>
|
||||
<t t-name="ExportView">
|
||||
<a id="exportview" href="javascript: void(0)" style="text-decoration: none;color: #3D3D3D;">Export</a>
|
||||
</t>
|
||||
|
@ -1578,4 +1586,4 @@
|
|||
<t t-name="EmptyComponent">
|
||||
<div></div>
|
||||
</t>
|
||||
</templates>
|
||||
</templates>
|
|
@ -11,5 +11,8 @@
|
|||
"css": ['static/lib/dhtmlxScheduler/codebase/dhtmlxscheduler.css',
|
||||
'static/lib/dhtmlxScheduler/codebase/ext/dhtmlxscheduler_ext.css'
|
||||
],
|
||||
'qweb' : [
|
||||
"static/src/xml/*.xml",
|
||||
],
|
||||
'active': True
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
openerp.web_calendar = function(openerp) {
|
||||
var _t = openerp.web._t;
|
||||
var QWeb = openerp.web.qweb;
|
||||
QWeb.add_template('/web_calendar/static/src/xml/web_calendar.xml');
|
||||
openerp.web.views.add('calendar', 'openerp.web_calendar.CalendarView');
|
||||
openerp.web_calendar.CalendarView = openerp.web.View.extend({
|
||||
// Dhtmlx scheduler ?
|
||||
|
|
|
@ -7,5 +7,8 @@
|
|||
'static/src/js/dashboard.js'
|
||||
],
|
||||
"css": ['static/src/css/dashboard.css'],
|
||||
'qweb' : [
|
||||
"static/src/xml/*.xml",
|
||||
],
|
||||
'active': True
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
openerp.web_dashboard = function(openerp) {
|
||||
var QWeb = openerp.web.qweb;
|
||||
QWeb.add_template('/web_dashboard/static/src/xml/web_dashboard.xml');
|
||||
|
||||
if (!openerp.web_dashboard) {
|
||||
/** @namespace */
|
||||
|
|
|
@ -8,13 +8,13 @@ msgstr ""
|
|||
"Project-Id-Version: openerp-web\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2011-10-07 10:39+0200\n"
|
||||
"PO-Revision-Date: 2011-11-03 15:06+0000\n"
|
||||
"Last-Translator: kifcaliph <kifcaliph@hotmail.com>\n"
|
||||
"PO-Revision-Date: 2011-11-08 05:50+0000\n"
|
||||
"Last-Translator: Ahmad Khayyat <Unknown>\n"
|
||||
"Language-Team: Arabic <ar@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2011-11-04 05:32+0000\n"
|
||||
"X-Launchpad-Export-Date: 2011-11-08 06:12+0000\n"
|
||||
"X-Generator: Launchpad (build 14231)\n"
|
||||
|
||||
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
|
||||
|
@ -23,7 +23,7 @@ msgstr "أهلاً و مرحباً بك في OpenERP"
|
|||
|
||||
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
|
||||
msgid "Remember to bookmark this page."
|
||||
msgstr "لا تنسي إدراج هذه الصفحة ضمن المفضلات"
|
||||
msgstr "لا تنس إدراج هذه الصفحة ضمن المفضلات"
|
||||
|
||||
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
|
||||
msgid "Remember your login:"
|
||||
|
@ -31,7 +31,7 @@ msgstr "تذكر كلمة المرور"
|
|||
|
||||
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
|
||||
msgid "Choose the first OpenERP Application you want to install.."
|
||||
msgstr "اختر أول برنامج OpenERP للتثبيت"
|
||||
msgstr "اختر أول تطبيق OpenERP تود تثبيته"
|
||||
|
||||
#: addons/web_default_home/static/src/xml/web_default_home.xml:0
|
||||
msgid "Install"
|
||||
|
|
|
@ -13,5 +13,8 @@
|
|||
'css' : [
|
||||
"static/src/css/base_diagram.css",
|
||||
],
|
||||
'qweb' : [
|
||||
"static/src/xml/*.xml",
|
||||
],
|
||||
'active': True,
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
openerp.web_diagram = function (openerp) {
|
||||
var QWeb = openerp.web.qweb;
|
||||
QWeb.add_template('/web_diagram/static/src/xml/base_diagram.xml');
|
||||
openerp.web.views.add('diagram', 'openerp.web.DiagramView');
|
||||
openerp.web.DiagramView = openerp.web.View.extend({
|
||||
searchable: false,
|
||||
|
|
|
@ -9,5 +9,8 @@
|
|||
'static/src/js/gantt.js'
|
||||
],
|
||||
"css": ['static/lib/dhtmlxGantt/codebase/dhtmlxgantt.css'],
|
||||
'qweb' : [
|
||||
"static/src/xml/*.xml",
|
||||
],
|
||||
'active': True
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
*---------------------------------------------------------*/
|
||||
openerp.web_gantt = function (openerp) {
|
||||
var QWeb = openerp.web.qweb;
|
||||
QWeb.add_template('/web_gantt/static/src/xml/web_gantt.xml');
|
||||
openerp.web.views.add('gantt', 'openerp.web_gantt.GanttView');
|
||||
openerp.web_gantt.GanttView = openerp.web.View.extend({
|
||||
|
||||
|
|
|
@ -7,5 +7,8 @@
|
|||
"static/lib/dhtmlxGraph/codebase/dhtmlxchart_debug.js",
|
||||
"static/src/js/graph.js"],
|
||||
"css": ["static/lib/dhtmlxGraph/codebase/dhtmlxchart.css"],
|
||||
'qweb' : [
|
||||
"static/src/xml/*.xml",
|
||||
],
|
||||
"active": True
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ var COLOR_PALETTE = [
|
|||
'#cc0000', '#d400a8'];
|
||||
|
||||
var QWeb = openerp.web.qweb;
|
||||
QWeb.add_template('/web_graph/static/src/xml/web_graph.xml');
|
||||
openerp.web.views.add('graph', 'openerp.web_graph.GraphView');
|
||||
openerp.web_graph.GraphView = openerp.web.View.extend({
|
||||
|
||||
|
|
|
@ -9,5 +9,8 @@
|
|||
"css": [
|
||||
"static/src/css/kanban.css"
|
||||
],
|
||||
'qweb' : [
|
||||
"static/src/xml/*.xml",
|
||||
],
|
||||
'active': True
|
||||
}
|
||||
|
|
|
@ -278,12 +278,18 @@
|
|||
border-color: #D979C1;
|
||||
}
|
||||
|
||||
/* Alert color */
|
||||
.openerp .oe_kanban_color_alert .oe_kanban_color_border {
|
||||
/* Red border */
|
||||
.openerp .oe_kanban_color_alert .oe_kanban_color_border,
|
||||
.openerp .oe_kanban_color_red .oe_kanban_color_border {
|
||||
border-color: #c00 !important;
|
||||
}
|
||||
|
||||
/* Green color */
|
||||
/* Green border */
|
||||
.openerp .oe_kanban_color_green .oe_kanban_color_border {
|
||||
border-color: #0c0 !important;
|
||||
}
|
||||
|
||||
/* Blue border */
|
||||
.openerp .oe_kanban_color_blue .oe_kanban_color_border {
|
||||
border-color: #00c !important;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ openerp.web_kanban = function (openerp) {
|
|||
|
||||
var _t = openerp.web._t;
|
||||
var QWeb = openerp.web.qweb;
|
||||
QWeb.add_template('/web_kanban/static/src/xml/web_kanban.xml');
|
||||
openerp.web.views.add('kanban', 'openerp.web_kanban.KanbanView');
|
||||
|
||||
openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
||||
|
@ -25,7 +24,7 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
|||
this.form_dialog.on_form_dialog_saved.add_last(this.do_reload);
|
||||
this.aggregates = {};
|
||||
this.qweb = new QWeb2.Engine();
|
||||
this.qweb.debug = (window.location.search.indexOf('?debug') !== -1);
|
||||
this.qweb.debug = openerp.connection.debug;
|
||||
this.qweb.default_dict = {
|
||||
'_' : _,
|
||||
'_t' : _t
|
||||
|
@ -53,17 +52,8 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
|||
this.has_been_loaded.resolve();
|
||||
},
|
||||
add_qweb_template: function() {
|
||||
var group_operator = ['avg', 'max', 'min', 'sum', 'count']
|
||||
for (var i=0, ii=this.fields_view.arch.children.length; i < ii; i++) {
|
||||
var child = this.fields_view.arch.children[i];
|
||||
if (child.tag === "field") {
|
||||
for(j=0, jj=group_operator.length; j < jj; j++) {
|
||||
if (child.attrs[group_operator[j]]) {
|
||||
this.aggregates[child.attrs.name] = child.attrs[group_operator[j]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (child.tag === "templates") {
|
||||
this.transform_qweb_template(child);
|
||||
this.qweb.add_template(openerp.web.json_node_to_xml(child));
|
||||
|
@ -72,18 +62,25 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
|||
}
|
||||
},
|
||||
transform_qweb_template: function(node) {
|
||||
var qweb_prefix = QWeb.prefix;
|
||||
var qweb_prefix = QWeb.prefix,
|
||||
group_operator = ['avg', 'max', 'min', 'sum', 'count'];
|
||||
switch (node.tag) {
|
||||
case 'field':
|
||||
node.tag = 't';
|
||||
node.attrs['t-esc'] = 'record.' + node.attrs['name'] + '.value';
|
||||
node.tag = qweb_prefix;
|
||||
node.attrs[qweb_prefix + '-esc'] = 'record.' + node.attrs['name'] + '.value';
|
||||
for (var j = 0, jj = group_operator.length; j < jj; j++) {
|
||||
if (node.attrs[group_operator[j]]) {
|
||||
this.aggregates[node.attrs.name] = node.attrs[group_operator[j]];
|
||||
break;
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'button':
|
||||
case 'a':
|
||||
var type = node.attrs.type || '';
|
||||
if (_.indexOf('action,object,edit,delete,color'.split(','), type) !== -1) {
|
||||
_.each(node.attrs, function(v, k) {
|
||||
if (_.indexOf('icon,type,name,string,context,states'.split(','), k) != -1) {
|
||||
if (_.indexOf('icon,type,name,string,context,states,kanban_states'.split(','), k) != -1) {
|
||||
node.attrs['data-' + k] = v;
|
||||
delete(node.attrs[k]);
|
||||
}
|
||||
|
@ -92,7 +89,13 @@ openerp.web_kanban.KanbanView = openerp.web.View.extend({
|
|||
var states = _.map(node.attrs['data-states'].split(','), function(state) {
|
||||
return "record.state.raw_value == '" + _.trim(state) + "'";
|
||||
});
|
||||
node.attrs['t-if'] = states.join(' or ');
|
||||
node.attrs[qweb_prefix + '-if'] = states.join(' or ');
|
||||
}
|
||||
if (node.attrs['data-kanban_states']) {
|
||||
var states = _.map(node.attrs['data-kanban_states'].split(','), function(state) {
|
||||
return "record.kanban_state.raw_value == '" + _.trim(state) + "'";
|
||||
});
|
||||
node.attrs[qweb_prefix + '-if'] = states.join(' or ');
|
||||
}
|
||||
if (node.attrs['data-string']) {
|
||||
node.attrs.title = node.attrs['data-string'];
|
||||
|
|
Loading…
Reference in New Issue