[REF] website, *: add automatic context for call_kw rpc
* web_editor, website_blog, website_crm_partner_assign, website_links, website_livechat, website_mail_channel, website_mass_mailing, website_slides Calling a model's method thanks to an RPC will now always send the web_editor context automatically, making sure the method gets the website_id all the time, removing the need to guess the current website (now the get_current_website method uses the context website_id if any). Note: other routes already have the website_id via request.env.context if they correctly set website=True (this commit also adds website=True for scss files customization routes).
This commit is contained in:
@@ -140,7 +140,7 @@ class Web_Editor(http.Controller):
|
||||
#------------------------------------------------------
|
||||
# add attachment (images or link)
|
||||
#------------------------------------------------------
|
||||
@http.route('/web_editor/attachment/add', type='http', auth='user', methods=['POST'])
|
||||
@http.route('/web_editor/attachment/add', type='http', auth='user', methods=['POST'], website=True)
|
||||
def attach(self, upload=None, url=None, disable_optimization=None, filters=None, **kwargs):
|
||||
# the upload argument doesn't allow us to access the files if more than
|
||||
# one file is uploaded, as upload references the first file
|
||||
@@ -215,7 +215,7 @@ class Web_Editor(http.Controller):
|
||||
#------------------------------------------------------
|
||||
# remove attachment (images or link)
|
||||
#------------------------------------------------------
|
||||
@http.route('/web_editor/attachment/remove', type='json', auth='user')
|
||||
@http.route('/web_editor/attachment/remove', type='json', auth='user', website=True)
|
||||
def remove(self, ids, **kwargs):
|
||||
""" Removes a web-based image attachment if it is used by no view (template)
|
||||
|
||||
@@ -249,7 +249,7 @@ class Web_Editor(http.Controller):
|
||||
## This route is used from CropImageDialog to get image info.
|
||||
## It is used to display the original image when we crop a previously
|
||||
## cropped image
|
||||
@http.route('/web_editor/get_image_info', type='json', auth='user')
|
||||
@http.route('/web_editor/get_image_info', type='json', auth='user', website=True)
|
||||
def get_image_info(self, image_id=None, xml_id=None):
|
||||
if xml_id:
|
||||
record = request.env.ref(xml_id)
|
||||
@@ -390,7 +390,7 @@ class Web_Editor(http.Controller):
|
||||
## @param url - the original url of the scss file which has to be modified
|
||||
## @param bundle_xmlid - the xmlid of the bundle in which the scss file addition can be found
|
||||
## @param content - the new content of the scss file
|
||||
@http.route("/web_editor/save_scss", type="json", auth="user")
|
||||
@http.route("/web_editor/save_scss", type="json", auth="user", website=True)
|
||||
def save_scss(self, url, bundle_xmlid, content):
|
||||
IrAttachment = request.env["ir.attachment"]
|
||||
|
||||
@@ -444,7 +444,7 @@ class Web_Editor(http.Controller):
|
||||
## The reset_scss route is in charge of reverting all the changes that were done to a scss file.
|
||||
## @param url - the original URL of the scss file to reset
|
||||
## @param bundle_xmlid - the xmlid of the bundle in which the scss file addition can be found
|
||||
@http.route("/web_editor/reset_scss", type="json", auth="user")
|
||||
@http.route("/web_editor/reset_scss", type="json", auth="user", website=True)
|
||||
def reset_scss(self, url, bundle_xmlid):
|
||||
custom_url = self._make_custom_scss_file_url(url, bundle_xmlid)
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
odoo.define('web_editor.BodyManager', function (require) {
|
||||
'use strict';
|
||||
|
||||
var weContext = require('web_editor.context');
|
||||
var rootWidget = require('web_editor.root_widget');
|
||||
var ServiceProviderMixin = require('web.ServiceProviderMixin');
|
||||
var session = require('web.session');
|
||||
@@ -28,6 +29,27 @@ var BodyManager = rootWidget.RootWidget.extend(ServiceProviderMixin, {
|
||||
session.is_bound
|
||||
);
|
||||
},
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Private
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Automatically add the web_editor context.
|
||||
*
|
||||
* @override
|
||||
*/
|
||||
_call_service: function (event) {
|
||||
if (event.data.service === 'ajax' && event.data.method === 'rpc') {
|
||||
var route = event.data.args[0];
|
||||
if (_.str.startsWith(route, '/web/dataset/call_kw/')) {
|
||||
var params = event.data.args[1];
|
||||
params.kwargs.context = _.extend({}, weContext.get(), params.kwargs.context || {});
|
||||
params.kwargs.context = JSON.parse(JSON.stringify(params.kwargs.context));
|
||||
}
|
||||
}
|
||||
return ServiceProviderMixin._call_service.apply(this, arguments);
|
||||
},
|
||||
});
|
||||
return BodyManager;
|
||||
});
|
||||
|
||||
@@ -573,8 +573,8 @@ var RTEWidget = Widget.extend({
|
||||
$el.data('oe-id'),
|
||||
this._getEscapedElement($el).prop('outerHTML'),
|
||||
$el.data('oe-xpath') || null,
|
||||
withLang ? context : _.omit(context, 'lang')
|
||||
],
|
||||
context: withLang ? context : _.extend({}, context, {lang: undefined}),
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
@@ -1236,7 +1236,6 @@ registry.many2one = SnippetOption.extend({
|
||||
kwargs: {
|
||||
order: [{name: 'name', asc: false}],
|
||||
limit: 5,
|
||||
context: weContext.get(),
|
||||
},
|
||||
}).then(function (result) {
|
||||
self.$search.siblings().remove();
|
||||
@@ -1275,7 +1274,6 @@ registry.many2one = SnippetOption.extend({
|
||||
args: [[self.ID]],
|
||||
kwargs: {
|
||||
options: options,
|
||||
context: weContext.get(),
|
||||
},
|
||||
}).then(function (html) {
|
||||
$node.html(html);
|
||||
|
||||
@@ -34,12 +34,12 @@ var RTETranslatorWidget = rte.Class.extend({
|
||||
method: 'save_html',
|
||||
args: [
|
||||
[+$el.data('oe-translation-id')],
|
||||
this._getEscapedElement($el).html(),
|
||||
context || weContext.get()
|
||||
this._getEscapedElement($el).html()
|
||||
],
|
||||
context: context,
|
||||
}).fail(function (error) {
|
||||
Dialog.alert(null, error.data.message);
|
||||
});
|
||||
Dialog.alert(null, error.data.message);
|
||||
});
|
||||
}
|
||||
return this._super($el, context, withLang === undefined ? true : withLang);
|
||||
},
|
||||
|
||||
@@ -593,7 +593,8 @@ var ViewEditor = Widget.extend({
|
||||
this._rpc({
|
||||
model: 'ir.ui.view',
|
||||
method: 'write',
|
||||
args: [[session.id], {arch: session.text}, _.extend(weContext.get(), {lang: null})],
|
||||
args: [[session.id], {arch: session.text}],
|
||||
context: _.extend({}, weContext.get(), {lang: undefined}),
|
||||
}).then(function () {
|
||||
self._toggleDirtyInfo(session.id, 'xml', false);
|
||||
def.resolve();
|
||||
|
||||
@@ -447,6 +447,10 @@ class Website(models.Model):
|
||||
if request and request.session.get('force_website_id'):
|
||||
return self.browse(request.session['force_website_id'])
|
||||
|
||||
website_id = self.env.context.get('website_id')
|
||||
if website_id:
|
||||
return self.browse(website_id)
|
||||
|
||||
domain_name = request and request.httprequest.environ.get('HTTP_HOST', '').split(':')[0] or None
|
||||
|
||||
country = request.session.geoip.get('country_code') if request and request.session.geoip else False
|
||||
|
||||
@@ -76,13 +76,11 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
willStart: function () {
|
||||
var defs = [this._super.apply(this, arguments)];
|
||||
var self = this;
|
||||
var context = weContext.get();
|
||||
|
||||
defs.push(this._rpc({
|
||||
model: 'website.page',
|
||||
method: 'get_page_info',
|
||||
args: [this.page_id],
|
||||
context: context,
|
||||
}).then(function (page) {
|
||||
page[0].url = _.str.startsWith(page[0].url, '/') ? page[0].url.substring(1) : page[0].url;
|
||||
self.page = page[0];
|
||||
@@ -102,7 +100,6 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
*/
|
||||
start: function () {
|
||||
var self = this;
|
||||
var context = weContext.get();
|
||||
|
||||
var defs = [this._super.apply(this, arguments)];
|
||||
|
||||
@@ -110,7 +107,7 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
this.$('.redirect_type').addClass('d-none');
|
||||
this.$('.warn_about_call').addClass('d-none');
|
||||
|
||||
defs.push(this._getPageDependencies(this.page_id, context)
|
||||
defs.push(this._getPageDependencies(this.page_id)
|
||||
.then(function (dependencies) {
|
||||
var dep_text = [];
|
||||
_.each(dependencies, function (value, index) {
|
||||
@@ -125,12 +122,12 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
});
|
||||
}));
|
||||
|
||||
defs.push(this._getSupportedMimetype(context)
|
||||
defs.push(this._getSupportedMimetype()
|
||||
.then(function (mimetypes) {
|
||||
self.supportedMimetype = mimetypes;
|
||||
}));
|
||||
|
||||
defs.push(this._getPageKeyDependencies(this.page_id, context)
|
||||
defs.push(this._getPageKeyDependencies(this.page_id)
|
||||
.then(function (dependencies) {
|
||||
var dep_text = [];
|
||||
_.each(dependencies, function (value, index) {
|
||||
@@ -147,8 +144,7 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
|
||||
defs.push(this._rpc({model: 'res.users',
|
||||
method: 'has_group',
|
||||
args: ['website.group_multi_website'],
|
||||
context: context})
|
||||
args: ['website.group_multi_website']})
|
||||
.then(function (has_group) {
|
||||
if (!has_group) {
|
||||
self.$('#website_restriction').addClass('hidden');
|
||||
@@ -229,7 +225,6 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
model: 'website.page',
|
||||
method: 'save_page_info',
|
||||
args: [[context.website_id], params],
|
||||
context: context,
|
||||
}).then(function (url) {
|
||||
// If from page manager: reload url, if from page itself: go to
|
||||
// (possibly) new url
|
||||
@@ -256,15 +251,13 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
*
|
||||
* @private
|
||||
* @param {integer} moID
|
||||
* @param {Object} context
|
||||
* @returns {Deferred<Array>}
|
||||
*/
|
||||
_getPageDependencies: function (moID, context) {
|
||||
_getPageDependencies: function (moID) {
|
||||
return this._rpc({
|
||||
model: 'website',
|
||||
method: 'page_search_dependencies',
|
||||
args: [moID],
|
||||
context: context,
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -272,29 +265,25 @@ var PagePropertiesDialog = weWidgets.Dialog.extend({
|
||||
*
|
||||
* @private
|
||||
* @param {integer} moID
|
||||
* @param {Object} context
|
||||
* @returns {Deferred<Array>}
|
||||
*/
|
||||
_getPageKeyDependencies: function (moID, context) {
|
||||
_getPageKeyDependencies: function (moID) {
|
||||
return this._rpc({
|
||||
model: 'website',
|
||||
method: 'page_search_key_dependencies',
|
||||
args: [moID],
|
||||
context: context,
|
||||
});
|
||||
},
|
||||
/**
|
||||
* Retrieves supported mimtype
|
||||
*
|
||||
* @private
|
||||
* @param {Object} context
|
||||
* @returns {Deferred<Array>}
|
||||
*/
|
||||
_getSupportedMimetype: function (context) {
|
||||
_getSupportedMimetype: function () {
|
||||
return this._rpc({
|
||||
model: 'website',
|
||||
method: 'guess_mimetype',
|
||||
context: context,
|
||||
});
|
||||
},
|
||||
/**
|
||||
@@ -483,7 +472,6 @@ var EditMenuDialog = weWidgets.Dialog.extend({
|
||||
model: 'website.menu',
|
||||
method: 'get_tree',
|
||||
args: [context.website_id, this.rootID],
|
||||
context: context,
|
||||
}).then(function (menu) {
|
||||
self.menu = menu;
|
||||
self.root_menu_id = menu.id;
|
||||
@@ -542,7 +530,6 @@ var EditMenuDialog = weWidgets.Dialog.extend({
|
||||
model: 'website.menu',
|
||||
method: 'save',
|
||||
args: [context.website_id, { data: data, to_delete: self.to_delete }],
|
||||
context: context,
|
||||
}).then(function () {
|
||||
return _super();
|
||||
});
|
||||
@@ -892,15 +879,13 @@ var PageManagement = Widget.extend({
|
||||
*
|
||||
* @private
|
||||
* @param {integer} moID
|
||||
* @param {Object} context
|
||||
* @returns {Deferred<Array>}
|
||||
*/
|
||||
_getPageDependencies: function (moID, context) {
|
||||
_getPageDependencies: function (moID) {
|
||||
return this._rpc({
|
||||
model: 'website',
|
||||
method: 'page_search_dependencies',
|
||||
args: [moID],
|
||||
context: context,
|
||||
});
|
||||
},
|
||||
|
||||
@@ -915,14 +900,10 @@ var PageManagement = Widget.extend({
|
||||
},
|
||||
_onClonePageButtonClick: function (ev) {
|
||||
var pageId = $(ev.currentTarget).data('id');
|
||||
var context = weContext.get();
|
||||
this._rpc({
|
||||
model: 'website.page',
|
||||
method: 'clone_page',
|
||||
args: [pageId],
|
||||
kwargs: {
|
||||
context: context,
|
||||
},
|
||||
}).then(function (path) {
|
||||
window.location.href = path;
|
||||
});
|
||||
@@ -945,11 +926,10 @@ var PageManagement = Widget.extend({
|
||||
// TODO: This function should be integrated in a widget in the future
|
||||
function _deletePage(pageId, fromPageManagement) {
|
||||
var self = this;
|
||||
var context = weContext.get();
|
||||
var def = $.Deferred();
|
||||
|
||||
// Search the page dependencies
|
||||
this._getPageDependencies(pageId, context)
|
||||
this._getPageDependencies(pageId)
|
||||
.then(function (dependencies) {
|
||||
// Inform the user about those dependencies and ask him confirmation
|
||||
var confirmDef = $.Deferred();
|
||||
@@ -966,7 +946,6 @@ function _deletePage(pageId, fromPageManagement) {
|
||||
model: 'website.page',
|
||||
method: 'unlink',
|
||||
args: [pageId],
|
||||
context: context,
|
||||
});
|
||||
}).then(function () {
|
||||
if (fromPageManagement) {
|
||||
|
||||
@@ -3,7 +3,6 @@ odoo.define('website.customizeMenu', function (require) {
|
||||
|
||||
var core = require('web.core');
|
||||
var Widget = require('web.Widget');
|
||||
var weContext = require('web_editor.context');
|
||||
var websiteNavbarData = require('website.navbar');
|
||||
var WebsiteAceEditor = require('website.ace');
|
||||
|
||||
@@ -49,7 +48,6 @@ var CustomizeMenu = Widget.extend({
|
||||
model: 'ir.ui.view',
|
||||
method: 'toggle',
|
||||
args: [[viewID]],
|
||||
context: weContext.get(),
|
||||
}).then(function () {
|
||||
window.location.reload();
|
||||
return $.Deferred();
|
||||
|
||||
@@ -479,7 +479,6 @@ var MetaKeywords = Widget.extend({
|
||||
model: 'website',
|
||||
method: 'get_languages',
|
||||
args: [[weContext.get().website_id]],
|
||||
context: weContext.get(),
|
||||
}).then( function (data) {
|
||||
self.$('#language-box').html(core.qweb.render('Configurator.language_promote', {
|
||||
'language': data,
|
||||
@@ -676,7 +675,7 @@ var SeoConfigurator = Dialog.extend({
|
||||
// - no reload if we are not editing a view (condition: website_id === undefined)
|
||||
// - reload if generic page (condition: website_id === false)
|
||||
self.reloadOnSave = data.website_id === undefined ? false : !data.website_id;
|
||||
//If website.page, hide the google preview & tell user his page is currently unindexed
|
||||
//If website.page, hide the google preview & tell user his page is currently unindexed
|
||||
self.isIndexed = (data && ('website_indexed' in data)) ? data.website_indexed : true;
|
||||
self.canEditTitle = data && ('website_meta_title' in data);
|
||||
self.canEditDescription = data && ('website_meta_description' in data);
|
||||
@@ -745,7 +744,7 @@ var SeoConfigurator = Dialog.extend({
|
||||
rpc.query({
|
||||
model: obj.model,
|
||||
method: 'read',
|
||||
args: [[obj.id], fields, weContext.get()],
|
||||
args: [[obj.id], fields],
|
||||
}).then(function (data) {
|
||||
if (data.length) {
|
||||
var meta = data[0];
|
||||
@@ -768,7 +767,7 @@ var SeoConfigurator = Dialog.extend({
|
||||
return rpc.query({
|
||||
model: obj.model,
|
||||
method: 'write',
|
||||
args: [[obj.id], data, weContext.get()],
|
||||
args: [[obj.id], data],
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,7 +3,6 @@ odoo.define('website.utils', function (require) {
|
||||
|
||||
var ajax = require('web.ajax');
|
||||
var core = require('web.core');
|
||||
var weContext = require('web_editor.context');
|
||||
|
||||
var qweb = core.qweb;
|
||||
|
||||
@@ -22,7 +21,6 @@ function autocompleteWithPages(self, $input) {
|
||||
args: [null, request.term],
|
||||
kwargs: {
|
||||
limit: 15,
|
||||
context: weContext.get(),
|
||||
},
|
||||
}).then(function (exists) {
|
||||
var rs = _.map(exists, function (r) {
|
||||
|
||||
@@ -5,7 +5,6 @@ var config = require('web.config');
|
||||
var core = require('web.core');
|
||||
var ColorpickerDialog = require('web.colorpicker');
|
||||
var Dialog = require('web.Dialog');
|
||||
var weContext = require('web_editor.context');
|
||||
var widgets = require('web_editor.widget');
|
||||
var websiteNavbarData = require('website.navbar');
|
||||
|
||||
@@ -44,7 +43,7 @@ var ThemeCustomizeDialog = Dialog.extend({
|
||||
templateDef = this._rpc({
|
||||
model: 'ir.ui.view',
|
||||
method: 'read_template',
|
||||
args: ['website.theme_customize', weContext.get()],
|
||||
args: ['website.theme_customize'],
|
||||
}).then(function (data) {
|
||||
return core.qweb.add_template(data);
|
||||
});
|
||||
@@ -313,7 +312,6 @@ var ThemeCustomizeDialog = Dialog.extend({
|
||||
data[1],
|
||||
'#wrapwrap { background-image: url("' + src + '"); }',
|
||||
'//style',
|
||||
weContext.get(),
|
||||
],
|
||||
});
|
||||
}).then(function () {
|
||||
|
||||
@@ -2,7 +2,6 @@ odoo.define('website_blog.new_blog_post', function (require) {
|
||||
'use strict';
|
||||
|
||||
var core = require('web.core');
|
||||
var weContext = require('web_editor.context');
|
||||
var wUtils = require('website.utils');
|
||||
var WebsiteNewMenu = require('website.newMenu');
|
||||
|
||||
@@ -28,7 +27,6 @@ WebsiteNewMenu.include({
|
||||
return this._rpc({
|
||||
model: 'blog.blog',
|
||||
method: 'name_search',
|
||||
context: weContext.get(),
|
||||
}).then(function (blog_ids) {
|
||||
if (blog_ids.length === 1) {
|
||||
document.location = '/blog/' + blog_ids[0][0] + '/post/new';
|
||||
|
||||
@@ -2,6 +2,7 @@ odoo.define('crm.partner_assign', function (require) {
|
||||
'use strict';
|
||||
|
||||
var rpc = require('web.rpc');
|
||||
var weContext = require('web_editor.context');
|
||||
require('web.dom_ready');
|
||||
/*
|
||||
* This file is intended to add interactivity to survey forms rendered by
|
||||
@@ -28,6 +29,7 @@ $('.interested_partner_assign_confirm').on('click',function(e){
|
||||
[parseInt($('.interested_partner_assign_form .assign_lead_id').val())],
|
||||
$('.interested_partner_assign_form .comment_interested').val()
|
||||
],
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
})
|
||||
.then(function(){
|
||||
window.location.href = '/my/leads';
|
||||
@@ -54,6 +56,7 @@ $('.desinterested_partner_assign_confirm').on('click',function(){
|
||||
$('.desinterested_partner_assign_form .contacted_desinterested').prop('checked'),
|
||||
$('.desinterested_partner_assign_form .customer_mark_spam').prop('checked'),
|
||||
],
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
})
|
||||
.then(function(){
|
||||
window.location.href = '/my/leads';
|
||||
@@ -72,7 +75,7 @@ opp_stage_buttons.on('click',function(e){
|
||||
args: [[parseInt(e.currentTarget.getAttribute('opp'))],{
|
||||
stage_id: parseInt(e.currentTarget.getAttribute('data')),
|
||||
},],
|
||||
context: {website_partner_assign:1},
|
||||
context: _.extend({website_partner_assign:1}, weContext.get()), // TODO use this._rpc
|
||||
})
|
||||
.fail(function() {
|
||||
$btn.prop('disabled', false);
|
||||
@@ -106,6 +109,7 @@ $('.edit_contact_confirm').on('click',function(){
|
||||
state_id: parseInt($('.edit_contact_form .state_id').find(":selected").attr('value')),
|
||||
country_id: parseInt($('.edit_contact_form .country_id').find(":selected").attr('value')),
|
||||
}],
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
})
|
||||
.fail(function() {
|
||||
$btn.prop('disabled', false);
|
||||
@@ -127,6 +131,7 @@ $('.new_opp_confirm').on('click',function(e){
|
||||
title: $('.new_opp_form .title').val(),
|
||||
description: $('.new_opp_form .description').val(),
|
||||
}],
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
})
|
||||
.done(function(response){
|
||||
if (response.errors) {
|
||||
@@ -160,6 +165,7 @@ $('.edit_opp_confirm').on('click',function(){
|
||||
activity_date_deadline: $('.edit_opp_form .activity_date_deadline').val(),
|
||||
priority: $('input[name="PriorityRadioOptions"]:checked').val(),
|
||||
}],
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
})
|
||||
.fail(function() {
|
||||
$btn.prop('disabled', false);
|
||||
|
||||
@@ -7,6 +7,7 @@ var core = require('web.core');
|
||||
var rpc = require('web.rpc');
|
||||
var Widget = require('web.Widget');
|
||||
var base = require('web_editor.base');
|
||||
var weContext = require('web_editor.context');
|
||||
|
||||
var qweb = core.qweb;
|
||||
var _t = core._t;
|
||||
@@ -51,6 +52,7 @@ if (!$('.o_website_links_create_tracked_url').length) {
|
||||
return rpc.query({
|
||||
model: this.obj,
|
||||
method: 'search_read',
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
})
|
||||
.then(function (result) {
|
||||
return _.map(result, function (val) {
|
||||
@@ -75,6 +77,7 @@ if (!$('.o_website_links_create_tracked_url').length) {
|
||||
model: this.obj,
|
||||
method: 'create',
|
||||
args: [{name:name}],
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
})
|
||||
.then(function (record) {
|
||||
self.element.attr('value', record);
|
||||
|
||||
@@ -5,6 +5,7 @@ require('web.dom_ready');
|
||||
var rpc = require('web.rpc');
|
||||
var Widget = require('web.Widget');
|
||||
var base = require('web_editor.base');
|
||||
var weContext = require('web_editor.context');
|
||||
var core = require('web.core');
|
||||
|
||||
var _t = core._t;
|
||||
@@ -139,6 +140,7 @@ if (!$('.o_website_links_chart').length) {
|
||||
model: 'link.tracker.click',
|
||||
method: 'search_count',
|
||||
args: [[links_domain]],
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
});
|
||||
};
|
||||
|
||||
@@ -148,6 +150,7 @@ if (!$('.o_website_links_chart').length) {
|
||||
method: 'read_group',
|
||||
args: [[links_domain], ['create_date']],
|
||||
kwargs: {groupby:'create_date:day'},
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
});
|
||||
};
|
||||
|
||||
@@ -157,6 +160,7 @@ if (!$('.o_website_links_chart').length) {
|
||||
method: 'read_group',
|
||||
args: [[links_domain], ['country_id']],
|
||||
kwargs: {groupby:'country_id'},
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
});
|
||||
};
|
||||
|
||||
@@ -167,6 +171,7 @@ if (!$('.o_website_links_chart').length) {
|
||||
method: 'read_group',
|
||||
args: [[links_domain, ['create_date', '>', interval]], ['country_id']],
|
||||
kwargs: {groupby:'country_id'},
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
});
|
||||
};
|
||||
|
||||
@@ -177,6 +182,7 @@ if (!$('.o_website_links_chart').length) {
|
||||
method: 'read_group',
|
||||
args: [[links_domain, ['create_date', '>', interval]], ['country_id']],
|
||||
kwargs: {groupby: 'country_id'},
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ odoo.define('website_livechat.editor', function (require) {
|
||||
var core = require('web.core');
|
||||
var wUtils = require('website.utils');
|
||||
var WebsiteNewMenu = require('website.newMenu');
|
||||
var weContext = require('web_editor.context');
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
@@ -36,7 +35,6 @@ WebsiteNewMenu.include({
|
||||
return self._rpc({
|
||||
model: 'im_livechat.channel',
|
||||
method: 'create_and_get_website_url',
|
||||
context: weContext.get(),
|
||||
args: [[]],
|
||||
kwargs: {
|
||||
name: name,
|
||||
|
||||
@@ -21,7 +21,7 @@ options.registry.subscribe = options.Class.extend({
|
||||
model: 'mail.channel',
|
||||
method: 'name_search',
|
||||
args: ['', [['public','=','public']]],
|
||||
context: weContext.get(),
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
});
|
||||
},
|
||||
}).then(function (mail_channel_id) {
|
||||
|
||||
@@ -24,7 +24,7 @@ var mass_mailing_common = options.Class.extend({
|
||||
model: 'mail.mass_mailing.list',
|
||||
method: 'name_search',
|
||||
args: ['', []],
|
||||
context: weContext.get(),
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -54,10 +54,10 @@ options.registry.newsletter_popup = mass_mailing_common.extend({
|
||||
select_mailing_list: function (previewMode, value) {
|
||||
var self = this;
|
||||
return this._super(previewMode, value).then(function (mailing_list_id) {
|
||||
ajax.jsonRpc('/web/dataset/call', 'call', {
|
||||
self._rpc({
|
||||
model: 'mail.mass_mailing.list',
|
||||
method: 'read',
|
||||
args: [[parseInt(mailing_list_id)], ['popup_content'], weContext.get()],
|
||||
args: [[parseInt(mailing_list_id)], ['popup_content']],
|
||||
}).then(function (data) {
|
||||
self.$target.find(".o_popup_content_dev").empty();
|
||||
if (data && data[0].popup_content) {
|
||||
@@ -84,13 +84,12 @@ web_editor.Class.include({
|
||||
}
|
||||
var content = $('#wrapwrap .o_popup_content_dev').html();
|
||||
var newsletter_id = $target.parent().attr('data-list-id');
|
||||
ajax.jsonRpc('/web/dataset/call', 'call', {
|
||||
this._rpc({
|
||||
model: 'mail.mass_mailing.list',
|
||||
method: 'write',
|
||||
args: [
|
||||
parseInt(newsletter_id),
|
||||
{'popup_content':content},
|
||||
weContext.get()
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
@@ -70,7 +70,9 @@ var SlideDialog = Widget.extend({
|
||||
model: 'slide.slide',
|
||||
method: 'search_count',
|
||||
args: [[['channel_id', '=', self.channel_id], ['name', '=', file_name]]],
|
||||
kwargs: {}
|
||||
kwargs: {
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
}
|
||||
});
|
||||
},
|
||||
slide_upload: function (ev) {
|
||||
@@ -258,7 +260,7 @@ var SlideDialog = Widget.extend({
|
||||
kwargs: {
|
||||
fields: ['name'],
|
||||
domain: [['channel_id', '=', self.channel_id]],
|
||||
context: weContext.get()
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
}
|
||||
});
|
||||
}));
|
||||
@@ -279,7 +281,7 @@ var SlideDialog = Widget.extend({
|
||||
args: [],
|
||||
kwargs: {
|
||||
fields: ['name'],
|
||||
context: weContext.get()
|
||||
context: weContext.get(), // TODO use this._rpc
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
@@ -5,7 +5,6 @@ var core = require('web.core');
|
||||
var Dialog = require('web.Dialog');
|
||||
var QWeb = core.qweb;
|
||||
var WebsiteNewMenu = require('website.newMenu');
|
||||
var weContext = require('web_editor.context');
|
||||
|
||||
var _t = core._t;
|
||||
|
||||
@@ -33,7 +32,6 @@ WebsiteNewMenu.include({
|
||||
return this._rpc({
|
||||
model: 'slide.channel',
|
||||
method: 'list_all',
|
||||
context: weContext.get(),
|
||||
args: [[]],
|
||||
}).then(function (data) {
|
||||
var def = $.Deferred();
|
||||
|
||||
Reference in New Issue
Block a user