[IMP] Use context in website's js rpc calls

bzr revid: fme@openerp.com-20130911161854-zhm53dugiisychfb
This commit is contained in:
Fabien Meghazi 2013-09-11 18:18:54 +02:00
parent 1bcae6b62f
commit 3f4d64b1f0
4 changed files with 16 additions and 5 deletions

View File

@ -99,7 +99,7 @@
openerp.jsonRpc('/web/dataset/call', 'call', {
model: 'ir.ui.view',
method: 'read',
args: [[this.selectedViewId()], ['arch']],
args: [[this.selectedViewId()], ['arch'], website.get_context()],
}).then(function(result) {
if (result && result.length > 0) {
var xml = new website.ace.XmlDocument(result[0].arch)
@ -123,7 +123,7 @@
openerp.jsonRpc('/web/dataset/call', 'call', {
model: 'ir.ui.view',
method: 'write',
args: [[this.selectedViewId()], { 'arch': xml.xml }],
args: [[this.selectedViewId()], { 'arch': xml.xml }, website.get_context()],
}).then(function(result) {
self.reloadPage();
}).fail(function (error) {

View File

@ -264,7 +264,7 @@
return openerp.jsonRpc('/web/dataset/call', 'call', {
model: 'ir.ui.view',
method: 'save',
args: [data.oeModel, data.oeId, data.oeField, html, xpath]
args: [data.oeModel, data.oeId, data.oeField, html, xpath, website.get_context()]
});
},
cancel: function () {
@ -549,7 +549,9 @@
model: 'website',
method: 'list_pages',
args: [],
kwargs: {}
kwargs: {
context: website.get_context()
},
});
},
fill_pages: function (results) {
@ -653,6 +655,7 @@
fields: ['name'],
domain: [['res_model', '=', 'ir.ui.view']],
order: 'name',
context: website.get_context(),
}
});
},

View File

@ -9,6 +9,12 @@
'/website/static/src/xml/website.xml'
];
website.get_context = function (dict) {
return _.extend({
lang: $('html').attr('lang').replace('-', '_')
}, dict);
};
/* ----- TEMPLATE LOADING ---- */
website.add_template = function(template) {
templates.push(template);

View File

@ -13,7 +13,9 @@
<template id="layout">
&lt;!DOCTYPE html&gt;
<html t-att-data-editable="'1' if editable else '0'" t-att-data-view-xmlid="str(__stack__[0])">
<html t-att-lang="lang.replace('_', '-')"
t-att-data-editable="'1' if editable else '0'"
t-att-data-view-xmlid="str(__stack__[0])">
<head>
<title><t t-esc="title or res_company.name"/></title>
<meta name="openerp.company" t-att-value="res_company.name" />