summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBhumi Thakkar (Open ERP) <bth@tinyerp.com>2011-08-16 11:05:52 +0530
committerBhumi Thakkar (Open ERP) <bth@tinyerp.com>2011-08-16 11:05:52 +0530
commit08cf0f2fb08a5d3af57a0aa77e73b5fb9da028e7 (patch)
treed2758d340d58bd655dc6362d7cab82d68399805a
parent28ffaba5ab94e5d28cd2c81c0518a998257074de (diff)
parenta4f9eb398b39978be8c35a8eb2e1eb561ef26ecf (diff)
[MERGE] Merge trunk in mobile-client.
bzr revid: bth@tinyerp.com-20110816053552-e36jsh9h7hvyzhes
-rw-r--r--addons/base/controllers/main.py8
-rw-r--r--addons/base/static/src/js/core.js53
-rw-r--r--addons/base/static/src/js/formats.js2
-rw-r--r--addons/base/static/src/js/list.js4
-rw-r--r--addons/base/static/src/js/search.js15
-rw-r--r--addons/base_gantt/static/src/js/gantt.js190
-rw-r--r--doc/source/addons.rst291
-rw-r--r--doc/source/development.rst12
8 files changed, 237 insertions, 338 deletions
diff --git a/addons/base/controllers/main.py b/addons/base/controllers/main.py
index 4f6b3ea4f70..36db03d6bba 100644
--- a/addons/base/controllers/main.py
+++ b/addons/base/controllers/main.py
@@ -772,8 +772,8 @@ class View(openerpweb.Controller):
""" Parses an arbitrary string containing a domain, transforms it
to either a literal domain or a :class:`openerpweb.nonliterals.Domain`
- :param domain: the domain to parse, if the domain is not a string it is assumed to
- be a literal domain and is returned as-is
+ :param domain: the domain to parse, if the domain is not a string it
+ is assumed to be a literal domain and is returned as-is
:param session: Current OpenERP session
:type session: openerpweb.openerpweb.OpenERPSession
"""
@@ -789,8 +789,8 @@ class View(openerpweb.Controller):
""" Parses an arbitrary string containing a context, transforms it
to either a literal context or a :class:`openerpweb.nonliterals.Context`
- :param context: the context to parse, if the context is not a string it is assumed to
- be a literal domain and is returned as-is
+ :param context: the context to parse, if the context is not a string it
+ is assumed to be a literal domain and is returned as-is
:param session: Current OpenERP session
:type session: openerpweb.openerpweb.OpenERPSession
"""
diff --git a/addons/base/static/src/js/core.js b/addons/base/static/src/js/core.js
index 859c96645a1..da9b5abf3e8 100644
--- a/addons/base/static/src/js/core.js
+++ b/addons/base/static/src/js/core.js
@@ -373,59 +373,6 @@ openerp.base.SessionAware = openerp.base.Class.extend({
}
});
-/**
- * Base class for all visual components. Provides a lot of functionalities helpful
- * for the management of a part of the DOM.
- *
- * Widget handles:
- * - Rendering with QWeb.
- * - Life-cycle management and parenting (when a parent is destroyed, all its children are
- * destroyed too).
- * - Insertion in DOM.
- *
- * Widget also extends SessionAware for ease of use.
- *
- * Guide to create implementations of the Widget class:
- * ==============================================
- *
- * Here is a sample child class:
- *
- * MyWidget = openerp.base.Widget.extend({
- * // the name of the QWeb template to use for rendering
- * template: "MyQWebTemplate",
- * // identifier prefix, it is useful to put an obvious one for debugging
- * identifier_prefix: 'my-id-prefix-',
- *
- * init: function(parent) {
- * this._super(parent);
- * // stuff that you want to init before the rendering
- * },
- * start: function() {
- * this._super();
- * // stuff you want to make after the rendering, `this.$element` holds a correct value
- * this.$element.find(".my_button").click(/* an example of event binding * /);
- *
- * // if you have some asynchronous operations, it's a good idea to return
- * // a promise in start()
- * var promise = this.rpc(...);
- * return promise;
- * }
- * });
- *
- * Now this class can simply be used with the following syntax:
- *
- * var my_widget = new MyWidget(this);
- * my_widget.appendTo($(".some-div"));
- *
- * With these two lines, the MyWidget instance was inited, rendered, it was inserted into the
- * DOM inside the ".some-div" div and its events were binded.
- *
- * And of course, when you don't need that widget anymore, just do:
- *
- * my_widget.stop();
- *
- * That will kill the widget in a clean way and erase its content from the dom.
- */
openerp.base.Widget = openerp.base.SessionAware.extend({
/**
* The name of the QWeb template that will be used for rendering. Must be
diff --git a/addons/base/static/src/js/formats.js b/addons/base/static/src/js/formats.js
index fb1ada544a4..074cabe5eee 100644
--- a/addons/base/static/src/js/formats.js
+++ b/addons/base/static/src/js/formats.js
@@ -83,7 +83,7 @@ openerp.base.parse_time = function(str) {
*/
var zpad = function(str, size) {
str = "" + str;
- return new Array(size - str.length).join('0') + str;
+ return new Array(size - str.length + 1).join('0') + str;
};
/**
diff --git a/addons/base/static/src/js/list.js b/addons/base/static/src/js/list.js
index 3032e702a73..a0440221520 100644
--- a/addons/base/static/src/js/list.js
+++ b/addons/base/static/src/js/list.js
@@ -772,7 +772,7 @@ openerp.base.ListView.List = openerp.base.Class.extend( /** @lends openerp.base.
var old_index = this.dataset.index;
this.dataset.index = record_index;
read_p = this.dataset.read_index(
- _.filter(_.pluck(this.columns, 'name'), _.identity),
+ _.pluck(_(this.columns).filter(function (r) {return r.tag === 'field';}), 'name'),
function (record) {
var form_record = self.transform_record(record);
self.rows.splice(record_index, 1, form_record);
@@ -1035,7 +1035,7 @@ openerp.base.ListView.Groups = openerp.base.Class.extend( /** @lends openerp.bas
page = this.datagroup.openable ? this.page : view.page;
dataset.read_slice({
- fields: _.filter(_.pluck(_.select(this.columns, function(x) {return x.tag == "field";}), 'name'), _.identity),
+ fields: _.pluck(_.select(this.columns, function(x) {return x.tag == "field"}), 'name'),
offset: page * limit,
limit: limit
}, function (records) {
diff --git a/addons/base/static/src/js/search.js b/addons/base/static/src/js/search.js
index 4b746832a65..63ccec088a6 100644
--- a/addons/base/static/src/js/search.js
+++ b/addons/base/static/src/js/search.js
@@ -875,11 +875,10 @@ openerp.base.search.ExtendedSearchGroup = openerp.base.OldWidget.extend({
this._super();
var _this = this;
this.add_prop();
- this.$element.find('.searchview_extended_add_proposition').click(function (e) {
+ this.$element.find('.searchview_extended_add_proposition').click(function () {
_this.add_prop();
});
- var delete_btn = this.$element.find('.searchview_extended_delete_group');
- delete_btn.click(function (e) {
+ this.$element.find('.searchview_extended_delete_group').click(function () {
_this.stop();
});
},
@@ -889,7 +888,7 @@ openerp.base.search.ExtendedSearchGroup = openerp.base.OldWidget.extend({
}).compact().value();
var choice = this.$element.find(".searchview_extended_group_choice").val();
var op = choice == "all" ? "&" : "|";
- return [].concat(choice == "none" ? ['!'] : [],
+ return choice == "none" ? ['!'] : [].concat(
_.map(_.range(_.max([0,props.length - 1])), function() { return op; }),
props);
},
@@ -901,10 +900,7 @@ openerp.base.search.ExtendedSearchGroup = openerp.base.OldWidget.extend({
parent.check_last_element();
},
set_last_group: function(is_last) {
- if(is_last)
- this.$element.addClass("last_group");
- else
- this.$element.removeClass("last_group");
+ this.$element.toggleClass('last_group', is_last);
}
});
@@ -927,8 +923,7 @@ openerp.base.search.ExtendedSearchProposition = openerp.base.OldWidget.extend({
this.$element.find(".searchview_extended_prop_field").change(function() {
_this.changed();
});
- var delete_btn = this.$element.find('.searchview_extended_delete_prop');
- delete_btn.click(function (e) {
+ this.$element.find('.searchview_extended_delete_prop').click(function () {
_this.stop();
});
},
diff --git a/addons/base_gantt/static/src/js/gantt.js b/addons/base_gantt/static/src/js/gantt.js
index 4a38747bf8a..307dc94c6b8 100644
--- a/addons/base_gantt/static/src/js/gantt.js
+++ b/addons/base_gantt/static/src/js/gantt.js
@@ -1,16 +1,14 @@
/*---------------------------------------------------------
* OpenERP base_gantt
*---------------------------------------------------------*/
-
openerp.base_gantt = function (openerp) {
QWeb.add_template('/base_gantt/static/src/xml/base_gantt.xml');
openerp.base.views.add('gantt', 'openerp.base_gantt.GanttView');
-openerp.base_gantt.GanttView = openerp.base.Widget.extend({
-
-init: function(view_manager, session, element_id, dataset, view_id) {
+openerp.base_gantt.GanttView = openerp.base.View.extend({
- this._super(session, element_id);
- this.view_manager = view_manager;
+init: function(parent, element_id, dataset, view_id) {
+ this._super(parent, element_id);
+ this.view_manager = parent || new openerp.base.NullViewManager();
this.dataset = dataset;
this.model = dataset.model;
this.view_id = view_id;
@@ -29,7 +27,7 @@ init: function(view_manager, session, element_id, dataset, view_id) {
this.calendar_fields = {};
this.info_fields = [];
this.domain = this.dataset._domain ? this.dataset._domain: [];
- this.context = {};
+ this.context = this.dataset.context || {};
},
start: function() {
@@ -52,8 +50,8 @@ init: function(view_manager, session, element_id, dataset, view_id) {
this.color_field = this.fields_view.arch.attrs.color;
this.day_length = this.fields_view.arch.attrs.day_length || 8;
this.colors = this.fields_view.arch.attrs.colors;
-
- this.text = this.fields_view.arch.children[0].children[0].attrs.name;
+ var arch_children = this.fields_view.arch.children[0];
+ this.text = arch_children.children[0] ? arch_children.children[0].attrs.name : arch_children.attrs.name;
this.parent = this.fields_view.arch.children[0].attrs.link;
this.format = "yyyy-MM-dd";
@@ -100,7 +98,7 @@ init: function(view_manager, session, element_id, dataset, view_id) {
if (result.length != 0){
var show_event = [];
- for (i in result){
+ for (var i in result){
var res = result[i];
if (res[this.date_start] != false){
@@ -132,7 +130,7 @@ init: function(view_manager, session, element_id, dataset, view_id) {
var child_event = {};
var temp_id = "";
var final_events = [];
- for (i in show_event) {
+ for (var i in show_event) {
var res = show_event[i];
@@ -161,11 +159,8 @@ init: function(view_manager, session, element_id, dataset, view_id) {
if (duration == false)
duration = 0
- if (self.grp.length == 0){
- self.grp.push({'group_by' : this.parent})
- }
- if (self.grp != undefined){
- for (j in self.grp){
+ if (self.grp.length){
+ for (var j in self.grp){
var grp_key = res[self.grp[j]['group_by']];
if (typeof(grp_key) == "object"){
grp_key = res[self.grp[j]['group_by']][1];
@@ -175,7 +170,7 @@ init: function(view_manager, session, element_id, dataset, view_id) {
}
if (grp_key == false){
- grp_key = "False";
+ grp_key = "Undefined";
}
if (j == 0){
@@ -207,9 +202,17 @@ init: function(view_manager, session, element_id, dataset, view_id) {
all_events[id] = {'parent': temp_id, 'evt':[id , text, start_date, duration, 100, "", color_box[color]]};
final_events.push(id);
}
+ else {
+ if (i == 0) {
+ var mod_id = "_" + i;
+ all_events[mod_id] = {'parent': "", 'evt': [mod_id, this.name, start_date, start_date, 100, "", "white"]};
+ }
+ all_events[id] = {'parent': mod_id, 'evt':[id , text, start_date, duration, 100, "", color_box[color]]};
+ final_events.push(id);
+ }
}
- for (i in final_events){
+ for (var i in final_events){
var evt_id = final_events[i];
var evt_date = all_events[evt_id]['evt'][2];
while (all_events[evt_id]['parent'] != "") {
@@ -225,7 +228,7 @@ init: function(view_manager, session, element_id, dataset, view_id) {
var evt_duration = "";
var evt_end_date = "";
- for (i in final_events){
+ for (var i in final_events){
evt_id = final_events[i];
evt_date = all_events[evt_id]['evt'][2];
evt_duration = all_events[evt_id]['evt'][3];
@@ -242,42 +245,27 @@ init: function(view_manager, session, element_id, dataset, view_id) {
}
}
- for (j in self.grp){
- for (i in all_events){
- res = all_events[i];
- if ((typeof(res['evt'][3])) == "object"){
- res['evt'][3] = self.hours_between(res['evt'][2],res['evt'][3]);
- }
+ for (var j in self.grp) {
+ self.render_events(all_events, j);
+ }
- k = res['evt'][0].toString().indexOf('_');
- if (k != -1){
- if (res['evt'][0].substring(k) == "_"+j){
- if (j == 0){
- task = new GanttTaskInfo(res['evt'][0], res['evt'][1], res['evt'][2], res['evt'][3], res['evt'][4], "",res['evt'][6]);
- project.addTask(task);
- } else {
- task = new GanttTaskInfo(res['evt'][0], res['evt'][1], res['evt'][2], res['evt'][3], res['evt'][4], "",res['evt'][6]);
- prt = project.getTaskById(res['parent']);
- prt.addChildTask(task);
- }
- }
- }
- }
+ if (!self.grp.length) {
+ self.render_events(all_events, 0);
}
- for (i in final_events){
+
+ for (var i in final_events){
evt_id = final_events[i];
res = all_events[evt_id];
-
task=new GanttTaskInfo(res['evt'][0], res['evt'][1], res['evt'][2], res['evt'][3], res['evt'][4], "",res['evt'][6]);
prt = project.getTaskById(res['parent']);
prt.addChildTask(task);
}
- oth_hgt = 264;
- min_hgt = 150;
- name_min_wdt = 150;
- gantt_hgt = jQuery(window).height() - oth_hgt;
- search_wdt = jQuery("#oe_app_search").width();
+ var oth_hgt = 264;
+ var min_hgt = 150;
+ var name_min_wdt = 150;
+ var gantt_hgt = jQuery(window).height() - oth_hgt;
+ var search_wdt = jQuery("#oe_app_search").width();
if (gantt_hgt > min_hgt){
jQuery('#GanttDiv').height(gantt_hgt).width(search_wdt);
@@ -291,13 +279,13 @@ init: function(view_manager, session, element_id, dataset, view_id) {
ganttChartControl.attachEvent("onTaskEndDrag", function(task) {self.on_resize_drag_end(task, "drag");});
ganttChartControl.attachEvent("onTaskDblClick", function(task) {self.open_popup(task);});
- taskdiv = jQuery("div.taskPanel").parent();
+ var taskdiv = jQuery("div.taskPanel").parent();
taskdiv.addClass('ganttTaskPanel');
taskdiv.prev().addClass('ganttDayPanel');
- $gantt_panel = jQuery(".ganttTaskPanel , .ganttDayPanel");
+ var $gantt_panel = jQuery(".ganttTaskPanel , .ganttDayPanel");
- ganttrow = jQuery('.taskPanel').closest('tr');
- gtd = ganttrow.children(':first-child');
+ var ganttrow = jQuery('.taskPanel').closest('tr');
+ var gtd = ganttrow.children(':first-child');
gtd.children().addClass('task-name');
jQuery(".toggle-sidebar").click(function(e) {
@@ -319,9 +307,8 @@ init: function(view_manager, session, element_id, dataset, view_id) {
$gantt_panel.width(1);
jQuery(".ganttTaskPanel").parent().width(1);
- search_wdt = jQuery("#oe_app_search").width();
- day_wdt = jQuery(".ganttDayPanel").children().children().width();
- name_wdt = jQuery('.task-name').width();
+ var search_wdt = jQuery("#oe_app_search").width();
+ var day_wdt = jQuery(".ganttDayPanel").children().children().width();
jQuery('#GanttDiv').css('width','100%');
if (search_wdt - day_wdt <= name_min_wdt){
@@ -345,7 +332,7 @@ init: function(view_manager, session, element_id, dataset, view_id) {
var self = this;
- dat = this.convert_str_date(dat);
+ var dat = this.convert_str_date(dat);
var day = Math.floor(duration/self.day_length);
var hrs = duration % self.day_length;
@@ -356,47 +343,98 @@ init: function(view_manager, session, element_id, dataset, view_id) {
return dat;
},
- hours_between: function(date1, date2) {
+ hours_between: function(date1, date2, parent_task) {
var ONE_DAY = 1000 * 60 * 60 * 24;
var date1_ms = date1.getTime();
var date2_ms = date2.getTime();
var difference_ms = Math.abs(date1_ms - date2_ms);
- d = Math.floor(difference_ms / ONE_DAY);
- h = (difference_ms % ONE_DAY)/(1000 * 60 * 60);
- num = (d * this.day_length) + h;
+ var d = parent_task? Math.ceil(difference_ms / ONE_DAY) : Math.floor(difference_ms / ONE_DAY);
+ var h = (difference_ms % ONE_DAY)/(1000 * 60 * 60);
+ var num = (d * this.day_length) + h;
return parseFloat(num.toFixed(2));
},
+ render_events : function(all_events, j) {
+
+ var self = this;
+ for (var i in all_events){
+ var res = all_events[i];
+ if ((typeof(res['evt'][3])) == "object"){
+ res['evt'][3] = self.hours_between(res['evt'][2],res['evt'][3], true);
+ }
+
+ k = res['evt'][0].toString().indexOf('_');
+
+ if (k != -1) {
+ if (res['evt'][0].substring(k) == "_"+j){
+ if (j == 0){
+ task = new GanttTaskInfo(res['evt'][0], res['evt'][1], res['evt'][2], res['evt'][3], res['evt'][4], "",res['evt'][6]);
+ project.addTask(task);
+ } else {
+ task = new GanttTaskInfo(res['evt'][0], res['evt'][1], res['evt'][2], res['evt'][3], res['evt'][4], "",res['evt'][6]);
+ prt = project.getTaskById(res['parent']);
+ prt.addChildTask(task);
+ }
+ }
+ }
+ }
+ },
+
open_popup : function(task) {
var event_id = task.getId();
-
if(event_id.toString().search("_") != -1)
return;
- if (event_id) {
- event_id = parseInt(event_id, 10);
- var dataset_event_index = jQuery.inArray(event_id, this.ids);
- } else {
- var dataset_event_index = null;
+ if(event_id) event_id = parseInt(event_id, 10);
+
+ var action = {
+ "res_model": this.dataset.model,
+ "res_id": event_id,
+ "views":[[false,"form"]],
+ "type":"ir.actions.act_window",
+ "view_type":"form",
+ "view_mode":"form"
}
- this.dataset.index = dataset_event_index;
+
+ action.flags = {
+ search_view: false,
+ sidebar : false,
+ views_switcher : false,
+ pager: false
+ }
var element_id = _.uniqueId("act_window_dialog");
- var dialog = jQuery('<div>',
- {'id': element_id
- }).dialog({
- title: 'Gantt Chart',
- modal: true,
- minWidth: 800,
- position: 'top'
- });
- var event_form = new openerp.base.FormView(this.view_manager, this.session, element_id, this.dataset, false);
- event_form.start();
+ var dialog = jQuery('<div>', {
+ 'id': element_id
+ }).dialog({
+ modal: true,
+ width: 'auto',
+ height: 'auto',
+ buttons: {
+ Cancel: function() {
+ $(this).dialog("destroy");
+ },
+ Save: function() {
+ var view_manager = action_manager.viewmanager;
+ var _dialog = this;
+ view_manager.views[view_manager.active_view].controller.do_save(function(r) {
+ $(_dialog).dialog("destroy");
+ self.reload_gantt();
+ })
+ }
+ }
+ });
+ var action_manager = new openerp.base.ActionManager(this, element_id);
+ action_manager.start();
+ action_manager.do_action(action);
+
+ //Default_get
+ if(!event_id) action_manager.viewmanager.dataset.index = null;
},
on_drag_start : function(task){
- st_date = task.getEST();
+ var st_date = task.getEST();
if(st_date.getHours()){
self.hh = st_date.getHours();
self.mm = st_date.getMinutes();
diff --git a/doc/source/addons.rst b/doc/source/addons.rst
index 4f371192760..7261e57ebd3 100644
--- a/doc/source/addons.rst
+++ b/doc/source/addons.rst
@@ -113,6 +113,98 @@ initializing the addon.
Creating new standard roles
---------------------------
+Widget
+++++++
+
+This is the base class for all visual components. It provides a number of
+services for the management of a DOM subtree:
+
+* Rendering with QWeb
+
+* Parenting-child relations
+
+* Life-cycle management (including facilitating children destruction when a
+ parent object is removed)
+
+* DOM insertion, via jQuery-powered insertion methods. Insertion targets can
+ be anything the corresponding jQuery method accepts (generally selectors,
+ DOM nodes and jQuery objects):
+
+ :js:func:`~openerp.base.Widget.appendTo`
+ Renders the widget and inserts it as the last child of the target, uses
+ `.appendTo()`_
+
+ :js:func:`~openerp.base.Widget.prependTo`
+ Renders the widget and inserts it as the first child of the target, uses
+ `.prependTo()`_
+
+ :js:func:`~openerp.base.Widget.insertAfter`
+ Renders the widget and inserts it as the preceding sibling of the target,
+ uses `.insertAfter()`_
+
+ :js:func:`~openerp.base.Widget.insertBefore`
+ Renders the widget and inserts it as the following sibling of the target,
+ uses `.insertBefore()`_
+
+:js:class:`~openerp.base.Widget` inherits from
+:js:class:`~openerp.base.SessionAware`, so subclasses can easily access the
+RPC layers.
+
+Subclassing Widget
+~~~~~~~~~~~~~~~~~~
+
+:js:class:`~openerp.base.Widget` is subclassed in the standard manner (via the
+:js:func:`~openerp.base.Class.extend` method), and provides a number of
+abstract properties and concrete methods (which you may or may not want to
+override). Creating a subclass looks like this:
+
+.. code-block:: javascript
+
+ var MyWidget = openerp.base.Widget.extend({
+ // QWeb template to use when rendering the object
+ template: "MyQWebTemplate",
+ // autogenerated id prefix, specificity helps when debugging
+ identifier_prefix: 'my-id-prefix-',
+
+ init: function(parent) {
+ this._super(parent);
+ // insert code to execute before rendering, for object
+ // initialization
+ },
+ start: function() {
+ this._super();
+ // post-rendering initialization code, at this point
+ // ``this.$element`` has been initialized
+ this.$element.find(".my_button").click(/* an example of event binding * /);
+
+ // if ``start`` is asynchronous, return a promise object so callers
+ // know when the object is done initializing
+ return this.rpc(/* … */)
+ }
+ });
+
+The new class can then be used in the following manner:
+
+.. code-block:: javascript
+
+ // Create the instance
+ var my_widget = new MyWidget(this);
+ // Render and insert into DOM
+ my_widget.appendTo(".some-div");
+
+After these two lines have executed (and any promise returned by ``appendTo``
+has been resolved if needed), the widget is ready to be used.
+
+If the widget is not needed anymore (because it's transient), simply terminate
+it:
+
+.. code-block:: javascript
+
+ my_widget.stop();
+
+will unbind all DOM events, remove the widget's content from the DOM and
+destroy all widget data.
+
Views
+++++
@@ -236,193 +328,6 @@ replace ``addons`` by the directory in which your own addon lives.
and run ``nosetests addons`` instead of the ``unit2`` command,
the result should be exactly the same.
-APIs
-----
-
-Javascript
-++++++++++
-
-.. js:class:: openerp.base.Widget(view, node)
-
- :param openerp.base.Controller view: The view to which the widget belongs
- :param Object node: the ``fields_view_get`` descriptor for the widget
-
- .. js:attribute:: $element
-
- The widget's root element as jQuery object
-
-.. js:class:: openerp.base.DataSet(session, model)
-
- :param openerp.base.Session session: the RPC session object
- :param String model: the model managed by this dataset
-
- The DataSet is the abstraction for a sequence of records stored in
- database.
-
- It provides interfaces for reading records based on search
- criteria, and for selecting and fetching records based on
- activated ids.
-
- .. js:function:: fetch([offset][, limit])
-
- :param Number offset: the index from which records should start
- being returned (section)
- :param Number limit: the maximum number of records to return
- :returns: the dataset instance it was called on
-
- Asynchronously fetches the records selected by the DataSet's
- domain and context, in the provided sort order if any.
-
- Only fetches the fields selected by the DataSet.
-
- On success, triggers :js:func:`on_fetch`
-
- .. js:function:: on_fetch(records, event)
-
- :param Array records: an array of
- :js:class:`openerp.base.DataRecord`
- matching the DataSet's selection
- :param event: a data holder letting the event handler fetch
- meta-informations about the event.
- :type event: OnFetchEvent
-
- Fired after :js:func:`fetch` is done fetching the records
- selected by the DataSet.
-
- .. js:function:: active_ids
-
- :returns: the dataset instance it was called on
-
- Asynchronously fetches the active records for this DataSet.
-
- On success, triggers :js:func:`on_active_ids`
-
- .. js:function:: on_active_ids(records)
-
- :param Array records: an array of
- :js:class:`openerp.base.DataRecord`
- matching the currently active ids
-
- Fired after :js:func:`active_ids` fetched the records matching
- the DataSet's active ids.
-
- .. js:function:: active_id
-
- :returns: the dataset instance in was called on
-
- Asynchronously fetches the current active record.
-
- On success, triggers :js:func:`on_active_id`
-
- .. js:function:: on_active_id(record)
-
- :param Object record: the record fetched by
- :js:func:`active_id`, or ``null``
- :type record: openerp.base.DataRecord
-
- Fired after :js:func:`active_id` fetched the record matching
- the dataset's active id
-
- .. js:function:: set(options)
-
- :param Object options: the options to set on the dataset
- :type options: DataSetOptions
- :returns: the dataset instance it was called on
-
- Configures the data set by setting various properties on it
-
- .. js:function:: prev
-
- :returns: the dataset instance it was called on
-
- Activates the id preceding the current one in the active ids
- sequence of the dataset.
-
- If the current active id is at the start of the sequence,
- wraps back to the last id of the sequence.
-
- .. js:function:: next
-
- :returns: the dataset instance it was called on
-
- Activates the id following the current one in the active ids
- sequence.
-
- If the current active id is the last of the sequence, wraps
- back to the beginning of the active ids sequence.
-
- .. js:function:: select(ids)
-
- :param Array ids: the identifiers to activate on the dataset
- :returns: the dataset instance it was called on
-
- Activates all the ids specified in the dataset, resets the
- current active id to be the first id of the new sequence.
-
- The internal order will be the same as the ids list provided.
-
- .. js:function:: get_active_ids
-
- :returns: the list of current active ids for the dataset
-
- .. js:function:: activate(id)
-
- :param Number id: the id to activate
- :returns: the dataset instance it was called on
-
- Activates the id provided in the dataset. If no ids are
- selected, selects the id in the dataset.
-
- If ids are already selected and the provided id is not in that
- selection, raises an error.
-
- .. js:function:: get_active_id
-
- :returns: the dataset's current active id
-
-Ad-hoc objects and structural types
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-These objects are not associated with any specific class, they're
-generally literal objects created on the spot. Names are merely
-convenient ways to refer to them and their properties.
-
-.. js:class:: OnFetchEvent
-
- .. js:attribute:: context
-
- The context used for the :js:func:`fetch` call (domain set on
- the :js:class:`openerp.base.DataSet` when ``fetch`` was
- called)
-
- .. js:attribute:: domain
-
- The domain used for the :js:func:`fetch` call
-
- .. js:attribute:: limit
-
- The limit with which the original :js:func:`fetch` call was
- performed
-
- .. js:attribute:: offset
-
- The offset with which the original :js:func:`fetch` call was
- performed
-
- .. js:attribute:: sort
-
- The sorting criteria active on the
- :js:class:`openerp.base.DataSet` when :js:func:`fetch` was
- called
-
-.. js:class:: DataSetOptions
-
- .. js:attribute:: context
-
- .. js:attribute:: domain
-
- .. js:attribute:: sort
-
Python
++++++
@@ -499,3 +404,15 @@ Python
.. _promise object:
http://api.jquery.com/deferred.promise/
+
+.. _.appendTo():
+ http://api.jquery.com/appendTo/
+
+.. _.prependTo():
+ http://api.jquery.com/prependTo/
+
+.. _.insertAfter():
+ http://api.jquery.com/insertAfter/
+
+.. _.insertBefore():
+ http://api.jquery.com/insertBefore/
diff --git a/doc/source/development.rst b/doc/source/development.rst
index bfb176cb5c5..85fbebcceb3 100644
--- a/doc/source/development.rst
+++ b/doc/source/development.rst
@@ -374,11 +374,13 @@ Deletion can be overridden by replacing the
calls :js:func:`~openerp.base.DataSet.unlink` in order to remove the records
entirely.
-.. note:: the list-wise deletion button (next to the record addition button)
- simply proxies to :js:func:`~openerp.base.ListView.do_delete` after
- obtaining all selected record ids, but it is possible to override it
- alone by replacing
- :js:func:`~openerp.base.ListView.do_delete_selected`.
+.. note::
+
+ the list-wise deletion button (next to the record addition button)
+ simply proxies to :js:func:`~openerp.base.ListView.do_delete` after
+ obtaining all selected record ids, but it is possible to override it
+ alone by replacing
+ :js:func:`~openerp.base.ListView.do_delete_selected`.
Internal API Doc
----------------