Merge lp:openobject-addons

bzr revid: jam@tinyerp.com-20120827042850-taxag4eede9p8kyb
This commit is contained in:
Jigar Amin - OpenERP
2012-08-27 09:58:50 +05:30
28 changed files with 276 additions and 300 deletions
@@ -26,10 +26,10 @@ openerp.auth_anonymous = function(instance) {
start: function() {
var self = this;
this._super.apply(this, arguments);
this.$element.find('.oe_topbar_anonymous_login').click(function() {
this.$el.find('.oe_topbar_anonymous_login').click(function() {
var p = self.getParent();
var am = p.action_manager;
p.$element.find('.oe_leftbar').hide();
p.$el.find('.oe_leftbar').hide();
am.do_action({
type:'ir.actions.client',
tag:'login',
@@ -4,7 +4,7 @@ openerp.auth_oauth = function(instance) {
instance.web.Login = instance.web.Login.extend({
start: function(parent, params) {
var d = this._super.apply(this, arguments);
this.$element.on('click', 'a.zocial', this.on_oauth_sign_in);
this.$el.on('click', 'a.zocial', this.on_oauth_sign_in);
this.oauth_providers = [];
if(this.params.oauth_error === 1) {
this.do_warn("Sign up error.","Sign up is not allowed on this database.");
@@ -8,7 +8,7 @@ instance.web.Login = instance.web.Login.extend({
this._super.apply(this, arguments);
var self = this;
this._default_error_message = this.$element.find('.oe_login_error_message').text();
this._default_error_message = this.$el.find('.oe_login_error_message').text();
this.$openid_selected_button = $();
this.$openid_selected_input = $();
@@ -32,7 +32,7 @@ instance.web.Login = instance.web.Login.extend({
this.do_openid_select('a[data-url=""]', 'login,password', true);
}
this.$element.find('a[data-url]').click(function (event) {
this.$el.find('a[data-url]').click(function (event) {
event.preventDefault();
var selected_oidh = $(this).attr('href').substr(1);
if (selected_oidh != self.$openid_selected_provider) {
@@ -48,10 +48,10 @@ instance.web.Login = instance.web.Login.extend({
var self = this;
self.$openid_selected_button.add(self.$openid_selected_input).removeClass('selected');
self.$openid_selected_button = self.$element.find(button).addClass('selected');
self.$openid_selected_button = self.$el.find(button).addClass('selected');
var input = _(provider.split(',')).map(function(p) { return 'li[data-provider="'+p+'"]'; }).join(',');
self.$openid_selected_input = self.$element.find(input).addClass('selected');
self.$openid_selected_input = self.$el.find(input).addClass('selected');
self.$openid_selected_input.find('input:first').focus();
self.$openid_selected_provider = (self.$openid_selected_button.attr('href') || '').substr(1);
@@ -61,7 +61,7 @@ instance.web.Login = instance.web.Login.extend({
}
if (!noautosubmit && self.$openid_selected_input.length == 0) {
self.$element.find('form').submit();
self.$el.find('form').submit();
}
},
@@ -96,7 +96,7 @@ instance.web.Login = instance.web.Login.extend({
localStorage.setItem('openid-login', id);
}
var db = this.$element.find("form [name=db]").val();
var db = this.$el.find("form [name=db]").val();
var openid_url = dataurl.replace('{id}', id);
this.do_openid_login(db, openid_url);
@@ -129,12 +129,12 @@ instance.web.Login = instance.web.Login.extend({
do_warn: function(title, msg) {
//console.warn(title, msg);
this.$element.find('.oe_login_error_message').text(msg).show();
this.$el.find('.oe_login_error_message').text(msg).show();
this._super(title, msg);
},
reset_error_message: function() {
this.$element.find('.oe_login_error_message').text(this._default_error_message);
this.$el.find('.oe_login_error_message').text(this._default_error_message);
}
});
@@ -2,7 +2,7 @@ openerp.auth_reset_password = function(instance) {
var _t = instance.web._t;
instance.web.Login.include({
start: function() {
var $e = this.$element;
var $e = this.$el;
$e.find('a.oe_login_switch').click(function() {
$e.find('ul.oe_login_switch').toggle();
var $m = $e.find('form input[name=is_reset_pw]');
@@ -15,7 +15,7 @@ openerp.auth_reset_password = function(instance) {
ev.preventDefault();
}
var $e = this.$element;
var $e = this.$el;
var db = $e.find("form [name=db]").val();
if (!db) {
this.do_warn(_t("Login"), _t("No database selected !"));
@@ -7,13 +7,13 @@ openerp.base_setup = function(openerp) {
if (this.dataset.model === 'res.partner') {
/* Set names for partner categories */
var category_ids = [];
this.$element.find('.oe_kanban_partner_categories span').each(function() {
this.$el.find('.oe_kanban_partner_categories span').each(function() {
category_ids.push($(this).data('category_id'));
});
var dataset = new openerp.web.DataSetSearch(this, 'res.partner.category', self.session.context);
dataset.name_get(_.uniq(category_ids)).then(function(result) {
_.each(result, function(value) {
self.$element
self.$el
.find('.oe_kanban_partner_categories span[data-category_id=' + value[0] + ']')
.html(value[1]);
});
+20 -20
View File
@@ -18,21 +18,21 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
var self = this;
this._super.apply(this, arguments);
this.$element.find('.oe_dashboard_column').sortable({
this.$el.find('.oe_dashboard_column').sortable({
connectWith: '.oe_dashboard_column',
handle: '.oe_header',
scroll: false
}).bind('sortstop', self.do_save_dashboard);
// Events
this.$element.find('.oe_dashboard_link_reset').click(this.on_reset);
this.$element.find('.oe_dashboard_link_change_layout').click(this.on_change_layout);
this.$element.find('h2.oe_header span.oe_header_txt').click(function(ev){
this.$el.find('.oe_dashboard_link_reset').click(this.on_reset);
this.$el.find('.oe_dashboard_link_change_layout').click(this.on_change_layout);
this.$el.find('h2.oe_header span.oe_header_txt').click(function(ev){
if(ev.target === ev.currentTarget)
self.on_header_string($(ev.target).parent());
});
this.$element.delegate('.oe_dashboard_column .oe_fold', 'click', this.on_fold_action);
this.$element.delegate('.oe_dashboard_column .oe_close', 'click', this.on_close_action);
this.$el.delegate('.oe_dashboard_column .oe_fold', 'click', this.on_fold_action);
this.$el.delegate('.oe_dashboard_column .oe_close', 'click', this.on_close_action);
// Init actions
_.each(this.node.children, function(column, column_index) {
@@ -82,7 +82,7 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
on_change_layout: function() {
var self = this;
var qdict = {
current_layout : this.$element.find('.oe_dashboard').attr('data-layout')
current_layout : this.$el.find('.oe_dashboard').attr('data-layout')
};
var $dialog = instance.web.dialog($('<div>'), {
modal: true,
@@ -97,7 +97,7 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
});
},
do_change_layout: function(new_layout) {
var $dashboard = this.$element.find('.oe_dashboard');
var $dashboard = this.$el.find('.oe_dashboard');
var current_layout = $dashboard.attr('data-layout');
if (current_layout != new_layout) {
var clayout = current_layout.split('-').length,
@@ -141,10 +141,10 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
var self = this;
var board = {
form_title : this.view.fields_view.arch.attrs.string,
style : this.$element.find('.oe_dashboard').attr('data-layout'),
style : this.$el.find('.oe_dashboard').attr('data-layout'),
columns : []
};
this.$element.find('.oe_dashboard_column').each(function() {
this.$el.find('.oe_dashboard_column').each(function() {
var actions = [];
$(this).find('.oe_action').each(function() {
var action_id = $(this).attr('data-id'),
@@ -166,7 +166,7 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
view_id: this.view.fields_view.view_id,
arch: arch
}, function() {
self.$element.find('.oe_dashboard_link_reset').show();
self.$el.find('.oe_dashboard_link_reset').show();
});
},
on_load_action: function(result, index, action_attrs) {
@@ -272,11 +272,11 @@ instance.web.form.DashBoard = instance.web.form.FormWidget.extend({
});
}
var rendered = QWeb.render(this.form_template, this);
this.$element.html(rendered);
this.$el.html(rendered);
},
no_result: function() {
if (this.view.options.action.help) {
this.$element.append(
this.$el.append(
$('<div class="oe_view_nocontent">')
.append($('<div>').html(this.view.options.action.help || " "))
);
@@ -323,7 +323,7 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
_in_drawer: true,
start: function () {
var self = this;
this.$element
this.$el
.on('click', 'h4', this.proxy('show_option'))
.on('submit', 'form', function (e) {
e.preventDefault();
@@ -360,7 +360,7 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
var self = this;
var getParent = this.getParent();
var view_parent = this.getParent().getParent();
if (! view_parent.action || ! this.$element.find("select").val()) {
if (! view_parent.action || ! this.$el.find("select").val()) {
this.do_warn("Can't find dashboard action");
return;
}
@@ -370,24 +370,24 @@ instance.board.AddToDashboard = instance.web.search.Input.extend({
_.each(data.contexts, context.add, context);
_.each(data.domains, domain.add, domain);
this.rpc('/board/add_to_dashboard', {
menu_id: this.$element.find("select").val(),
menu_id: this.$el.find("select").val(),
action_id: view_parent.action.id,
context_to_save: context,
domain: domain,
view_mode: view_parent.active_view,
name: this.$element.find("input").val()
name: this.$el.find("input").val()
}, function(r) {
if (r === false) {
self.do_warn("Could not add filter to dashboard");
} else {
self.$element.toggleClass('oe_opened');
self.$el.toggleClass('oe_opened');
self.do_notify("Filter added to dashboard", '');
}
});
},
show_option:function(){
this.$element.toggleClass('oe_opened');
if (! this.$element.hasClass('oe_opened'))
this.$el.toggleClass('oe_opened');
if (! this.$el.hasClass('oe_opened'))
return;
this.$("input").val(this.getParent().fields_view.name || "" );
}
+1 -1
View File
@@ -155,7 +155,7 @@
<group>
<field name="partner_name" string="Company Name"/>
<field name="partner_id" string="Customer"
on_change="on_change_partner(partner_id)" />
on_change="on_change_partner(partner_id)" options='{"create_name_field": "name"}'/>
<label for="street" string="Address"/>
<div>
<field name="street" placeholder="Street..."/>
@@ -11,7 +11,7 @@ openerp.document_page = function (openerp) {
}
} else {
var wiki_value = wiky.process(show_value || '');
this.$element.html(wiki_value);
this.$el.html(wiki_value);
}
},
});
+11 -11
View File
@@ -28,14 +28,14 @@ openerp.edi.EdiView = openerp.web.Widget.extend({
if (openerp.web.qweb.templates[template_content]) {
this.content = openerp.web.qweb.render(template_content, param);
}
this.$element.html(openerp.web.qweb.render("EdiView", param));
this.$element.find('button.oe_edi_action_print').bind('click', this.do_print);
this.$element.find('button#oe_edi_import_existing').bind('click', this.do_import_existing);
this.$element.find('button#oe_edi_import_create').bind('click', this.do_import_create);
this.$element.find('button#oe_edi_download').bind('click', this.do_download);
this.$element.find('.oe_edi_import_choice, .oe_edi_import_choice_label').bind('click', this.toggle_choice('import'));
this.$element.find('.oe_edi_pay_choice, .oe_edi_pay_choice_label').bind('click', this.toggle_choice('pay'));
this.$element.find('#oe_edi_download_show_code').bind('click', this.show_code);
this.$el.html(openerp.web.qweb.render("EdiView", param));
this.$el.find('button.oe_edi_action_print').bind('click', this.do_print);
this.$el.find('button#oe_edi_import_existing').bind('click', this.do_import_existing);
this.$el.find('button#oe_edi_import_create').bind('click', this.do_import_create);
this.$el.find('button#oe_edi_download').bind('click', this.do_download);
this.$el.find('.oe_edi_import_choice, .oe_edi_import_choice_label').bind('click', this.toggle_choice('import'));
this.$el.find('.oe_edi_pay_choice, .oe_edi_pay_choice_label').bind('click', this.toggle_choice('pay'));
this.$el.find('#oe_edi_download_show_code').bind('click', this.show_code);
},
on_document_failed: function(response) {
var self = this;
@@ -85,7 +85,7 @@ openerp.edi.EdiView = openerp.web.Widget.extend({
},
do_import_existing: function(e) {
var url_download = this.get_download_url();
var $edi_text_server_input = this.$element.find('#oe_edi_txt_server_url');
var $edi_text_server_input = this.$el.find('#oe_edi_txt_server_url');
var server_url = $edi_text_server_input.val();
$edi_text_server_input.removeClass('invalid');
if (!server_url) {
@@ -138,14 +138,14 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({
show_login: function() {
this.destroy_content();
this.login = new openerp.web.Login(this);
this.login.appendTo(this.$element);
this.login.appendTo(this.$el);
},
destroy_content: function() {
_.each(_.clone(this.getChildren()), function(el) {
el.destroy();
});
this.$element.children().remove();
this.$el.children().remove();
},
do_import: function() {
@@ -59,7 +59,7 @@ openerp.event = function(instance, mod) {
address = _.str.sprintf('%(street)s, %(zip)s %(city)s', value);
}
// TODO repalce by widget_option selector self.options.selector
var el = self.view.$element.find(".oe_google_map")[0];
var el = self.view.$el.find(".oe_google_map")[0];
self.map.render_map(address,el);
});
},
+6 -38
View File
@@ -19,18 +19,13 @@
#
##############################################################################
import logging
import time
from datetime import datetime
import tools
from osv import fields, osv
from openerp.modules.registry import RegistryManager
from openerp import SUPERUSER_ID
from base_status.base_stage import base_stage
from tools.translate import _
_logger = logging.getLogger(__name__)
from base_status.base_stage import base_stage
from datetime import datetime
from osv import fields, osv
from tools.translate import _
AVAILABLE_STATES = [
('draft', 'New'),
@@ -522,35 +517,8 @@ class hr_job(osv.osv):
def _auto_init(self, cr, context=None):
"""Installation hook to create aliases for all jobs and avoid constraint errors."""
# disable the unique alias_id not null constraint, to avoid spurious warning during
# super.auto_init. We'll reinstall it afterwards.
self._columns['alias_id'].required = False
super(hr_job,self)._auto_init(cr, context=context)
registry = RegistryManager.get(cr.dbname)
mail_alias = registry.get('mail.alias')
hr_jobs = registry.get('hr.job')
jobs_no_alias = hr_jobs.search(cr, SUPERUSER_ID, [('alias_id', '=', False)])
# Use read() not browse(), to avoid prefetching uninitialized inherited fields
for job_data in hr_jobs.read(cr, SUPERUSER_ID, jobs_no_alias, ['name']):
alias_id = mail_alias.create_unique_alias(cr, SUPERUSER_ID, {'alias_name': 'job+'+job_data['name'],
'alias_defaults': {'job_id': job_data['id']}},
model_name='hr.applicant')
hr_jobs.write(cr, SUPERUSER_ID, job_data['id'], {'alias_id': alias_id})
_logger.info('Mail alias created for hr.job %s (uid %s)', job_data['name'], job_data['id'])
# Finally attempt to reinstate the missing constraint
try:
cr.execute('ALTER TABLE hr_job ALTER COLUMN alias_id SET NOT NULL')
except Exception:
_logger.warning("Table '%s': unable to set a NOT NULL constraint on column '%s' !\n"\
"If you want to have it, you should update the records and execute manually:\n"\
"ALTER TABLE %s ALTER COLUMN %s SET NOT NULL",
self._table, 'alias_id', self._table, 'alias_id')
self._columns['alias_id'].required = True
self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(hr_job,self)._auto_init,
self._columns['alias_id'], 'name', alias_prefix='job+', alias_defaults={'job_id': 'id'}, context=context)
def create(self, cr, uid, vals, context=None):
mail_alias = self.pool.get('mail.alias')
@@ -10,7 +10,7 @@ openerp.hr_recruitment = function(openerp) {
var categ_ids = [];
// Collect categories ids
self.$element.find('span[data-categ_id]').each(function() {
self.$el.find('span[data-categ_id]').each(function() {
categ_ids.push($(this).data('categ_id'));
});
@@ -19,7 +19,7 @@ openerp.hr_recruitment = function(openerp) {
dataset.read_slice(['id', 'name']).then(function(result) {
_.each(result, function(v, k) {
// Set the proper value in the DOM and display the element
self.$element.find('span[data-categ_id=' + v.id + ']').text(v.name);
self.$el.find('span[data-categ_id=' + v.id + ']').text(v.name);
});
});
},
+55
View File
@@ -19,11 +19,16 @@
#
##############################################################################
import logging
import re
import unicodedata
from openerp.osv import fields, osv
from openerp.tools import ustr
from openerp.modules.registry import RegistryManager
from openerp import SUPERUSER_ID
_logger = logging.getLogger(__name__)
# Inspired by http://stackoverflow.com/questions/517923
def remove_accents(input_str):
@@ -129,6 +134,56 @@ class mail_alias(osv.Model):
sequence = (sequence + 1) if sequence else 2
return new_name
def migrate_to_alias(self, cr, child_model_name, child_table_name, child_model_auto_init_fct,
alias_id_column, alias_key, alias_prefix = '', alias_force_key = '', alias_defaults = {}, context=None):
""" Installation hook to create aliases for all users and avoid constraint errors.
:param child_model_name: model name of the child class (i.e. res.users)
:param child_table_name: table name of the child class (i.e. res_users)
:param child_model_auto_init_fct: pointer to the _auto_init function
(i.e. super(res_users,self)._auto_init(cr, context=context))
:param alias_id_column: alias_id column (i.e. self._columns['alias_id'])
:param alias_key: name of the column used for the unique name (i.e. 'login')
:param alias_prefix: prefix for the unique name (i.e. 'jobs' + ...)
:param alias_force_key': name of the column for force_thread_id;
if empty string, not taken into account
:param alias_defaults: dict, keys = mail.alias columns, values = child
model column name used for default values (i.e. {'job_id': 'id'})
"""
# disable the unique alias_id not null constraint, to avoid spurious warning during
# super.auto_init. We'll reinstall it afterwards.
alias_id_column.required = False
# call _auto_init
child_model_auto_init_fct(cr, context=context)
registry = RegistryManager.get(cr.dbname)
mail_alias = registry.get('mail.alias')
child_class_model = registry.get(child_model_name)
no_alias_ids = child_class_model.search(cr, SUPERUSER_ID, [('alias_id', '=', False)])
# Use read() not browse(), to avoid prefetching uninitialized inherited fields
for obj_data in child_class_model.read(cr, SUPERUSER_ID, no_alias_ids, [alias_key]):
alias_vals = {'alias_name': '%s%s' % (alias_prefix, obj_data[alias_key]) }
if alias_force_key:
alias_vals['alias_force_thread_id'] = obj_data[alias_force_key]
alias_vals['alias_defaults'] = dict( (k, obj_data[v]) for k, v in alias_defaults.iteritems())
alias_id = mail_alias.create_unique_alias(cr, SUPERUSER_ID, alias_vals, model_name=child_model_name)
child_class_model.write(cr, SUPERUSER_ID, obj_data['id'], {'alias_id': alias_id})
_logger.info('Mail alias created for %s %s (uid %s)', child_model_name, obj_data[alias_key], obj_data['id'])
# Finally attempt to reinstate the missing constraint
try:
cr.execute('ALTER TABLE %s ALTER COLUMN alias_id SET NOT NULL' % (child_table_name))
except Exception:
_logger.warning("Table '%s': unable to set a NOT NULL constraint on column '%s' !\n"\
"If you want to have it, you should update the records and execute manually:\n"\
"ALTER TABLE %s ALTER COLUMN %s SET NOT NULL",
child_table_name, 'alias_id', child_table_name, 'alias_id')
# set back the unique alias_id constraint
alias_id_column.required = True
def create_unique_alias(self, cr, uid, vals, model_name=None, context=None):
"""Creates an email.alias record according to the values provided in ``vals``,
with 2 alterations: the ``alias_name`` value may be suffixed in order to
+2 -34
View File
@@ -19,15 +19,10 @@
#
##############################################################################
import logging
from osv import osv, fields
from openerp.modules.registry import RegistryManager
from openerp import SUPERUSER_ID
from tools.translate import _
_logger = logging.getLogger(__name__)
class res_users(osv.Model):
""" Update of res.users class
- add a preference about sending emails about notifications
@@ -69,35 +64,8 @@ class res_users(osv.Model):
def _auto_init(self, cr, context=None):
"""Installation hook to create aliases for all users and avoid constraint errors."""
# disable the unique alias_id not null constraint, to avoid spurious warning during
# super.auto_init. We'll reinstall it afterwards.
self._columns['alias_id'].required = False
super(res_users,self)._auto_init(cr, context=context)
registry = RegistryManager.get(cr.dbname)
mail_alias = registry.get('mail.alias')
res_users_model = registry.get('res.users')
users_no_alias = res_users_model.search(cr, SUPERUSER_ID, [('alias_id', '=', False)])
# Use read() not browse(), to avoid prefetching uninitialized inherited fields
for user_data in res_users_model.read(cr, SUPERUSER_ID, users_no_alias, ['login']):
alias_id = mail_alias.create_unique_alias(cr, SUPERUSER_ID, {'alias_name': user_data['login'],
'alias_force_id': user_data['id']},
model_name=self._name)
res_users_model.write(cr, SUPERUSER_ID, user_data['id'], {'alias_id': alias_id})
_logger.info('Mail alias created for user %s (uid %s)', user_data['login'], user_data['id'])
# Finally attempt to reinstate the missing constraint
try:
cr.execute('ALTER TABLE res_users ALTER COLUMN alias_id SET NOT NULL')
except Exception:
_logger.warning("Table '%s': unable to set a NOT NULL constraint on column '%s' !\n"\
"If you want to have it, you should update the records and execute manually:\n"\
"ALTER TABLE %s ALTER COLUMN %s SET NOT NULL",
self._table, 'alias_id', self._table, 'alias_id')
self._columns['alias_id'].required = True
self.pool.get('mail.alias').migrate_to_alias(cr, self._name, self._table, super(res_users,self)._auto_init,
self._columns['alias_id'], 'login', alias_force_key='id', context=context)
def create(self, cr, uid, data, context=None):
# create default alias same as the login
+52 -52
View File
@@ -57,7 +57,7 @@ openerp.mail = function(session) {
/* generic chatter events binding */
bind_events: function(widget) {
// event: click on an internal link to a document: model, login
widget.$element.delegate('a.oe_mail_internal_link', 'click', function (event) {
widget.$el.delegate('a.oe_mail_internal_link', 'click', function (event) {
event.preventDefault();
// lazy implementation: fetch data and try to redirect
if (! event.srcElement.dataset.resModel) return false;
@@ -344,8 +344,8 @@ openerp.mail = function(session) {
// customize display: add avatar, clean previous content
var user_avatar = mail.ChatterUtils.get_image(this.session.prefix,
this.session.session_id, 'res.users', 'image_small', this.session.uid);
this.$element.find('img.oe_mail_icon').attr('src', user_avatar);
this.$element.find('div.oe_mail_msg_content').empty();
this.$el.find('img.oe_mail_icon').attr('src', user_avatar);
this.$el.find('div.oe_mail_msg_content').empty();
// create a context for the default_get of the compose form
var widget_context = {
'active_model': this.params.res_model,
@@ -378,7 +378,7 @@ openerp.mail = function(session) {
disable_autofocus: true,
});
// add the form, bind events, activate the form
var msg_node = this.$element.find('div.oe_mail_msg_content');
var msg_node = this.$el.find('div.oe_mail_msg_content');
return $.when(this.form_view.appendTo(msg_node)).pipe(function() {
self.bind_events();
self.form_view.do_show();
@@ -396,31 +396,31 @@ openerp.mail = function(session) {
* in the function. */
bind_events: function() {
var self = this;
this.$element.find('button.oe_form_button').click(function (event) {
this.$el.find('button.oe_form_button').click(function (event) {
event.preventDefault();
});
// event: click on 'Send an Email' link that toggles the form for
// sending an email (partner_ids)
this.$element.find('a.oe_mail_compose_message_email').click(function (event) {
this.$el.find('a.oe_mail_compose_message_email').click(function (event) {
event.preventDefault();
self.toggle_email_mode();
});
// event: click on 'Formatting' icon-link that toggles the advanced
// formatting options for writing a message (subject, body_html)
this.$element.find('a.oe_mail_compose_message_formatting').click(function (event) {
this.$el.find('a.oe_mail_compose_message_formatting').click(function (event) {
event.preventDefault();
self.toggle_formatting_mode();
});
// event: click on 'Attachment' icon-link that opens the dialog to
// add an attachment.
this.$element.find('a.oe_mail_compose_message_attachment').click(function (event) {
this.$el.find('a.oe_mail_compose_message_attachment').click(function (event) {
event.preventDefault();
// not yet implemented
self.set_body_value('attachment', 'attachment');
});
// event: click on 'Checklist' icon-link that toggles the options
// for adding checklist.
this.$element.find('a.oe_mail_compose_message_checklist').click(function (event) {
this.$el.find('a.oe_mail_compose_message_checklist').click(function (event) {
event.preventDefault();
// not yet implemented
self.set_body_value('checklist', 'checklist');
@@ -440,9 +440,9 @@ openerp.mail = function(session) {
// update context of datasetsearch
this.ds_compose.context.formatting = this.formatting;
// toggle display
this.$element.find('span.oe_mail_compose_message_subject').toggleClass('oe_mail_compose_message_invisible');
this.$element.find('div.oe_mail_compose_message_body_text').toggleClass('oe_mail_compose_message_invisible');
this.$element.find('div.oe_mail_compose_message_body_html').toggleClass('oe_mail_compose_message_invisible');
this.$el.find('span.oe_mail_compose_message_subject').toggleClass('oe_mail_compose_message_invisible');
this.$el.find('div.oe_mail_compose_message_body_text').toggleClass('oe_mail_compose_message_invisible');
this.$el.find('div.oe_mail_compose_message_body_html').toggleClass('oe_mail_compose_message_invisible');
},
/**
@@ -460,14 +460,14 @@ openerp.mail = function(session) {
// update 'Post' button -> 'Send'
// update 'Send an Email' link -> 'Post a comment'
if (this.email_mode) {
this.$element.find('button.oe_mail_compose_message_button_send').html('<span>Send</span>');
this.$element.find('a.oe_mail_compose_message_email').html('Comment');
this.$el.find('button.oe_mail_compose_message_button_send').html('<span>Send</span>');
this.$el.find('a.oe_mail_compose_message_email').html('Comment');
} else {
this.$element.find('button.oe_mail_compose_message_button_send').html('<span>Post</span>');
this.$element.find('a.oe_mail_compose_message_email').html('Send an Email');
this.$el.find('button.oe_mail_compose_message_button_send').html('<span>Post</span>');
this.$el.find('a.oe_mail_compose_message_email').html('Send an Email');
}
// toggle display
this.$element.find('div.oe_mail_compose_message_partner_ids').toggleClass('oe_mail_compose_message_invisible');
this.$el.find('div.oe_mail_compose_message_partner_ids').toggleClass('oe_mail_compose_message_invisible');
},
/**
@@ -581,14 +581,14 @@ openerp.mail = function(session) {
'res_id': this.params.res_id, 'mode': mode || 'comment', 'msg_id': msg_id,
'email_mode': email_mode || false, 'formatting': formatting || false,
'context': context || false } );
var composition_node = this.$element.find('div.oe_mail_thread_action');
var composition_node = this.$el.find('div.oe_mail_thread_action');
composition_node.empty();
var compose_done = this.compose_message_widget.appendTo(composition_node);
return compose_done;
},
do_customize_display: function() {
if (this.display.show_post_comment) { this.$element.find('div.oe_mail_thread_action').eq(0).show(); }
if (this.display.show_post_comment) { this.$el.find('div.oe_mail_thread_action').eq(0).show(); }
},
/**
@@ -599,29 +599,29 @@ openerp.mail = function(session) {
// generic events from Chatter Mixin
mail.ChatterUtils.bind_events(this);
// event: click on 'more' at bottom of thread
this.$element.find('button.oe_mail_button_more').click(function () {
this.$el.find('button.oe_mail_button_more').click(function () {
self.do_more();
});
// event: writing in basic textarea of composition form (quick reply)
this.$element.find('textarea.oe_mail_compose_textarea').keyup(function (event) {
this.$el.find('textarea.oe_mail_compose_textarea').keyup(function (event) {
var charCode = (event.which) ? event.which : window.event.keyCode;
if (event.shiftKey && charCode == 13) { this.value = this.value+"\n"; }
else if (charCode == 13) { return self.do_comment(); }
});
// event: click on 'Reply' in msg
this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_reply', 'click', function (event) {
this.$el.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_reply', 'click', function (event) {
var act_dom = $(this).parents('div.oe_mail_thread_display').find('div.oe_mail_thread_action:first');
act_dom.toggle();
event.preventDefault();
});
// event: click on 'attachment(s)' in msg
this.$element.delegate('a.oe_mail_msg_view_attachments', 'click', function (event) {
this.$el.delegate('a.oe_mail_msg_view_attachments', 'click', function (event) {
var act_dom = $(this).parent().parent().parent().find('.oe_mail_msg_attachments');
act_dom.toggle();
event.preventDefault();
});
// event: click on 'Delete' in msg side menu
this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_delete', 'click', function (event) {
this.$el.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_delete', 'click', function (event) {
if (! confirm(_t("Do you really want to delete this message?"))) { return false; }
var msg_id = event.srcElement.dataset.id;
if (! msg_id) return false;
@@ -634,7 +634,7 @@ openerp.mail = function(session) {
return call_defer;
});
// event: click on 'Hide' in msg side menu
this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_hide', 'click', function (event) {
this.$el.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_hide', 'click', function (event) {
if (! confirm(_t("Do you really want to hide this thread ?"))) { return false; }
var msg_id = event.srcElement.dataset.id;
if (! msg_id) return false;
@@ -647,7 +647,7 @@ openerp.mail = function(session) {
return call_defer;
});
// event: click on "Reply" in msg side menu (email style)
this.$element.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_reply_by_email', 'click', function (event) {
this.$el.find('div.oe_mail_thread_display').delegate('a.oe_mail_msg_reply_by_email', 'click', function (event) {
var msg_id = event.srcElement.dataset.msg_id;
var email_mode = (event.srcElement.dataset.type == 'email');
var formatting = (event.srcElement.dataset.formatting == 'html');
@@ -665,7 +665,7 @@ openerp.mail = function(session) {
var self = this;
this.params.offset = 0;
this.comments_structure = {'root_ids': [], 'new_root_ids': [], 'msgs': {}, 'tree_struct': {}, 'model_to_root_ids': {}};
this.$element.find('div.oe_mail_thread_display').empty();
this.$el.find('div.oe_mail_thread_display').empty();
var domain = this.get_fetch_domain(this.comments_structure);
return this.fetch_comments(this.params.limit, this.params.offset, domain).then();
},
@@ -680,8 +680,8 @@ openerp.mail = function(session) {
else { self.display.show_more = true; }
self.display_comments(records);
// TODO: move to customize display
if (self.display.show_more == true) self.$element.find('div.oe_mail_thread_more:last').show();
else self.$element.find('div.oe_mail_thread_more:last').hide();
if (self.display.show_more == true) self.$el.find('div.oe_mail_thread_more:last').show();
else self.$el.find('div.oe_mail_thread_more:last').hide();
});
return defer;
@@ -725,8 +725,8 @@ openerp.mail = function(session) {
self.thread = new mail.Thread(self, {'res_model': self.params.res_model, 'res_id': self.params.res_id, 'uid': self.params.uid,
'records': sub_msgs, 'thread_level': (self.params.thread_level-1), 'parent_id': record.id,
'is_wall': self.params.is_wall});
self.$element.find('li.oe_mail_thread_msg:last').append('<div class="oe_mail_thread_subthread"/>');
self.thread.appendTo(self.$element.find('div.oe_mail_thread_subthread:last'));
self.$el.find('li.oe_mail_thread_msg:last').append('<div class="oe_mail_thread_subthread"/>');
self.thread.appendTo(self.$el.find('div.oe_mail_thread_subthread:last'));
}
else if (self.params.thread_level == 0) {
self.display_comment(record);
@@ -758,8 +758,8 @@ openerp.mail = function(session) {
// render
var rendered = session.web.qweb.render('mail.thread.message', {'record': record, 'thread': this, 'params': this.params, 'display': this.display});
// expand feature
$(rendered).appendTo(this.$element.children('div.oe_mail_thread_display:first'));
this.$element.find('div.oe_mail_msg_record_body').expander({
$(rendered).appendTo(this.$el.children('div.oe_mail_thread_display:first'));
this.$el.find('div.oe_mail_msg_record_body').expander({
slicePoint: this.params.msg_more_limit,
expandText: 'read more',
userCollapseText: '[^]',
@@ -771,11 +771,11 @@ openerp.mail = function(session) {
display_current_user: function () {
var avatar = mail.ChatterUtils.get_image(this.session.prefix, this.session.session_id, 'res.users', 'image_small', this.params.uid);
return this.$element.find('img.oe_mail_icon').attr('src', avatar);
return this.$el.find('img.oe_mail_icon').attr('src', avatar);
},
do_comment: function () {
var comment_node = this.$element.find('textarea');
var comment_node = this.$el.find('textarea');
var body_text = comment_node.val();
comment_node.val('');
return this.ds.call('message_append_note', [[this.params.res_id], '', body_text, this.params.parent_id, 'comment', 'plain']).then(
@@ -851,17 +851,17 @@ openerp.mail = function(session) {
this.view.on("change:actual_mode", this, this._check_visibility);
this._check_visibility();
mail.ChatterUtils.bind_events(this);
this.$element.find('button.oe_mail_button_followers').click(function () { self.do_toggle_followers(); });
this.$el.find('button.oe_mail_button_followers').click(function () { self.do_toggle_followers(); });
if (! this.params.see_subscribers_options) {
this.$element.find('button.oe_mail_button_followers').hide(); }
this.$element.find('button.oe_mail_button_follow').click(function () { self.do_follow(); });
this.$element.find('button.oe_mail_button_unfollow').click(function () { self.do_unfollow(); })
this.$el.find('button.oe_mail_button_followers').hide(); }
this.$el.find('button.oe_mail_button_follow').click(function () { self.do_follow(); });
this.$el.find('button.oe_mail_button_unfollow').click(function () { self.do_unfollow(); })
.mouseover(function () { $(this).html('Unfollow').removeClass('oe_mail_button_mouseout').addClass('oe_mail_button_mouseover'); })
.mouseleave(function () { $(this).html('Following').removeClass('oe_mail_button_mouseover').addClass('oe_mail_button_mouseout'); });
},
_check_visibility: function() {
this.$element.toggle(this.view.get("actual_mode") !== "create");
this.$el.toggle(this.view.get("actual_mode") !== "create");
},
destroy: function () {
@@ -872,15 +872,15 @@ openerp.mail = function(session) {
this._super.apply(this, arguments);
if (! this.view.datarecord.id ||
session.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) {
this.$element.find('.oe_mail_thread').hide();
this.$el.find('.oe_mail_thread').hide();
return;
}
// create and render Thread widget
this.$element.find('div.oe_mail_recthread_main').empty();
this.$el.find('div.oe_mail_recthread_main').empty();
if (this.thread) this.thread.destroy();
this.thread = new mail.Thread(this, {'res_model': this.view.model, 'res_id': this.view.datarecord.id, 'uid': this.session.uid,
'thread_level': this.params.thread_level, 'show_post_comment': true, 'limit': 15});
var thread_done = this.thread.appendTo(this.$element.find('div.oe_mail_recthread_main'));
var thread_done = this.thread.appendTo(this.$el.find('div.oe_mail_recthread_main'));
return thread_done;
},
});
@@ -965,7 +965,7 @@ openerp.mail = function(session) {
this.compose_message_widget = new mail.ComposeMessage(this, {
'extended_mode': false, 'uid': this.session.uid, 'res_model': this.params.res_model,
'res_id': this.params.res_id, 'mode': mode || 'comment', 'msg_id': msg_id });
var composition_node = this.$element.find('div.oe_mail_wall_action');
var composition_node = this.$el.find('div.oe_mail_wall_action');
composition_node.empty();
var compose_done = this.compose_message_widget.appendTo(composition_node);
return compose_done;
@@ -975,7 +975,7 @@ openerp.mail = function(session) {
add_event_handlers: function () {
var self = this;
// display more threads
this.$element.find('button.oe_mail_wall_button_more').click(function () { return self.do_more(); });
this.$el.find('button.oe_mail_wall_button_more').click(function () { return self.do_more(); });
},
/**
@@ -987,7 +987,7 @@ openerp.mail = function(session) {
load_search_view: function (view_id, defaults, hidden) {
var self = this;
this.searchview = new session.web.SearchView(this, this.ds_msg, view_id || false, defaults || {}, hidden || false);
var search_view_loaded = this.searchview.appendTo(this.$element.find('.oe_view_manager_view_search'));
var search_view_loaded = this.searchview.appendTo(this.$el.find('.oe_view_manager_view_search'));
return $.when(search_view_loaded).then(function () {
self.searchview.on_search.add(self.do_searchview_search);
});
@@ -1016,7 +1016,7 @@ openerp.mail = function(session) {
},
display_current_user: function () {
//return this.$element.find('img.oe_mail_msg_image').attr('src', this.thread_get_avatar('res.users', 'avatar', this.session.uid));
//return this.$el.find('img.oe_mail_msg_image').attr('src', this.thread_get_avatar('res.users', 'avatar', this.session.uid));
},
/**
@@ -1031,7 +1031,7 @@ openerp.mail = function(session) {
this.search['context'] = _.extend(this.params.context, this.search_results.context);
this.display_show_more = true;
this.comments_structure = {'root_ids': [], 'new_root_ids': [], 'msgs': {}, 'tree_struct': {}, 'model_to_root_ids': {}};
this.$element.find('ul.oe_mail_wall_threads').empty();
this.$el.find('ul.oe_mail_wall_threads').empty();
return this.fetch_comments(this.params.limit, 0);
},
@@ -1064,13 +1064,13 @@ openerp.mail = function(session) {
var model_name = self.comments_structure.msgs[root_id]['model'];
var res_id = self.comments_structure.msgs[root_id]['res_id'];
var render_res = session.web.qweb.render('mail.wall_thread_container', {});
$('<li class="oe_mail_wall_thread">').html(render_res).appendTo(self.$element.find('ul.oe_mail_wall_threads'));
$('<li class="oe_mail_wall_thread">').html(render_res).appendTo(self.$el.find('ul.oe_mail_wall_threads'));
var thread = new mail.Thread(self, {
'res_model': model_name, 'res_id': res_id, 'uid': self.session.uid, 'records': records,
'parent_id': false, 'thread_level': self.params.thread_level, 'show_hide': true, 'is_wall': true}
);
self.thread_list.push(thread);
return thread.appendTo(self.$element.find('li.oe_mail_wall_thread:last'));
return thread.appendTo(self.$el.find('li.oe_mail_wall_thread:last'));
});
// update TODO
this.comments_structure['root_ids'] = _.union(this.comments_structure['root_ids'], this.comments_structure['new_root_ids']);
@@ -1097,8 +1097,8 @@ openerp.mail = function(session) {
/** Display update: show more button */
do_update_show_more: function (new_value) {
if (new_value != undefined) this.display_show_more = new_value;
if (this.display_show_more) this.$element.find('div.oe_mail_wall_more:last').show();
else this.$element.find('div.oe_mail_wall_more:last').hide();
if (this.display_show_more) this.$el.find('div.oe_mail_wall_more:last').show();
else this.$el.find('div.oe_mail_wall_more:last').hide();
},
/** Action: Shows more discussions */
+18 -18
View File
@@ -40,20 +40,20 @@ openerp_mail_followers = function(session, mail) {
// any other method to know if the view is in create mode anymore
this.view.on("change:actual_mode", this, this._check_visibility);
this._check_visibility();
this.$element.find('button.oe_mail_button_followers').click(function () { self.do_toggle_followers(); });
this.$el.find('button.oe_mail_button_followers').click(function () { self.do_toggle_followers(); });
if (! this.params.display_control) {
this.$element.find('button.oe_mail_button_followers').hide(); }
this.$element.find('button.oe_mail_button_follow').click(function () { self.do_follow(); })
this.$el.find('button.oe_mail_button_followers').hide(); }
this.$el.find('button.oe_mail_button_follow').click(function () { self.do_follow(); })
.mouseover(function () { $(this).html('Follow').removeClass('oe_mail_button_mouseout').addClass('oe_mail_button_mouseover'); })
.mouseleave(function () { $(this).html('Not following').removeClass('oe_mail_button_mouseover').addClass('oe_mail_button_mouseout'); });
this.$element.find('button.oe_mail_button_unfollow').click(function () { self.do_unfollow(); })
this.$el.find('button.oe_mail_button_unfollow').click(function () { self.do_unfollow(); })
.mouseover(function () { $(this).html('Unfollow').removeClass('oe_mail_button_mouseout').addClass('oe_mail_button_mouseover'); })
.mouseleave(function () { $(this).html('Following').removeClass('oe_mail_button_mouseover').addClass('oe_mail_button_mouseout'); });
this.reinit();
},
_check_visibility: function() {
this.$element.toggle(this.view.get("actual_mode") !== "create");
this.$el.toggle(this.view.get("actual_mode") !== "create");
},
destroy: function () {
@@ -64,16 +64,16 @@ openerp_mail_followers = function(session, mail) {
this.params.display_followers = true;
this.params.display_control = this.node.attrs.display_control || false;
this.params.display_actions = this.node.attrs.display_actions || false;
this.$element.find('button.oe_mail_button_followers').html('Hide followers')
this.$element.find('button.oe_mail_button_follow').hide();
this.$element.find('button.oe_mail_button_unfollow').hide();
this.$el.find('button.oe_mail_button_followers').html('Hide followers')
this.$el.find('button.oe_mail_button_follow').hide();
this.$el.find('button.oe_mail_button_unfollow').hide();
},
set_value: function(value_) {
this.reinit();
if (! this.view.datarecord.id ||
session.web.BufferedDataSet.virtual_id_regex.test(this.view.datarecord.id)) {
this.$element.find('div.oe_mail_recthread_aside').hide();
this.$el.find('div.oe_mail_recthread_aside').hide();
return;
}
return this.fetch_subscribers(value_);
@@ -89,19 +89,19 @@ openerp_mail_followers = function(session, mail) {
display_subscribers: function (records) {
var self = this;
this.is_subscriber = false;
var user_list = this.$element.find('ul.oe_mail_followers_display').empty();
this.$element.find('div.oe_mail_recthread_followers h4').html(this.params.title + ' (' + records.length + ')');
var user_list = this.$el.find('ul.oe_mail_followers_display').empty();
this.$el.find('div.oe_mail_recthread_followers h4').html(this.params.title + ' (' + records.length + ')');
_(records).each(function (record) {
if (record.id == self.session.uid) { self.is_subscriber = true; }
record.avatar_url = mail.ChatterUtils.get_image(self.session.prefix, self.session.session_id, 'res.users', 'image_small', record.id);
$(session.web.qweb.render('mail.followers.partner', {'record': record})).appendTo(user_list);
});
if (this.is_subscriber) {
this.$element.find('button.oe_mail_button_follow').hide();
this.$element.find('button.oe_mail_button_unfollow').show(); }
this.$el.find('button.oe_mail_button_follow').hide();
this.$el.find('button.oe_mail_button_unfollow').show(); }
else {
this.$element.find('button.oe_mail_button_follow').show();
this.$element.find('button.oe_mail_button_unfollow').hide(); }
this.$el.find('button.oe_mail_button_follow').show();
this.$el.find('button.oe_mail_button_unfollow').hide(); }
},
do_follow: function () {
@@ -114,9 +114,9 @@ openerp_mail_followers = function(session, mail) {
do_toggle_followers: function () {
this.params.see_subscribers = ! this.params.see_subscribers;
if (this.params.see_subscribers) { this.$element.find('button.oe_mail_button_followers').html('Hide followers'); }
else { this.$element.find('button.oe_mail_button_followers').html('Show followers'); }
this.$element.find('div.oe_mail_recthread_followers').toggle();
if (this.params.see_subscribers) { this.$el.find('button.oe_mail_button_followers').html('Hide followers'); }
else { this.$el.find('button.oe_mail_button_followers').html('Show followers'); }
this.$el.find('div.oe_mail_recthread_followers').toggle();
},
});
};
+5 -5
View File
@@ -5,8 +5,8 @@ instance.web.form.FieldPad = instance.web.form.AbstractField.extend(instance.web
initialize_content: function() {
var self = this;
this.$textarea = undefined;
this.$element.find('div.oe_etherpad_head').click(function(ev) {
self.$element.toggleClass('oe_etherpad_fullscreen').toggleClass('oe_etherpad_normal');
this.$el.find('div.oe_etherpad_head').click(function(ev) {
self.$el.toggleClass('oe_etherpad_fullscreen').toggleClass('oe_etherpad_normal');
});
},
set_value: function(value_) {
@@ -21,12 +21,12 @@ instance.web.form.FieldPad = instance.web.form.AbstractField.extend(instance.web
if (!this.get("effective_readonly")) {
var pad_username = this.session.username;
var code = '<iframe width="100%" height="100%" frameborder="0" src="'+url+'?showChat=false&userName='+pad_username+'"></iframe>';
this.$element.find('div.oe_etherpad_default').html(code);
this.$el.find('div.oe_etherpad_default').html(code);
} else {
$.get(url+'/export/html').success(function(data) {
self.$element.html('<div class="etherpad_readonly">'+data+'</div>');
self.$el.html('<div class="etherpad_readonly">'+data+'</div>');
}).error(function() {
self.$element.text('Unable to load pad');
self.$el.text('Unable to load pad');
});
}
}
+14 -14
View File
@@ -225,13 +225,13 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
// with add_action_button()
show_action_bar: function(){
this.pos_widget.action_bar.show();
this.$element.css({'bottom':'105px'});
this.$el.css({'bottom':'105px'});
},
// hides the action bar. The actionbar is automatically hidden when it is empty
hide_action_bar: function(){
this.pos_widget.action_bar.hide();
this.$element.css({'bottom':'0px'});
this.$el.css({'bottom':'0px'});
},
// adds a new button to the action bar. The button definition takes three parameters, all optional :
@@ -250,8 +250,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
var self = this;
this.hidden = false;
if(this.$element){
this.$element.show();
if(this.$el){
this.$el.show();
}
if(this.pos_widget.action_bar.get_button_count() > 0){
@@ -311,8 +311,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
// POS initialization.
hide: function(){
this.hidden = true;
if(this.$element){
this.$element.hide();
if(this.$el){
this.$el.hide();
}
},
@@ -323,8 +323,8 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
renderElement: function(){
this._super();
if(this.hidden){
if(this.$element){
this.$element.hide();
if(this.$el){
this.$el.hide();
}
}
},
@@ -332,13 +332,13 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
module.PopUpWidget = module.PosBaseWidget.extend({
show: function(){
if(this.$element){
this.$element.show();
if(this.$el){
this.$el.show();
}
},
hide: function(){
if(this.$element){
this.$element.hide();
if(this.$el){
this.$el.hide();
}
},
});
@@ -350,7 +350,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
this.pos.proxy.help_needed();
var self = this;
this.$element.find('.button').off('click').click(function(){
this.$el.find('.button').off('click').click(function(){
self.pos_widget.screen_selector.close_popup();
self.pos.proxy.help_canceled();
});
@@ -700,7 +700,7 @@ function openerp_pos_screens(instance, module){ //module is instance.point_of_sa
},
refresh: function() {
this.currentOrder = this.pos.get('selectedOrder');
$('.pos-receipt-container', this.$element).html(QWeb.render('PosTicket',{widget:this}));
$('.pos-receipt-container', this.$el).html(QWeb.render('PosTicket',{widget:this}));
},
});
@@ -35,10 +35,10 @@ function openerp_pos_basewidget(instance, module){ //module is instance.point_of
},
show: function(){
this.$element.show();
this.$el.show();
},
hide: function(){
this.$element.hide();
this.$el.hide();
},
});
@@ -63,12 +63,12 @@ function openerp_pos_scrollbar(instance, module){ //module is instance.point_of_
this.update_scroller_dimensions(false);
this.update_button_status();
this.auto_hide(false);
this.$element.bind('mousewheel',function(event,delta){
this.$el.bind('mousewheel',function(event,delta){
self.scroll(delta*self.wheel_step);
return false;
});
this.$element.bind('click',function(event){
var vpos = event.pageY - self.$element.offset().top;
this.$el.bind('click',function(event){
var vpos = event.pageY - self.$el.offset().top;
var spos = self.scroller_dimensions();
if(vpos > spos.bar_pos && vpos < spos.pos){
self.page_up();
@@ -106,9 +106,9 @@ function openerp_pos_scrollbar(instance, module){ //module is instance.point_of_
// shows the scrollbar. if animated is true, it will do it in an animated fashion
show: function(animated){ //FIXME: animated show and hide don't work ... ?
if(animated){
this.$element.show().animate({'width':'48px'}, 500, 'swing');
this.$el.show().animate({'width':'48px'}, 500, 'swing');
}else{
this.$element.show().css('width','48px');
this.$el.show().css('width','48px');
}
this.on_show(this);
},
@@ -117,9 +117,9 @@ function openerp_pos_scrollbar(instance, module){ //module is instance.point_of_
hide: function(animated){
var self = this;
if(animated){
this.$element.animate({'width':'0px'}, 500, 'swing', function(){ self.$element.hide();});
this.$el.animate({'width':'0px'}, 500, 'swing', function(){ self.$el.hide();});
}else{
this.$element.hide().css('width','0px');
this.$el.hide().css('width','0px');
}
this.on_hide(this);
},
@@ -136,7 +136,7 @@ function openerp_pos_scrollbar(instance, module){ //module is instance.point_of_
var button_up_height = this.$('.up-button')[0].offsetHeight || 48;
var button_down_height = this.$('.down-button')[0].offsetHeight || 48;
var bar_height = this.$element[0].offsetHeight || 96;
var bar_height = this.$el[0].offsetHeight || 96;
var scrollbar_height = bar_height - button_up_height - button_down_height;
scroller_pos = scroller_pos * scrollbar_height + button_up_height;
@@ -205,7 +205,7 @@ function openerp_pos_scrollbar(instance, module){ //module is instance.point_of_
if(this.target_selector){
return this.target_widget.$(this.target_selector);
}else{
return this.target_widget.$element;
return this.target_widget.$el;
}
}else if(this.target_selector){
return $(this.target_selector);
+17 -17
View File
@@ -61,10 +61,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
start: function() {
this.state.bind('change:mode', this.changedMode, this);
this.changedMode();
this.$element.find('button#numpad-backspace').click(_.bind(this.clickDeleteLastChar, this));
this.$element.find('button#numpad-minus').click(_.bind(this.clickSwitchSign, this));
this.$element.find('button.number-char').click(_.bind(this.clickAppendNewChar, this));
this.$element.find('button.mode-button').click(_.bind(this.clickChangeMode, this));
this.$el.find('button#numpad-backspace').click(_.bind(this.clickDeleteLastChar, this));
this.$el.find('button#numpad-minus').click(_.bind(this.clickSwitchSign, this));
this.$el.find('button.number-char').click(_.bind(this.clickAppendNewChar, this));
this.$el.find('button.mode-button').click(_.bind(this.clickChangeMode, this));
},
clickDeleteLastChar: function() {
return this.state.deleteLastChar();
@@ -84,7 +84,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
changedMode: function() {
var mode = this.state.get('mode');
$('.selected-mode').removeClass('selected-mode');
$(_.str.sprintf('.mode-button[data-mode="%s"]', mode), this.$element).addClass('selected-mode');
$(_.str.sprintf('.mode-button[data-mode="%s"]', mode), this.$el).addClass('selected-mode');
},
});
@@ -102,7 +102,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
pos_widget : self.pos_widget,
cashRegister: cashRegister,
});
button.appendTo(self.$element);
button.appendTo(self.$el);
});
}
});
@@ -117,7 +117,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
var self = this;
this._super();
this.$element.click(function(){
this.$el.click(function(){
if (self.pos.get('selectedOrder').get('screen') === 'receipt'){ //TODO Why ?
console.warn('TODO should not get there...?');
return;
@@ -146,9 +146,9 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
},
renderElement: function() {
this._super();
this.$element.click(_.bind(this.click_handler, this));
this.$el.click(_.bind(this.click_handler, this));
if(this.model.is_selected()){
this.$element.addClass('selected');
this.$el.addClass('selected');
}
},
refresh: function(){
@@ -291,7 +291,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
this._super();
this.$('img').replaceWith(this.pos_widget.image_cache.get_image(this.get_image_url()));
var self = this;
$("a", this.$element).click(function(e){
$("a", this.$el).click(function(e){
if(self.click_product_action){
self.click_product_action(self.model);
}
@@ -355,7 +355,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
},
setButtonSelected: function() {
$('.selected-order').removeClass('selected-order');
this.$element.addClass('selected-order');
this.$el.addClass('selected-order');
},
closeOrder: function(event) {
this.order.destroy();
@@ -378,7 +378,7 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
renderElement: function(){
this._super();
if(this.click_action){
this.$element.click(_.bind(this.click_action, this));
this.$el.click(_.bind(this.click_action, this));
}
},
});
@@ -421,10 +421,10 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
return button;
},
show:function(){
this.$element.show();
this.$el.show();
},
hide:function(){
this.$element.hide();
this.$el.hide();
},
});
@@ -644,11 +644,11 @@ function openerp_pos_widgets(instance, module){ //module is instance.point_of_sa
var self = this;
this._super();
if(this.action){
this.$element.click(function(){ self.action(); });
this.$el.click(function(){ self.action(); });
}
},
show: function(){ this.$element.show(); },
hide: function(){ this.$element.hide(); },
show: function(){ this.$el.show(); },
hide: function(){ this.$el.hide(); },
});
+4 -4
View File
@@ -10,7 +10,7 @@ openerp.project = function(openerp) {
var members_ids = [];
// Collect members ids
self.$element.find('img[data-member_id]').each(function() {
self.$el.find('img[data-member_id]').each(function() {
members_ids.push($(this).data('member_id'));
});
@@ -19,7 +19,7 @@ openerp.project = function(openerp) {
dataset.read_slice(['id', 'name']).then(function(result) {
_.each(result, function(v, k) {
// Set the proper value in the DOM
self.$element.find('img[data-member_id=' + v.id + ']').attr('title', v.name).tipsy({
self.$el.find('img[data-member_id=' + v.id + ']').attr('title', v.name).tipsy({
offset: 10
});
});
@@ -35,7 +35,7 @@ openerp.project = function(openerp) {
var categ_ids = [];
// Collect categories ids
self.$element.find('span[data-categ_id]').each(function() {
self.$el.find('span[data-categ_id]').each(function() {
categ_ids.push($(this).data('categ_id'));
});
@@ -44,7 +44,7 @@ openerp.project = function(openerp) {
dataset.read_slice(['id', 'name']).then(function(result) {
_.each(result, function(v, k) {
// Set the proper value in the DOM and display the element
self.$element.find('span[data-categ_id=' + v.id + ']').text(v.name);
self.$el.find('span[data-categ_id=' + v.id + ']').text(v.name);
});
});
},
+2 -2
View File
@@ -89,7 +89,7 @@ openerp.share = function(session) {
start: function() {
start_res = this._super.apply(this, arguments);
if (has_action_id) {
this.$element.find('button.oe_share_invite').show();
this.$el.find('button.oe_share_invite').show();
}
return start_res;
}
@@ -100,7 +100,7 @@ openerp.share = function(session) {
var self = this;
this.check_if_action_is_defined();
has_share(function() {
self.$element.delegate('button.oe_share_invite', 'click', self.on_click_share_invite);
self.$el.delegate('button.oe_share_invite', 'click', self.on_click_share_invite);
});
return this._super.apply(this, arguments);
},
+1 -1
View File
@@ -10,7 +10,7 @@ OpenERP Web LinkedIn module.
This module provides the Integration of the LinkedIn with OpenERP.
""",
'data': ['web_linkedin_view.xml'],
'depends' : ['base'],
'depends' : ['crm'],
'js': ['static/src/js/*.js'],
'css': ['static/src/css/*.css'],
'qweb': ['static/src/xml/*.xml'],
@@ -233,8 +233,8 @@ openerp.web_linkedin = function(instance) {
$row.appendTo($elem);
}
pc.appendTo($row);
pc.$element.css("display", "table-cell");
pc.$element.css("width", "20%");
pc.$el.css("display", "table-cell");
pc.$el.css("width", "20%");
pc.on("selected", self, function(data) {
self.trigger("selected", data);
self.destroy();
@@ -255,7 +255,7 @@ openerp.web_linkedin = function(instance) {
},
start: function() {
var self = this;
this.$element.click(function() {
this.$el.click(function() {
self.trigger("selected", self.data);
});
if (this.data.__type === "company") {
+1 -2
View File
@@ -39,8 +39,7 @@ class Binary(openerpweb.Controller):
return base64.b64encode(bfile.read())
class web_linkedin_settings(osv.osv_memory):
_name = 'web_linkedin.settings'
_inherit = 'res.config.settings'
_inherit = 'sale.config.settings'
_columns = {
'api_key': fields.char(string="API Key", size=50),
'server_domain': fields.char(size=100),
+25 -39
View File
@@ -15,48 +15,34 @@
<record id="view_linkedin_config_settings" model="ir.ui.view">
<field name="name">linkedin_settings</field>
<field name="model">web_linkedin.settings</field>
<field name="model">sale.config.settings</field>
<field name="inherit_id" ref="base_setup.view_sale_config_settings"/>
<field name="arch" type="xml">
<form string="Configure Linkedin" version="7.0" class="oe_form_configuration">
<header>
<button string="Apply" type="object" name="execute" class="oe_highlight"/>
or
<button string="Cancel" type="object" name="cancel" class="oe_link"/>
</header>
<p>
To use the LinkedIn module with this database, an API Key is required. Please follow this procedure:
</p>
<ul>
<li>Go to this URL:
<a href="https://www.linkedin.com/secure/developer" target="_blank">https://www.linkedin.com/secure/developer</a>.
</li>
<li>Log into LinkedIn.</li>
<li>Add a new application and fill the form:
<ul>
<li>JavaScript API Domain: <field name="server_domain" readonly="1" style="width:0"/></li>
<li>The programming tool is Javascript</li>
</ul>
</li>
<li>Copy the API key down here:</li>
</ul>
<group>
<field name="api_key"/>
</group>
</form>
<div name="linkedin" position="inside">
<form string="Configure Linkedin" version="7.0" class="oe_form_configuration">
<p>
To use the LinkedIn module with this database, an API Key is required. Please follow this procedure:
</p>
<ul>
<li>Go to this URL:
<a href="https://www.linkedin.com/secure/developer" target="_blank">https://www.linkedin.com/secure/developer</a>.
</li>
<li>Log into LinkedIn.</li>
<li>Add a new application and fill the form:
<ul>
<li>JavaScript API Domain: <field name="server_domain" readonly="1" style="width:0"/></li>
<li>The programming tool is Javascript</li>
</ul>
</li>
<li>Copy the API key down here:</li>
</ul>
<group>
<field name="api_key"/>
</group>
</form>
</div>
</field>
</record>
<record id="action_linkedin_config_settings" model="ir.actions.act_window">
<field name="name">Configure Linkedin</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">web_linkedin.settings</field>
<field name="view_mode">form</field>
<field name="target">inline</field>
</record>
<menuitem id="menu_linkedin_config_settings" name="Linkedin" parent="base.menu_config"
sequence="10" action="action_linkedin_config_settings"/>
</data>
</openerp>
@@ -39,13 +39,13 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
var self = this;
this._super();
this.trigger('load');
this.$element.on('click', '.oe_systray_shortcuts_items a', function() {
this.$el.on('click', '.oe_systray_shortcuts_items a', function() {
self.trigger('click', $(this));
});
},
load: function() {
var self = this;
this.$element.find('.oe_systray_shortcuts_items').empty();
this.$el.find('.oe_systray_shortcuts_items').empty();
return this.rpc('/web/shortcuts/list', {}, function(shortcuts) {
_.each(shortcuts, function(sc) {
self.trigger('display', sc);
@@ -64,13 +64,13 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
},
display: function(sc) {
var self = this;
this.$element.find('.oe_systray_shortcuts_items').append();
this.$el.find('.oe_systray_shortcuts_items').append();
var $sc = $(QWeb.render('Systray.Shortcuts.Item', {'shortcut': sc}));
$sc.appendTo(self.$element.find('.oe_systray_shortcuts_items'));
$sc.appendTo(self.$el.find('.oe_systray_shortcuts_items'));
},
remove: function (menu_id) {
var menu_id = this.session.active_id;
var $shortcut = this.$element.find('.oe_systray_shortcuts_items li a[data-id=' + menu_id + ']');
var $shortcut = this.$el.find('.oe_systray_shortcuts_items li a[data-id=' + menu_id + ']');
var shortcut_id = $shortcut.data('shortcut-id');
$shortcut.remove();
this.dataset.unlink([shortcut_id]);
@@ -85,10 +85,10 @@ instance.web_shortcuts.Shortcuts = instance.web.Widget.extend({
instance.webclient.user_menu.on_action({action_id: ir_menu_data.action[0][2].id});
}
});
this.$element.find('.oe_systray_shortcuts').trigger('mouseout');
this.$el.find('.oe_systray_shortcuts').trigger('mouseout');
},
has: function(menu_id) {
return !!this.$element.find('a[data-id=' + menu_id + ']').length;
return !!this.$el.find('a[data-id=' + menu_id + ']').length;
}
});
@@ -101,7 +101,7 @@ instance.web.UserMenu.include({
self.shortcuts.trigger('load');
} else {
self.shortcuts = new instance.web_shortcuts.Shortcuts(self);
self.shortcuts.appendTo(instance.webclient.$element.find('.oe_systray'));
self.shortcuts.appendTo(instance.webclient.$el.find('.oe_systray'));
}
});
},
@@ -119,7 +119,7 @@ instance.web.ViewManagerAction.include({
var shortcuts_menu = instance.webclient.user_menu.shortcuts;
var grandparent = this.getParent() && this.getParent().getParent();
// display shortcuts if on the first view for the action
var $shortcut_toggle = this.$element.find('.oe_shortcuts_toggle');
var $shortcut_toggle = this.$el.find('.oe_shortcuts_toggle');
if (!this.action.name ||
!(view.view_type === this.views_src[0].view_type
&& view.view_id === this.views_src[0].view_id)) {