[MERGE] Merge with trunk upto revision no 750.

bzr revid: ysa@tinyerp.com-20110809112904-37e463kwhthi1m22
This commit is contained in:
Yogesh (OpenERP)
2011-08-09 16:59:04 +05:30
17 changed files with 304 additions and 262 deletions
+2 -1
View File
@@ -4,7 +4,8 @@
/**
* @name openerp
* @namespace
* @namespace openerp
* @namespace window.openerp
*/
(function() {
if (this.openerp)
+16 -16
View File
@@ -305,10 +305,10 @@ openerp.base.Notification = openerp.base.Widget.extend({
openerp.base.Dialog = openerp.base.OldWidget.extend({
dialog_title: "",
identifier_prefix: 'dialog',
init: function (parent, options) {
init: function (parent, dialog_options) {
var self = this;
this._super(parent);
this.options = {
this.dialog_options = {
modal: true,
width: 'auto',
min_width: 0,
@@ -324,21 +324,21 @@ openerp.base.Dialog = openerp.base.OldWidget.extend({
};
for (var f in this) {
if (f.substr(0, 10) == 'on_button_') {
this.options.buttons[f.substr(10)] = this[f];
this.dialog_options.buttons[f.substr(10)] = this[f];
}
}
if (options) {
this.set_options(options);
if (dialog_options) {
this.set_options(dialog_options);
}
},
set_options: function(options) {
options = options || {};
options.width = this.get_width(options.width || this.options.width);
options.min_width = this.get_width(options.min_width || this.options.min_width);
options.max_width = this.get_width(options.max_width || this.options.max_width);
options.height = this.get_height(options.height || this.options.height);
options.min_height = this.get_height(options.min_height || this.options.min_height);
options.max_height = this.get_height(options.max_height || this.options.max_width);
options.width = this.get_width(options.width || this.dialog_options.width);
options.min_width = this.get_width(options.min_width || this.dialog_options.min_width);
options.max_width = this.get_width(options.max_width || this.dialog_options.max_width);
options.height = this.get_height(options.height || this.dialog_options.height);
options.min_height = this.get_height(options.min_height || this.dialog_options.min_height);
options.max_height = this.get_height(options.max_height || this.dialog_options.max_width);
if (options.width !== 'auto') {
if (options.width > options.max_width) options.width = options.max_width;
@@ -351,7 +351,7 @@ openerp.base.Dialog = openerp.base.OldWidget.extend({
if (!options.title && this.dialog_title) {
options.title = this.dialog_title;
}
_.extend(this.options, options);
_.extend(this.dialog_options, options);
},
get_width: function(val) {
return this.get_size(val.toString(), $(window.top).width());
@@ -369,19 +369,19 @@ openerp.base.Dialog = openerp.base.OldWidget.extend({
}
},
start: function (auto_open) {
this.$dialog = $('<div id="' + this.element_id + '"></div>').dialog(this.options);
this.$dialog = $('<div id="' + this.element_id + '"></div>').dialog(this.dialog_options);
if (auto_open !== false) {
this.open();
}
this._super();
},
open: function(options) {
open: function(dialog_options) {
// TODO fme: bind window on resize
if (this.template) {
this.$element.html(this.render());
}
this.set_options(options);
this.$dialog.dialog(this.options).dialog('open');
this.set_options(dialog_options);
this.$dialog.dialog(this.dialog_options).dialog('open');
},
close: function() {
// Closes the dialog but leave it in a state where it could be opened again.
+79 -48
View File
@@ -7,65 +7,96 @@ openerp.base.core = function(openerp) {
* John Resig Class with factory improvement
*/
(function() {
var initializing = false, fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
openerp.base.Class = function(){};
var initializing = false,
fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
// The base Class implementation (does nothing)
openerp.base.Class = function(){};
// Create a new Class that inherits from this class
openerp.base.Class.extend = function(prop) {
var _super = this.prototype;
// Create a new Class that inherits from this class
openerp.base.Class.extend = function(prop) {
var _super = this.prototype;
// Instantiate a base class (but only create the instance,
// don't run the init constructor)
initializing = true;
var prototype = new this();
initializing = false;
// Instantiate a base class (but only create the instance,
// don't run the init constructor)
initializing = true;
var prototype = new this();
initializing = false;
// Copy the properties over onto the new prototype
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
(function(name, fn){
return function() {
var tmp = this._super;
// Copy the properties over onto the new prototype
for (var name in prop) {
// Check if we're overwriting an existing function
prototype[name] = typeof prop[name] == "function" &&
typeof _super[name] == "function" &&
fnTest.test(prop[name]) ?
(function(name, fn) {
return function() {
var tmp = this._super;
// Add a new ._super() method that is the same method
// but on the super-class
this._super = _super[name];
// Add a new ._super() method that is the same
// method but on the super-class
this._super = _super[name];
// The method only need to be bound temporarily, so we
// remove it when we're done executing
var ret = fn.apply(this, arguments);
this._super = tmp;
// The method only need to be bound temporarily, so
// we remove it when we're done executing
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
};
})(name, prop[name]) :
prop[name];
}
return ret;
};
})(name, prop[name]) :
prop[name];
}
// The dummy class constructor
function Class() {
// All construction is actually done in the init method
if ( !initializing && this.init ) {
var ret = this.init.apply(this, arguments);
if (ret) { return ret; }
}
return this;
}
// The dummy class constructor
function Class() {
// All construction is actually done in the init method
if (!initializing && this.init) {
var ret = this.init.apply(this, arguments);
if (ret) { return ret; }
}
return this;
}
Class.include = function (properties) {
for (var name in properties) {
if (typeof properties[name] !== 'function'
|| !fnTest.test(properties[name])) {
prototype[name] = properties[name];
} else if (typeof prototype[name] === 'function'
&& prototype.hasOwnProperty(name)) {
prototype[name] = (function (name, fn, previous) {
return function () {
var tmp = this._super;
this._super = previous;
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
}
})(name, properties[name], prototype[name]);
} else if (typeof _super[name] === 'function') {
prototype[name] = (function (name, fn) {
return function () {
var tmp = this._super;
this._super = _super[name];
var ret = fn.apply(this, arguments);
this._super = tmp;
return ret;
}
})(name, properties[name]);
}
}
};
// Populate our constructed prototype object
Class.prototype = prototype;
// Populate our constructed prototype object
Class.prototype = prototype;
// Enforce the constructor to be what we expect
Class.constructor = Class;
// Enforce the constructor to be what we expect
Class.constructor = Class;
// And make this class extendable
Class.extend = arguments.callee;
// And make this class extendable
Class.extend = arguments.callee;
return Class;
};
return Class;
};
})();
openerp.base.callback = function(obj, method) {
+21 -10
View File
@@ -19,7 +19,7 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormVi
*/
init: function(parent, element_id, dataset, view_id, options) {
this._super(parent, element_id);
this.set_default_options();
this.set_default_options(options);
this.dataset = dataset;
this.model = dataset.model;
this.view_id = view_id;
@@ -36,7 +36,6 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormVi
this.registry = openerp.base.form.widgets;
this.has_been_loaded = $.Deferred();
this.$form_header = null;
this.options = options || {};
_.defaults(this.options, {"always_show_new_button": true});
},
start: function() {
@@ -156,7 +155,7 @@ openerp.base.FormView = openerp.base.View.extend( /** @lends openerp.base.FormVi
if (this.sidebar) {
this.sidebar.attachments.do_update();
}
if (this.default_focus_field) {
if (this.default_focus_field && !this.embedded_view) {
this.default_focus_field.focus();
}
},
@@ -679,6 +678,16 @@ openerp.base.form.WidgetNotebook = openerp.base.form.Widget.extend({
start: function() {
this._super.apply(this, arguments);
this.$element.tabs();
this.view.on_button_new.add_last(this.do_select_first_visible_tab);
},
do_select_first_visible_tab: function() {
for (var i = 0; i < this.pages.length; i++) {
var page = this.pages[i];
if (page.invisible === false) {
this.$element.tabs('select', page.index);
break;
}
}
}
});
@@ -696,8 +705,8 @@ openerp.base.form.WidgetNotebookPage = openerp.base.form.WidgetFrame.extend({
this.$element_tab = $('#' + this.element_tab_id);
},
update_dom: function() {
if (this.invisible) {
this.notebook.$element.tabs('select', 0);
if (this.invisible && this.index === this.notebook.$element.tabs('option', 'selected')) {
this.notebook.do_select_first_visible_tab();
}
this.$element_tab.toggle(!this.invisible);
this.$element.toggle(!this.invisible);
@@ -1306,7 +1315,7 @@ openerp.base.form.dialog = function(content, options) {
}, options || {});
options.autoOpen = true;
var dialog = new openerp.base.Dialog(null, options);
dialog.$dialog = $(content).dialog(dialog.options);
dialog.$dialog = $(content).dialog(dialog.dialog_options);
return dialog.$dialog;
}
@@ -1624,14 +1633,16 @@ openerp.base.form.FieldOne2Many = openerp.base.form.Field.extend({
modes = !!modes ? modes.split(",") : ["tree", "form"];
var views = [];
_.each(modes, function(mode) {
var view = {view_id: false, view_type: mode == "tree" ? "list" : mode};
var view = {
view_id: false,
view_type: mode == "tree" ? "list" : mode,
options: { sidebar : false }
};
if (self.field.views && self.field.views[mode]) {
view.embedded_view = self.field.views[mode];
}
if(view.view_type === "list") {
view.options = {
'selectable': self.multi_selection
};
view.options.selectable = self.multi_selection;
}
views.push(view);
});
+8 -13
View File
@@ -8,15 +8,11 @@ openerp.base.list.editable = function (openerp) {
// editability status of list rows
openerp.base.ListView.prototype.defaults.editable = null;
var old_init = openerp.base.ListView.prototype.init,
old_actual_search = openerp.base.ListView.prototype.do_actual_search,
old_add_record = openerp.base.ListView.prototype.do_add_record,
old_on_loaded = openerp.base.ListView.prototype.on_loaded;
// TODO: not sure second @lends on existing item is correct, to check
_.extend(openerp.base.ListView.prototype, /** @lends openerp.base.ListView# */{
openerp.base.ListView.include(/** @lends openerp.base.ListView# */{
init: function () {
var self = this;
old_init.apply(this, arguments);
this._super.apply(this, arguments);
$(this.groups).bind({
'edit': function (e, id, dataset) {
self.do_edit(dataset.index, id, dataset);
@@ -63,7 +59,7 @@ openerp.base.list.editable = function (openerp) {
*/
do_actual_search: function (results) {
this.set_editable(results.context['set_editable']);
old_actual_search.call(this, results);
this._super(results);
},
/**
* Replace do_add_record to handle editability (and adding new record
@@ -73,17 +69,17 @@ openerp.base.list.editable = function (openerp) {
if (this.options.editable) {
this.groups.new_record();
} else {
old_add_record.call(this);
this._super();
}
},
on_loaded: function (data, grouped) {
// tree/@editable takes priority on everything else if present.
this.options.editable = data.fields_view.arch.attrs.editable || this.options.editable;
return old_on_loaded.call(this, data, grouped);
return this._super(data, grouped);
}
});
_.extend(openerp.base.ListView.Groups.prototype, /** @lends openerp.base.ListView.Groups# */{
openerp.base.ListView.Groups.include(/** @lends openerp.base.ListView.Groups# */{
passtrough_events: openerp.base.ListView.Groups.prototype.passtrough_events + " edit saved",
new_record: function () {
// TODO: handle multiple children
@@ -91,11 +87,10 @@ openerp.base.list.editable = function (openerp) {
}
});
var old_list_row_clicked = openerp.base.ListView.List.prototype.row_clicked;
_.extend(openerp.base.ListView.List.prototype, /** @lends openerp.base.ListView.List */{
openerp.base.ListView.List.include(/** @lends openerp.base.ListView.List */{
row_clicked: function (event) {
if (!this.options.editable) {
return old_list_row_clicked.call(this, event);
return this._super(event);
}
this.edit_record();
},
+5 -12
View File
@@ -85,8 +85,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
* the default behaviors and possible options for the list view.
*
* @constructs
* @param view_manager
* @param session An OpenERP session object
* @param parent parent object
* @param element_id the id of the DOM elements this view should link itself to
* @param {openerp.base.DataSet} dataset the dataset the view should work with
* @param {String} view_id the listview's identifier, if any
@@ -102,16 +101,13 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
*/
init: function(parent, element_id, dataset, view_id, options) {
this._super(parent, element_id);
this.set_default_options();
this.view_manager = parent || new openerp.base.NullViewManager();
this.set_default_options(_.extend({}, this.defaults, options || {}));
this.dataset = dataset;
this.model = dataset.model;
this.view_id = view_id;
this.columns = [];
this.options = _.extend({}, this.defaults, options || {});
this.set_groups(new openerp.base.ListView.Groups(this));
if (this.dataset instanceof openerp.base.DataSetStatic) {
@@ -123,7 +119,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
/**
* Retrieves the view's number of records per page (|| section)
*
* options > defaults > view_manager.action.limit > indefinite
* options > defaults > indefinite
*
* @returns {Number|null}
*/
@@ -131,7 +127,6 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
if (this._limit === undefined) {
this._limit = (this.options.limit
|| this.defaults.limit
|| (this.view_manager.action || {}).limit
|| null);
}
return this._limit;
@@ -267,7 +262,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
})
.val(self._limit || 'NaN');
});
if (this.options.sidebar && this.options.sidebar_id) {
if (!this.sidebar && this.options.sidebar && this.options.sidebar_id) {
this.sidebar = new openerp.base.Sidebar(this, this.options.sidebar_id);
this.sidebar.start();
this.sidebar.add_toolbar(data.fields_view.toolbar);
@@ -389,9 +384,7 @@ openerp.base.ListView = openerp.base.View.extend( /** @lends openerp.base.ListVi
view = view || 'form';
this.dataset.index = index;
_.delay(_.bind(function () {
if(this.view_manager) {
this.view_manager.on_mode_switch(view);
}
this.do_switch_view(view);
}, this));
},
do_show: function () {
+13 -3
View File
@@ -130,13 +130,17 @@ openerp.base.ViewManager = openerp.base.Widget.extend({
this.$element.find('.oe_vm_switch button').click(function() {
self.on_mode_switch($(this).data('view-type'));
});
var views_ids = {};
_.each(this.views_src, function(view) {
self.views[view.view_type] = $.extend({}, view, {
controller : null,
options : _.extend({
sidebar_id : self.element_id + '_sidebar_' + view.view_type
}, self.flags)
sidebar_id : self.element_id + '_sidebar_' + view.view_type,
action : self.action,
action_views_ids : views_ids
}, self.flags, view.options || {})
});
views_ids[view.view_type] = view.view_id;
});
if (this.flags.views_switcher === false) {
this.$element.find('.oe_vm_switch').hide();
@@ -165,6 +169,7 @@ openerp.base.ViewManager = openerp.base.Widget.extend({
if (view.embedded_view) {
controller.set_embedded_view(view.embedded_view);
}
controller.do_switch_view.add_last(this.on_mode_switch);
if (view_type === 'list' && this.flags.search_view === false && this.action && this.action['auto_search']) {
// In case the search view is not instantiated: manually call ListView#search
var domains = !_(self.action.domain).isEmpty()
@@ -447,7 +452,9 @@ openerp.base.View = openerp.base.Widget.extend({
_.defaults(this.options, {
// All possible views options should be defaulted here
sidebar_id: null,
sidebar: true
sidebar: true,
action: null,
action_views_ids: {}
});
},
/**
@@ -510,6 +517,9 @@ openerp.base.View = openerp.base.Widget.extend({
*/
set_embedded_view: function(embedded_view) {
this.embedded_view = embedded_view;
this.options.sidebar = false;
},
do_switch_view: function(view) {
},
set_common_sidebar_sections: function(sidebar) {
sidebar.add_section('customize', "Customize", [
+138
View File
@@ -0,0 +1,138 @@
$(document).ready(function () {
var openerp;
module('base-class', {
setup: function () {
openerp = window.openerp.init();
window.openerp.base.core(openerp);
}
});
test('Basic class creation', function () {
var C = openerp.base.Class.extend({
foo: function () {
return this.somevar;
}
});
var instance = new C();
instance.somevar = 3;
ok(instance instanceof C);
strictEqual(instance.foo(), 3);
});
test('Class initialization', function () {
var C1 = openerp.base.Class.extend({
init: function () {
this.foo = 3;
}
});
var C2 = openerp.base.Class.extend({
init: function (arg) {
this.foo = arg;
}
});
var i1 = new C1(),
i2 = new C2(42);
strictEqual(i1.foo, 3);
strictEqual(i2.foo, 42);
});
test('Inheritance', function () {
var C0 = openerp.base.Class.extend({
foo: function () {
return 1;
}
});
var C1 = C0.extend({
foo: function () {
return 1 + this._super();
}
});
var C2 = C1.extend({
foo: function () {
return 1 + this._super();
}
});
strictEqual(new C0().foo(), 1);
strictEqual(new C1().foo(), 2);
strictEqual(new C2().foo(), 3);
});
test('In-place extension', function () {
var C0 = openerp.base.Class.extend({
foo: function () {
return 3;
},
qux: function () {
return 3;
},
bar: 3
});
C0.include({
foo: function () {
return 5;
},
qux: function () {
return 2 + this._super();
},
bar: 5,
baz: 5
});
strictEqual(new C0().bar, 5);
strictEqual(new C0().baz, 5);
strictEqual(new C0().foo(), 5);
strictEqual(new C0().qux(), 5);
});
test('In-place extension and inheritance', function () {
var C0 = openerp.base.Class.extend({
foo: function () { return 1; },
bar: function () { return 1; }
});
var C1 = C0.extend({
foo: function () { return 1 + this._super(); }
});
strictEqual(new C1().foo(), 2);
strictEqual(new C1().bar(), 1);
C1.include({
foo: function () { return 2 + this._super(); },
bar: function () { return 1 + this._super(); }
});
strictEqual(new C1().foo(), 4);
strictEqual(new C1().bar(), 2);
});
test('In-place extensions alter existing instances', function () {
var C0 = openerp.base.Class.extend({
foo: function () { return 1; },
bar: function () { return 1; }
});
var instance = new C0();
strictEqual(instance.foo(), 1);
strictEqual(instance.bar(), 1);
C0.include({
foo: function () { return 2; },
bar: function () { return 2 + this._super(); }
});
strictEqual(instance.foo(), 2);
strictEqual(instance.bar(), 3);
});
test('In-place extension of subclassed types', function () {
var C0 = openerp.base.Class.extend({
foo: function () { return 1; },
bar: function () { return 1; }
});
var C1 = C0.extend({
foo: function () { return 1 + this._super(); },
bar: function () { return 1 + this._super(); }
});
var instance = new C1();
strictEqual(instance.foo(), 2);
C0.include({
foo: function () { return 2; },
bar: function () { return 2 + this._super(); }
});
strictEqual(instance.foo(), 3);
strictEqual(instance.bar(), 4);
});
});
+1
View File
@@ -3,6 +3,7 @@ $(document).ready(function () {
module("form.widget", {
setup: function () {
openerp = window.openerp.init(true);
window.openerp.base.core(openerp);
window.openerp.base.chrome(openerp);
// views loader stuff
window.openerp.base.data(openerp);
-142
View File
@@ -1,142 +0,0 @@
$(document).ready(function () {
/**
* Tests a jQuery collection against a selector ("ands" the .is() of each
* member of the collection, instead of "or"-ing them)
*
* @param {jQuery} $c a jQuery collection object
* @param {String} selector the selector to test the collection against
*/
var are = function ($c, selector) {
return ($c.filter(function () { return $(this).is(selector); }).length
=== $c.length);
};
var fvg = {fields_view: {
'fields': [],
'arch': {
'attrs': {string: ''}
}
}};
var openerp;
module("ListView", {
setup: function () {
openerp = window.openerp.init(true);
window.openerp.base.chrome(openerp);
// views loader stuff
window.openerp.base.data(openerp);
window.openerp.base.views(openerp);
window.openerp.base.list(openerp);
window.openerp.base.form(openerp);
}
});
test('render selection checkboxes', 2, function () {
var listview = new openerp.base.ListView(
null, 'qunit-fixture', {model: null, ids: [null, null, null], index: 0});
listview.on_loaded(fvg);
listview.do_fill_table({records: [
{data: {id: {value: null}}},
{data: {id: {value: null}}},
{data: {id: {value: null}}}
]});
ok(are(listview.$element.find('tbody th'),
'.oe-record-selector'));
ok(are(listview.$element.find('tbody th input'),
':checkbox:not([name])'));
});
test('render no checkbox if selectable=false', 1, function () {
var listview = new openerp.base.ListView(
null, 'qunit-fixture', {model: null, ids: [null, null, null], index: 0}, false,
{selectable: false});
listview.on_loaded(fvg);
listview.do_fill_table({records: [
{data: {id: {value: null}}},
{data: {id: {value: null}}},
{data: {id: {value: null}}}
]});
equal(listview.$element.find('tbody th').length, 0);
});
test('select a bunch of records', 2, function () {
var listview = new openerp.base.ListView(
null, 'qunit-fixture', {model: null, ids: [1, 2, 3], index: 0});
listview.on_loaded(fvg);
listview.do_fill_table({records: [
{data: {id: {value: 1}}},
{data: {id: {value: 2}}},
{data: {id: {value: 3}}}
]});
// TODO: find less intrusive way to get selection count of list view?
listview.$element.find('tbody th input:eq(2)')
.attr('checked', true);
deepEqual(listview.list.get_selection(), [3]);
listview.$element.find('tbody th input:eq(1)')
.attr('checked', true);
deepEqual(listview.list.get_selection(), [2, 3]);
});
test('render deletion button if list is deletable', 1, function () {
var listview = new openerp.base.ListView(
null, 'qunit-fixture', {model: null, ids: [null, null, null], index: 0});
listview.on_loaded(fvg);
listview.do_fill_table({records: [
{data: {id: {value: null}}},
{data: {id: {value: null}}},
{data: {id: {value: null}}}
]});
equal(
listview.$element.find('tbody tr td.oe-record-delete button').length,
3);
});
test('deletion button should lead on deletion in the dataset',
2, function () {
var deleted;
var listview = new openerp.base.ListView(
null, 'qunit-fixture',
{model: null, unlink: function (ids) {
deleted = ids;
}, ids: [1, 2, 3], index: 0});
listview.on_loaded(fvg);
listview.do_fill_table({records: [
{data: {id: {value: 1}}},
{data: {id: {value: 2}}},
{data: {id: {value: 3}}}
]});
listview.$element.find('tbody td.oe-record-delete:eq(2) button').click();
deepEqual(deleted, [3]);
listview.$element.find('tbody td.oe-record-delete:eq(0) button').click();
deepEqual(deleted, [1]);
});
test('multiple records deletion', 1, function () {
var deleted;
var listview = new openerp.base.ListView(
null, 'qunit-fixture',
{model: null, unlink: function (ids) {
deleted = ids;
}, ids: [1, 2, 3], index: 0});
listview.on_loaded(fvg);
listview.do_fill_table({records: [
{data: {id: {value: 1}}},
{data: {id: {value: 2}}},
{data: {id: {value: 3}}}
]});
listview.$element.find('tbody th input:eq(2)')
.attr('checked', true);
listview.$element.find('tbody th input:eq(1)')
.attr('checked', true);
listview.$element.find('.oe-list-delete').click();
deepEqual(deleted, [2, 3]);
});
});
+1 -1
View File
@@ -3,7 +3,7 @@ $(document).ready(function () {
module('Registry', {
setup: function () {
openerp = window.openerp.init(true);
window.openerp.base.chrome(openerp);
window.openerp.base.core(openerp);
openerp.base.Foo = {};
openerp.base.Bar = {};
}
+1
View File
@@ -11,6 +11,7 @@ $(document).ready(function () {
module('search-date', {
setup: function () {
openerp = window.openerp.init(true);
window.openerp.base.core(openerp);
window.openerp.base.chrome(openerp);
window.openerp.base.views(openerp);
window.openerp.base.search(openerp);
+5 -5
View File
@@ -3,7 +3,7 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>OpenERP</title>
<link rel="shortcut icon" href="/openobject/static/images/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="/base/static/src/img/favicon.ico" type="image/x-icon"/>
<link rel="stylesheet" href="/base/static/lib/qunit/qunit-2011-23-22.css">
<script src="/base/static/lib/qunit/qunit-2011-23-22.js" type="text/javascript"></script>
@@ -11,18 +11,18 @@
<script src="/base/static/lib/underscore/underscore.js" type="text/javascript"></script>
<!-- jquery -->
<script src="/base/static/lib/jquery/jquery-1.5.2.js"></script>
<script src="/base/static/lib/jquery/jquery-1.6.2.js"></script>
<script src="/base/static/lib/jquery.ui/js/jquery-ui-1.8.9.custom.min.js"></script>
<script src="/base/static/lib/qweb/qweb.js"></script>
<script src="/base/static/src/js/base.js"></script>
<script src="/base/static/src/js/boot.js"></script>
<script src="/base/static/src/js/core.js"></script>
<script src="/base/static/src/js/dates.js"></script>
<script src="/base/static/src/js/chrome.js"></script>
<script src="/base/static/src/js/data.js"></script>
<script src="/base/static/src/js/views.js"></script>
<script src="/base/static/src/js/search.js"></script>
<script src="/base/static/src/js/m2o.js"></script>
<script src="/base/static/src/js/form.js"></script>
<script src="/base/static/src/js/list.js"></script>
<script type="text/javascript">
@@ -37,8 +37,8 @@
<ol id="qunit-tests"></ol>
<div id="qunit-fixture"></div>
</body>
<script type="text/javascript" src="/base/static/test/class.js"></script>
<script type="text/javascript" src="/base/static/test/registry.js"></script>
<script type="text/javascript" src="/base/static/test/search-date.js"></script>
<script type="text/javascript" src="/base/static/test/form.js"></script>
<script type="text/javascript" src="/base/static/test/list.js"></script>
</html>
@@ -9,7 +9,7 @@ openerp.base_calendar.CalendarView = openerp.base.View.extend({
// Dhtmlx scheduler ?
init: function(parent, element_id, dataset, view_id, options) {
this._super(parent, element_id);
this.set_default_options();
this.set_default_options(options);
this.dataset = dataset;
this.model = dataset.model;
this.view_id = view_id;
@@ -276,10 +276,10 @@ openerp.base_calendar.CalendarView = openerp.base.View.extend({
do_delete_event: function(event_id, event_obj) {
// dhtmlx sends this event even when it does not exist in openerp.
// Eg: use cancel in dhtmlx new event dialog
if (_.indexOf(this.dataset.ids, event_id) > -1) {
this.dataset.unlink(parseInt(event_id, 10, function() {
if (_.indexOf(this.dataset.ids, parseInt(event_id, 10)) > -1) {
this.dataset.unlink(parseInt(event_id, 10), function() {
self.refresh_minical();
}));
});
}
},
get_event_data: function(event_obj) {
@@ -244,8 +244,8 @@ openerp.base.form.DashBoard = openerp.base.form.Widget.extend({
return QWeb.render(this.template, this);
},
do_reload: function() {
this.view.view_manager.stop();
this.view.view_manager.start();
this.view.widget_parent.stop();
this.view.widget_parent.start();
}
});
openerp.base.form.DashBoardLegacy = openerp.base.form.DashBoard.extend({
@@ -1,8 +1,6 @@
openerp.base_default_home = function (openerp) {
QWeb.add_template('/base_default_home/static/src/xml/base_default_home.xml');
var old_home = openerp.base.WebClient.prototype.default_home;
openerp.base_default_home = {
applications: [
[
@@ -51,9 +49,14 @@ openerp.base_default_home = function (openerp) {
]
};
_.extend(openerp.base.WebClient.prototype, {
openerp.base.WebClient.include({
default_home: function () {
var self = this;
var self = this,
// resig class can't handle _super in async contexts, by the
// time async callback comes back, _super has already been
// reset to a baseline value of this.prototype (or something
// like that)
old_home = this._super;
var Installer = new openerp.base.DataSet(
this, 'base.setup.installer');
Installer.call('already_installed', [], function (installed_modules) {
+1 -1
View File
@@ -88,7 +88,7 @@ initializing the addon.
/** @namespace */
openerp.example = function (openerp) {
// basic initialization code (e.g. templates loading)
openerp.example.SomeClass = Class.extend(
openerp.example.SomeClass = openerp.base.Class.extend(
/** @lends openerp.example.SomeClass# */{
/**
* Description for SomeClass's constructor here