From a07d6e7364ede500577b1302c3db16d49aa53a00 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 4 Apr 2012 12:56:22 +0530 Subject: [PATCH 01/44] [IMP] added new attribute for tree view bzr revid: tpa@tinyerp.com-20120404072622-08evqadcnksplkwb --- openerp/addons/base/rng/view.rng | 1 + 1 file changed, 1 insertion(+) diff --git a/openerp/addons/base/rng/view.rng b/openerp/addons/base/rng/view.rng index 5dce238db5d..c058795e0f0 100644 --- a/openerp/addons/base/rng/view.rng +++ b/openerp/addons/base/rng/view.rng @@ -222,6 +222,7 @@ + From a5f5358cf2f0240852d2fd90d5b9beaafe0e6304 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 4 Apr 2012 13:00:16 +0530 Subject: [PATCH 02/44] [IMP] improved code for make the list record bold depends on state bzr revid: tpa@tinyerp.com-20120404073016-ro6wuybho7npp9k4 --- addons/web/static/src/js/view_editor.js | 5 +++-- addons/web/static/src/js/view_list.js | 11 +++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_editor.js b/addons/web/static/src/js/view_editor.js index 2c0dc3d70b4..e0953ae5ef6 100644 --- a/addons/web/static/src/js/view_editor.js +++ b/addons/web/static/src/js/view_editor.js @@ -873,7 +873,8 @@ openerp.web.ViewEditor = openerp.web.OldWidget.extend({ 'widget' : {'name':'widget', 'string': 'widget', 'type': 'selection'}, 'colors' : {'name':'colors', 'string': 'Colors', 'type': 'char'}, 'editable' : {'name':'editable', 'string': 'Editable', 'type': 'selection', 'selection': [["",""],["top","Top"],["bottom", "Bottom"]]}, - 'groups' : {'name':'groups', 'string': 'Groups', 'type': 'selection_multi'} + 'groups' : {'name':'groups', 'string': 'Groups', 'type': 'selection_multi'}, + 'fontbold' : {'name':'fontbold', 'string': 'fontbold', 'type': 'char'}, }; var arch_val = self.get_object_by_id(this.one_object.clicked_tr_id,this.one_object['main_object'], []); this.edit_node_dialog.$element.append('
'); @@ -1149,7 +1150,7 @@ var _PROPERTIES = { 'board': ['style'], 'column' : [], 'action' : ['name', 'string', 'colspan', 'groups'], - 'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows'], + 'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows', 'fontbold'], 'graph' : ['string', 'type'], 'calendar' : ['string', 'date_start', 'date_stop', 'date_delay', 'day_length', 'color', 'mode'] }; diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index e8fff450c6e..cab916bbc32 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -56,6 +56,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# this.view_id = view_id; this.previous_colspan = null; this.colors = null; + this.fontbold = null; this.columns = []; @@ -154,16 +155,21 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# current_date: new Date().toString('yyyy-MM-dd') // TODO: time, datetime, relativedelta }); + var style= ''; + if(record.attributes.state == this.fontbold) { + style = 'font-weight: bold;'; + } for(var i=0, len=this.colors.length; i Date: Wed, 4 Apr 2012 14:46:13 +0530 Subject: [PATCH 03/44] [IMP] improved code for more than one states bzr revid: tpa@tinyerp.com-20120404091613-fp7el2lal3qb190r --- addons/web/static/src/js/view_list.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index cab916bbc32..122d4ee76d5 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -156,9 +156,12 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# // TODO: time, datetime, relativedelta }); var style= ''; - if(record.attributes.state == this.fontbold) { - style = 'font-weight: bold;'; + for(var i=0, len=this.fontbold.length; i Date: Wed, 4 Apr 2012 17:32:11 +0530 Subject: [PATCH 04/44] [IMP] improved code for font-bold feature bzr revid: tpa@tinyerp.com-20120404120211-0b1l1zvjx5550hqa --- addons/web/static/src/js/view_editor.js | 4 +-- addons/web/static/src/js/view_list.js | 36 ++++++++++++++++--------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/addons/web/static/src/js/view_editor.js b/addons/web/static/src/js/view_editor.js index e0953ae5ef6..ae531c8c925 100644 --- a/addons/web/static/src/js/view_editor.js +++ b/addons/web/static/src/js/view_editor.js @@ -874,7 +874,7 @@ openerp.web.ViewEditor = openerp.web.OldWidget.extend({ 'colors' : {'name':'colors', 'string': 'Colors', 'type': 'char'}, 'editable' : {'name':'editable', 'string': 'Editable', 'type': 'selection', 'selection': [["",""],["top","Top"],["bottom", "Bottom"]]}, 'groups' : {'name':'groups', 'string': 'Groups', 'type': 'selection_multi'}, - 'fontbold' : {'name':'fontbold', 'string': 'fontbold', 'type': 'char'}, + 'fonts' : {'name':'fonts', 'string': 'fonts', 'type': 'char'}, }; var arch_val = self.get_object_by_id(this.one_object.clicked_tr_id,this.one_object['main_object'], []); this.edit_node_dialog.$element.append('
'); @@ -1150,7 +1150,7 @@ var _PROPERTIES = { 'board': ['style'], 'column' : [], 'action' : ['name', 'string', 'colspan', 'groups'], - 'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows', 'fontbold'], + 'tree' : ['string', 'colors', 'editable', 'link', 'limit', 'min_rows', 'fonts'], 'graph' : ['string', 'type'], 'calendar' : ['string', 'date_start', 'date_stop', 'date_delay', 'day_length', 'color', 'mode'] }; diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 122d4ee76d5..b2a23ac5451 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -56,7 +56,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# this.view_id = view_id; this.previous_colspan = null; this.colors = null; - this.fontbold = null; + this.fonts = null; this.columns = []; @@ -149,19 +149,26 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# * @returns {String} CSS color declaration */ color_for: function (record) { - if (!this.colors) { return ''; } - var context = _.extend({}, record.attributes, { + var style= ''; + + var context = _.extend({}, record.attributes, { uid: this.session.uid, current_date: new Date().toString('yyyy-MM-dd') // TODO: time, datetime, relativedelta }); - var style= ''; - for(var i=0, len=this.fontbold.length; i Date: Wed, 4 Apr 2012 18:59:30 +0530 Subject: [PATCH 05/44] [IMP] improved code. bzr revid: tpa@tinyerp.com-20120404132930-gqlw6a4f5y9ng0pd --- addons/web/static/src/js/view_list.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index b2a23ac5451..29569a43a62 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -163,7 +163,9 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView# font = pair[0], expression = pair[1]; if (py.evaluate(expression, context).toJSON()) { - style = 'font-weight: bold;'; + if (font == 'bold'){style = 'font-weight: bold;';} + if (font == 'italic'){style = 'font-style: italic;';} + if (font == 'underline'){style = 'text-decoration: underline;';} } } } From 17fbe120db26cfe58b4c4e0c11c03bed27029510 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Tue, 17 Apr 2012 15:40:26 +0530 Subject: [PATCH 06/44] [IMP] Improved code in rng file for new attribute fonts. bzr revid: tpa@tinyerp.com-20120417101026-see9y162am9k7bf9 --- openerp/addons/base/rng/view.rng | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/rng/view.rng b/openerp/addons/base/rng/view.rng index c058795e0f0..c6ce513f1e1 100644 --- a/openerp/addons/base/rng/view.rng +++ b/openerp/addons/base/rng/view.rng @@ -222,7 +222,7 @@ - + From 0b3956e2b4fd4512b4952dd6286b756da190e1b5 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 18 Apr 2012 10:56:25 +0530 Subject: [PATCH 07/44] [IMP] crm: Improved code to make pending state records bold bzr revid: tpa@tinyerp.com-20120418052625-i56b39c38pdd5gfh --- addons/crm/crm_lead_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 7a985c94b71..655fdeba793 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -169,7 +169,7 @@ crm.lead tree - + From aca7ed80a5a00f6034fa774b63d83c51f17a34a5 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 18 Apr 2012 14:52:54 +0530 Subject: [PATCH 08/44] [IMP] Improved code. bzr revid: tpa@tinyerp.com-20120418092254-2htqligvh8ov0qkr --- addons/web/static/src/js/view_list.js | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index de8b25fafe8..57268cb947c 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -148,9 +148,9 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi * @returns {String} CSS color declaration */ color_for: function (record) { - var style= ''; + var style= ''; - var context = _.extend({}, record.attributes, { + var context = _.extend({}, record.attributes, { uid: this.session.uid, current_date: new Date().toString('yyyy-MM-dd') // TODO: time, datetime, relativedelta @@ -162,9 +162,17 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi font = pair[0], expression = pair[1]; if (py.evaluate(expression, context).toJSON()) { - if (font == 'bold'){style = 'font-weight: bold;';} - if (font == 'italic'){style = 'font-style: italic;';} - if (font == 'underline'){style = 'text-decoration: underline;';} + switch(font) { + case 'bold': + style += 'font-weight: bold;'; + break; + case 'italic': + style += 'font-style: italic;'; + break; + case 'underline': + style += 'text-decoration: underline;'; + break; + } } } } @@ -175,8 +183,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi color = pair[0], expression = pair[1]; if (py.evaluate(expression, context).toJSON()) { - style += 'color: ' + color + ';' - return style; + return style += 'color: ' + color + ';'; } // TODO: handle evaluation errors } From a133899580a090e2e5b782bb5c0e4338301409a2 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 18 Apr 2012 15:12:25 +0530 Subject: [PATCH 09/44] [IMP] Improved code bzr revid: tpa@tinyerp.com-20120418094225-slnzultyxctu5n4r --- addons/web/static/src/js/view_list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 57268cb947c..0b9792e2760 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -229,7 +229,7 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi } if (this.fields_view.arch.attrs.fonts) { - this.fonts = _(this.fields_view.arch.attrs.fonts.split(',')).chain().compact() + this.fonts = _(this.fields_view.arch.attrs.fonts.split(';')).chain().compact() .map(function(font_pair) { var pair = font_pair.split(':'), font = pair[0], From 9fdb49c897e73428573198cd01949b833646dc66 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 18 Apr 2012 15:15:24 +0530 Subject: [PATCH 10/44] [IMP] set indentation bzr revid: tpa@tinyerp.com-20120418094524-l2nqten0ngq78957 --- addons/web/static/src/js/view_list.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index 0b9792e2760..ea8898f8751 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -174,8 +174,8 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi break; } } - } - } + } + } if (!this.colors) { return style; } for(var i=0, len=this.colors.length; i Date: Wed, 18 Apr 2012 17:23:16 +0530 Subject: [PATCH 11/44] [IMP] Improved name of function and comment bzr revid: tpa@tinyerp.com-20120418115316-bndil056lk25ni3g --- addons/web/static/src/js/view_list.js | 8 ++++---- addons/web/static/src/xml/base.xml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index ea8898f8751..b1e8fe3a958 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -141,13 +141,13 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi return this.reload_view(null, null, true); }, /** - * Returns the color for the provided record in the current view (from the - * ``@colors`` attribute) + * Returns the style for the provided record in the current view (from the + * ``@colors`` attribute and ``@fonts`` attribute) * * @param {Record} record record for the current row - * @returns {String} CSS color declaration + * @returns {String} CSS style declaration */ - color_for: function (record) { + style_for: function (record) { var style= ''; var context = _.extend({}, record.attributes, { diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index f365abf8856..3291aef0398 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -670,7 +670,7 @@ + t-att-style="view.style_for(record)"> From 4ab750b80d3f168801972a5b826ea7560552c4ce Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 18 Apr 2012 18:21:24 +0530 Subject: [PATCH 12/44] [IMP] added example for fonts attribute bzr revid: tpa@tinyerp.com-20120418125124-syv5no1dsv98e1h4 --- addons/crm/crm_lead_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 655fdeba793..9a94144823b 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -169,7 +169,7 @@ crm.lead tree - + From 8f5521955c0c6f08127661b231fe373cb17bdb97 Mon Sep 17 00:00:00 2001 From: "Sbh (Openerp)" Date: Thu, 19 Apr 2012 10:36:14 +0530 Subject: [PATCH 13/44] [ADD] Add the rst file for fontstyle feature bzr revid: sbh@tinyerp.com-20120419050614-i1y33qfnkyoicngc --- doc/font_style.rst | 22 ++++++++++++++++++++++ doc/index.rst | 1 + 2 files changed, 23 insertions(+) create mode 100644 doc/font_style.rst diff --git a/doc/font_style.rst b/doc/font_style.rst new file mode 100644 index 00000000000..f0261e9d144 --- /dev/null +++ b/doc/font_style.rst @@ -0,0 +1,22 @@ +Font style Feature +===================== + + +This revision adds font style feature in List view. + +Font style feature can be used by List view able to define the style of fonts based on the state of records. +we can set the style of fonts bold , italic and underline by defining in the view. + +Rng modification ++++++++++++++++++ + +This revision adds attribute fonts in view.rng + +Addon implementation example +++++++++++++++++++++++++++++ + +In your ``foo`` module, you want to specify that when it is in state ``pending`` then fons of the record should bold in list view + +:: + + diff --git a/doc/index.rst b/doc/index.rst index 815633aed54..187dd5ad009 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -19,6 +19,7 @@ Contents: addons development project + font_style old-version Indices and tables From 7636eb0254395f0b22214e06c2a5a14564b3d2f7 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 19 Apr 2012 10:47:56 +0530 Subject: [PATCH 14/44] [IMP] remove rst file bzr revid: tpa@tinyerp.com-20120419051756-1pwvzli1yi3jgzi8 --- doc/font_style.rst | 22 ---------------------- doc/index.rst | 1 - 2 files changed, 23 deletions(-) delete mode 100644 doc/font_style.rst diff --git a/doc/font_style.rst b/doc/font_style.rst deleted file mode 100644 index f0261e9d144..00000000000 --- a/doc/font_style.rst +++ /dev/null @@ -1,22 +0,0 @@ -Font style Feature -===================== - - -This revision adds font style feature in List view. - -Font style feature can be used by List view able to define the style of fonts based on the state of records. -we can set the style of fonts bold , italic and underline by defining in the view. - -Rng modification -+++++++++++++++++ - -This revision adds attribute fonts in view.rng - -Addon implementation example -++++++++++++++++++++++++++++ - -In your ``foo`` module, you want to specify that when it is in state ``pending`` then fons of the record should bold in list view - -:: - - diff --git a/doc/index.rst b/doc/index.rst index 187dd5ad009..815633aed54 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -19,7 +19,6 @@ Contents: addons development project - font_style old-version Indices and tables From 303a168a3afa34816f6c2245373b44148e040c39 Mon Sep 17 00:00:00 2001 From: "Sbh (Openerp)" Date: Thu, 19 Apr 2012 10:56:44 +0530 Subject: [PATCH 15/44] [ADD] add the rst file for font feature bzr revid: sbh@tinyerp.com-20120419052644-nkczuqh4zfzftcee --- doc/api/font_style.rst | 22 ++++++++++++++++++++++ doc/index.rst.inc | 1 + 2 files changed, 23 insertions(+) create mode 100644 doc/api/font_style.rst diff --git a/doc/api/font_style.rst b/doc/api/font_style.rst new file mode 100644 index 00000000000..f0261e9d144 --- /dev/null +++ b/doc/api/font_style.rst @@ -0,0 +1,22 @@ +Font style Feature +===================== + + +This revision adds font style feature in List view. + +Font style feature can be used by List view able to define the style of fonts based on the state of records. +we can set the style of fonts bold , italic and underline by defining in the view. + +Rng modification ++++++++++++++++++ + +This revision adds attribute fonts in view.rng + +Addon implementation example +++++++++++++++++++++++++++++ + +In your ``foo`` module, you want to specify that when it is in state ``pending`` then fons of the record should bold in list view + +:: + + diff --git a/doc/index.rst.inc b/doc/index.rst.inc index 80873a696ec..98c01c8354e 100644 --- a/doc/index.rst.inc +++ b/doc/index.rst.inc @@ -15,3 +15,4 @@ New feature merges api/user_img_specs api/need_action_specs + api/font_style From 8c6ad14da90c2bd0facda087bd956010253e043c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 19 Apr 2012 11:14:04 +0200 Subject: [PATCH 16/44] [DOC] Slightly improved documentation. bzr revid: tde@openerp.com-20120419091404-1sskcrfiql1v7fe7 --- doc/api/font_style.rst | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/api/font_style.rst b/doc/api/font_style.rst index f0261e9d144..f47a654aa34 100644 --- a/doc/api/font_style.rst +++ b/doc/api/font_style.rst @@ -1,22 +1,28 @@ -Font style Feature -===================== +Font style in list views +======================== +.. versionadded:: 7.0 -This revision adds font style feature in List view. - -Font style feature can be used by List view able to define the style of fonts based on the state of records. -we can set the style of fonts bold , italic and underline by defining in the view. +This revision adds font styles in list views. Before this revision it was +possible to define some colors in list view. This revision allows to define +the a font style, based on an evaluated Python expression. The definition syntax is +the same than the colors feature. Supported styles are bold, italic and +underline. Rng modification +++++++++++++++++ -This revision adds attribute fonts in view.rng +This revision adds the ``fonts`` optional attribute in ``view.rng``. Addon implementation example ++++++++++++++++++++++++++++ -In your ``foo`` module, you want to specify that when it is in state ``pending`` then fons of the record should bold in list view +In your ``foo`` module, you want to specify that when any record is in ``pending`` +state then it should be displayed in bold in the list view. Edit your foo_view.xml +file that define the views, and add the fonts attribute to the tree tag. -:: +.. code-block:: xml - + + [...] + From b55d7abf1c9eb387722e6f62e729276fba2a07a1 Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Thu, 19 Apr 2012 15:18:52 +0530 Subject: [PATCH 17/44] [IMP]project,project_issue: add listview bold feature bzr revid: kjo@tinyerp.com-20120419094852-w5s0evbdt2z4nf8x --- addons/project/project_view.xml | 6 ++++-- addons/project_issue/project_issue_view.xml | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index c48b075721a..63898cb518d 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -140,8 +140,9 @@ tree child_ids - + + @@ -414,7 +415,8 @@ tree - + + diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index cb532f4af38..50c79346127 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -123,7 +123,8 @@ project.issue tree - + + From ac8646d3223bfa052cbb81d94fe1076f58b50f8c Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 19 Apr 2012 11:51:04 +0200 Subject: [PATCH 18/44] [FIX] typos in rpc doc bzr revid: xmo@openerp.com-20120419095104-30wwmeh1mj1w0rxy --- doc/rpc.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/doc/rpc.rst b/doc/rpc.rst index 9f8f4424ce6..5c5ca11b07d 100644 --- a/doc/rpc.rst +++ b/doc/rpc.rst @@ -22,7 +22,7 @@ High-level API: calling into OpenERP models Access to OpenERP object methods (made available through XML-RPC from the server) is done via the :js:class:`openerp.web.Model` class. This -class maps ontwo the OpenERP server objects via two primary methods, +class maps onto the OpenERP server objects via two primary methods, :js:func:`~openerp.web.Model.call` and :js:func:`~openerp.web.Model.query`. @@ -52,7 +52,7 @@ similar to that of the OpenERP Model API, with three differences: }); :js:func:`~openerp.web.Model.query` is a shortcut for a builder-style -iterface to searches (``search`` + ``read`` in OpenERP RPC terms). It +interface to searches (``search`` + ``read`` in OpenERP RPC terms). It returns a :js:class:`~openerp.web.Query` object which is immutable but allows building new :js:class:`~openerp.web.Query` instances from the first one, adding new properties or modifiying the parent object's: @@ -69,7 +69,7 @@ first one, adding new properties or modifiying the parent object's: The query is only actually performed when calling one of the query serialization methods, :js:func:`~openerp.web.Query.all` and :js:func:`~openerp.web.Query.first`. These methods will perform a new -RPC query every time they are called. +RPC call every time they are called. For that reason, it's actually possible to keep "intermediate" queries around and use them differently/add new specifications on them. @@ -314,15 +314,15 @@ Low-level API: RPC calls to Python side While the previous section is great for calling core OpenERP code (models code), it does not work if you want to call the Python side of -openerp-web. +OpenERP Web. -For this. a lower-level API is available on -:js:class:`openerp.web.Connection` objects (usually available through +For this, a lower-level API exists on on +:js:class:`~openerp.web.Connection` objects (usually available through ``openerp.connection``): the ``rpc`` method. This method simply takes an absolute path (which is the combination of the Python controller's ``_cp_path`` attribute and the name of the -method yo want to call) and a mapping of attributes to values (applied +method you want to call) and a mapping of attributes to values (applied as keyword arguments on the Python method [#]_). This function fetches the return value of the Python methods, converted to JSON. From 217cf2e14bdb78f77138872b8f9ea0ba0baff050 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 19 Apr 2012 15:26:46 +0530 Subject: [PATCH 19/44] [IMP] set proper indentation bzr revid: tpa@tinyerp.com-20120419095646-p1q0u7jny2740ms3 --- addons/web/static/src/js/view_list.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index b1e8fe3a958..9e749009ebc 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -157,10 +157,10 @@ instance.web.ListView = instance.web.View.extend( /** @lends instance.web.ListVi }); if (this.fonts) { - for(var i=0, len=this.fonts.length; i Date: Thu, 19 Apr 2012 15:29:54 +0530 Subject: [PATCH 20/44] [IMP] crm,sale:improved code for tree view bzr revid: tpa@tinyerp.com-20120419095954-dx9quzex5k1d2ylb --- addons/crm/crm_lead_view.xml | 6 ++++-- addons/crm/crm_meeting_view.xml | 3 ++- addons/crm/crm_phonecall_view.xml | 6 ++++-- addons/sale/sale_view.xml | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index 9a94144823b..7de9858713a 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -169,7 +169,8 @@ crm.lead tree - + + @@ -536,7 +537,8 @@ crm.lead tree - + + diff --git a/addons/crm/crm_meeting_view.xml b/addons/crm/crm_meeting_view.xml index a82a34d80ce..d740a00cf02 100644 --- a/addons/crm/crm_meeting_view.xml +++ b/addons/crm/crm_meeting_view.xml @@ -224,8 +224,9 @@ crm.meeting tree - + diff --git a/addons/crm/crm_phonecall_view.xml b/addons/crm/crm_phonecall_view.xml index ae0e0ce7f3c..eb836428b6e 100644 --- a/addons/crm/crm_phonecall_view.xml +++ b/addons/crm/crm_phonecall_view.xml @@ -24,7 +24,8 @@ crm.phonecall tree - + + @@ -132,7 +133,8 @@ crm.phonecall tree - + + tree 2 - + + From a326d17fabca540761957be708231feb24e626fe Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 19 Apr 2012 15:36:53 +0530 Subject: [PATCH 21/44] [IMP] purchase:improved code for tree view bzr revid: tpa@tinyerp.com-20120419100653-1mwb6lao6oz0kf9p --- addons/purchase/purchase_view.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index b1511139102..45e0882edc8 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -286,7 +286,8 @@ purchase.order tree - + + From b657cdb9671908351310cf4ceed9916f95dcc038 Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Thu, 19 Apr 2012 15:38:55 +0530 Subject: [PATCH 22/44] [IMP]hr_recruitment, hr_holidays: add treeview fonts bold bzr revid: kjo@tinyerp.com-20120419100855-7tomt33drutwkpvy --- addons/hr_holidays/hr_holidays_view.xml | 9 ++++++--- addons/hr_recruitment/hr_recruitment_view.xml | 3 ++- addons/project_issue/project_issue_view.xml | 5 +++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index d6ee7ed869c..066ac29c6e3 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -150,7 +150,8 @@ hr.holidays tree - + + @@ -205,7 +206,8 @@ tree 20 - + + @@ -231,7 +233,8 @@ hr.holidays tree - + + diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 1f7d916c6f3..9e4948eebc6 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -41,7 +41,8 @@ hr.applicant tree - + + diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 50c79346127..3b47965306c 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -123,7 +123,7 @@ project.issue tree - + @@ -291,8 +291,9 @@ project.issue tree - + + From 3ebc3652ffb8378da145fc89b82e647b11bfde30 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Thu, 19 Apr 2012 15:46:38 +0530 Subject: [PATCH 23/44] [IMP] mrp:improved code for tree view bzr revid: tpa@tinyerp.com-20120419101638-ltl5621fdkyyv8yr --- addons/mrp/mrp_view.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 986e1b2f754..76062249d7d 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -573,7 +573,8 @@ mrp.production tree - + + From d39f8a63bafead27e26c16d7a3acf321532fd569 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 19 Apr 2012 13:52:03 +0200 Subject: [PATCH 24/44] [FIX] project_planning: correctly forward count parameter for search override bzr revid: xmo@openerp.com-20120419115203-okiu2buyc9ci1bl4 --- addons/project_planning/project_planning.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/project_planning/project_planning.py b/addons/project_planning/project_planning.py index fafaf85ac4f..4787aa2603b 100644 --- a/addons/project_planning/project_planning.py +++ b/addons/project_planning/project_planning.py @@ -233,7 +233,8 @@ class project_task(osv.osv): if context is None: context = {} if not context.get('planning', False): - return super(project_task,self).search(cr, user, args, offset, limit, order, context) + return super(project_task,self).search(cr, user, args, + offset=offset, limit=limit, order=order, context=context, count=count) cr.execute(" SELECT t.id, t.name \ from project_task t \ join report_account_analytic_planning_line l on (l.id = t.planning_line_id )\ From 8f5c30c7e987ae78d0be834499eb7f0978d96d01 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 19 Apr 2012 13:55:04 +0200 Subject: [PATCH 25/44] [FIX] really convert to float when trying to convert to float might work better than converting to a float field bzr revid: xmo@openerp.com-20120419115504-2tic6l0qjb8zlhuh --- openerp/osv/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index e228ac32c41..95aecf18ec6 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -1057,7 +1057,7 @@ class function(_column): # This is not needed for stored fields and non-functional integer # fields, as their values are constrained by the database backend # to the same 32bits signed int limit. - result = float(value) + result = __builtins__.float(value) return result def get(self, cr, obj, ids, name, uid=False, context=None, values=None): From 931c2376862f1064aafaecd044712465e394bb9e Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Thu, 19 Apr 2012 15:02:45 +0200 Subject: [PATCH 26/44] [FIX] previous fix: actual module should be __builtin__ apparently we do weird things with __builtins__, on my machine it's consistently an alias to the __builtin__ importable module, but in the server it's a dict bzr revid: xmo@openerp.com-20120419130245-ael83wc5h310m38s --- openerp/osv/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/osv/fields.py b/openerp/osv/fields.py index 95aecf18ec6..4364c0f985e 100644 --- a/openerp/osv/fields.py +++ b/openerp/osv/fields.py @@ -1057,7 +1057,7 @@ class function(_column): # This is not needed for stored fields and non-functional integer # fields, as their values are constrained by the database backend # to the same 32bits signed int limit. - result = __builtins__.float(value) + result = __builtin__.float(value) return result def get(self, cr, obj, ids, name, uid=False, context=None, values=None): From 9ca448c1e868b6acf6581d32a85c226b7e396e98 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 19 Apr 2012 15:43:41 +0200 Subject: [PATCH 27/44] [imp] Changed some names to improve framework comprehension bzr revid: nicolas.vanhoren@openerp.com-20120419134341-b6rcx58lghgvayia --- addons/web/static/src/js/corelib.js | 18 ++++++++---------- addons/web/static/src/js/view_form.js | 6 +++--- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/addons/web/static/src/js/corelib.js b/addons/web/static/src/js/corelib.js index cbd28aca8a3..32e35575933 100644 --- a/addons/web/static/src/js/corelib.js +++ b/addons/web/static/src/js/corelib.js @@ -239,9 +239,7 @@ instance.web.ParentedMixin = { }; /** - * TODO al: move into the the mixin - * - * Backbone's events + * Backbone's events. Do not ever use it directly, use EventDispatcherMixin instead. * * (c) 2010-2012 Jeremy Ashkenas, DocumentCloud Inc. * Backbone may be freely distributed under the MIT license. @@ -253,8 +251,7 @@ instance.web.ParentedMixin = { * events is done in EventDispatcherMixin. * */ -instance.web.Events = instance.web.Class.extend({ - +var Events = instance.web.Class.extend({ on : function(events, callback, context) { var ev; events = events.split(/\s+/); @@ -323,12 +320,13 @@ instance.web.Events = instance.web.Class.extend({ return this; } }); +// end of Jeremy Ashkenas' code instance.web.EventDispatcherMixin = _.extend({}, instance.web.ParentedMixin, { __eventDispatcherMixin: true, init: function() { instance.web.ParentedMixin.init.call(this); - this.__edispatcherEvents = new instance.web.Events(); + this.__edispatcherEvents = new Events(); this.__edispatcherRegisteredEvents = []; }, on: function(events, dest, func) { @@ -373,7 +371,7 @@ instance.web.EventDispatcherMixin = _.extend({}, instance.web.ParentedMixin, { } }); -instance.web.GetterSetterMixin = _.extend({}, instance.web.EventDispatcherMixin, { +instance.web.PropertiesMixin = _.extend({}, instance.web.EventDispatcherMixin, { init: function() { instance.web.EventDispatcherMixin.init.call(this); this.__getterSetterInternalMap = {}; @@ -400,9 +398,9 @@ instance.web.GetterSetterMixin = _.extend({}, instance.web.EventDispatcherMixin, } }); -instance.web.CallbackEnabledMixin = _.extend({}, instance.web.GetterSetterMixin, { +instance.web.CallbackEnabledMixin = _.extend({}, instance.web.PropertiesMixin, { init: function() { - instance.web.GetterSetterMixin.init.call(this); + instance.web.PropertiesMixin.init.call(this); var self = this; var callback_maker = function(obj, name, method) { var callback = function() { @@ -535,7 +533,7 @@ instance.web.WidgetMixin = _.extend({},instance.web.CallbackEnabledMixin, { if(this.$element != null) { this.$element.remove(); } - instance.web.GetterSetterMixin.destroy.call(this); + instance.web.PropertiesMixin.destroy.call(this); }, /** * Renders the current widget and appends it to the given jQuery object or Widget. diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 47cee79ffcb..a87982fdabd 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1307,7 +1307,7 @@ instance.web.form.compute_domain = function(expr, fields) { }; /** - * Must be applied over an class already possessing the GetterSetterMixin. + * Must be applied over an class already possessing the PropertiesMixin. * * Apply the result of the "invisible" domain to this.$element. */ @@ -1335,10 +1335,10 @@ instance.web.form.InvisibilityChangerMixin = { }, }; -instance.web.form.InvisibilityChanger = instance.web.Class.extend(_.extend({}, instance.web.GetterSetterMixin, instance.web.form.InvisibilityChangerMixin, { +instance.web.form.InvisibilityChanger = instance.web.Class.extend(_.extend({}, instance.web.PropertiesMixin, instance.web.form.InvisibilityChangerMixin, { init: function(parent, field_manager, invisible_domain, $element) { this.setParent(parent); - instance.web.GetterSetterMixin.init.call(this); + instance.web.PropertiesMixin.init.call(this); instance.web.form.InvisibilityChangerMixin.init.call(this, field_manager, invisible_domain); this.$element = $element; this.start(); From 869407033ef430be11bbec8663b1d88dfcf9d0fd Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 19 Apr 2012 16:28:14 +0200 Subject: [PATCH 28/44] [fix] problem with sidebar showing in popups bzr revid: nicolas.vanhoren@openerp.com-20120419142814-7hp51n8lp7iwlucc --- addons/web/static/src/js/views.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index 36e3c2b802b..9625e074e83 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -245,7 +245,7 @@ instance.web.ViewManager = instance.web.Widget.extend({ controller : null, options : _.extend({ $buttons : self.$element.find('.oe_view_manager_buttons'), - $sidebar : self.$element.find('.oe_view_manager_sidebar'), + $sidebar : self.flags.sidebar ? self.$element.find('.oe_view_manager_sidebar') : undefined, $pager : self.$element.find('.oe_view_manager_pager'), action : self.action, action_views_ids : views_ids From 3da11976a455a0ad55fcf8ecaee534fd61ff7ed1 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 19 Apr 2012 16:50:51 +0200 Subject: [PATCH 29/44] [fix] problem with editable lists & buttons bzr revid: nicolas.vanhoren@openerp.com-20120419145051-41ywt5u35z04m8wm --- addons/web/static/src/js/view_list_editable.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index ac19e3f341d..2015232349a 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -406,14 +406,17 @@ openerp.web.list_editable = function (instance) { if (modifiers.tree_invisible === true) $td.hide(); var tag_name = el.tagName.toLowerCase(); - var key = tag_name; + var w; if (tag_name === "field") { var name = $(el).attr("name"); - key = $(el).attr('widget') || self.fvg.fields[name].type; + var key = $(el).attr('widget') || self.fvg.fields[name].type; + var obj = self.view.fields_registry.get_object(key); + w = new (obj)(self.view, instance.web.xml_to_json(el)); + self.view.register_field(w, $(el).attr("name")); + } else { + var obj = self.tags_registry.get_object(tag_name); + w = new (obj)(self.view, instance.web.xml_to_json(el)); } - var obj = self.view.fields_registry.get_object(key); - var w = new (obj)(self.view, instance.web.xml_to_json(el)); - self.view.register_field(w, $(el).attr("name")); w.appendTo($td); $td.appendTo($element); }); From a6bc55c95ca613c288df7213448bc623558828a4 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 19 Apr 2012 17:11:39 +0200 Subject: [PATCH 30/44] [fix] problem in calendar view bzr revid: nicolas.vanhoren@openerp.com-20120419151139-92ujq4get9gxbkl3 --- addons/web_calendar/static/src/js/calendar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web_calendar/static/src/js/calendar.js b/addons/web_calendar/static/src/js/calendar.js index 8bd83c0bb30..b4c43fbba98 100644 --- a/addons/web_calendar/static/src/js/calendar.js +++ b/addons/web_calendar/static/src/js/calendar.js @@ -289,9 +289,9 @@ instance.web_calendar.CalendarView = instance.web.View.extend({ var field_name = self[field]; if (field_name && form.fields[field_name]) { var ffield = form.fields[field_name]; - ffield.reset(); + ffield._dirty_flag = false; $.when(ffield.set_value(data[field_name])).then(function() { - ffield.dirty = true; + ffield._dirty_flag = true; form.do_onchange(ffield); }); } From 5afd20a530f53a8da14778673468980312333518 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Thu, 19 Apr 2012 17:33:41 +0200 Subject: [PATCH 31/44] [IMP] Improved rendering engine group cells width computing bzr revid: fme@openerp.com-20120419153341-gequ3826z6fd44x6 --- addons/web/static/src/css/base.css | 5 ++++- addons/web/static/src/css/base.sass | 4 +++- addons/web/static/src/js/view_form.js | 15 ++++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index 854946cdf97..2b90d47c002 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1783,11 +1783,14 @@ font-weight: bold; } .openerp .oe_layout_debugging .oe_form_group { - outline: 2px dashed red; + outline: 2px dashed green; } .openerp .oe_layout_debugging .oe_form_group_cell { outline: 1px solid blue; } +.openerp .oe_layout_debugging .oe_form_group:hover, .openerp .oe_layout_debugging .oe_form_group_cell:hover { + outline-color: red; +} .openerp .oe_debug_view { float: left; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index 98caeafbb29..fc645a92e44 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -1490,9 +1490,11 @@ $colour4: #8a89ba // Debugging stuff {{{ .oe_layout_debugging .oe_form_group - outline: 2px dashed red + outline: 2px dashed green .oe_form_group_cell outline: 1px solid blue + .oe_form_group:hover, .oe_form_group_cell:hover + outline-color: red .oe_debug_view float: left diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index a87982fdabd..c13e283354c 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1119,7 +1119,20 @@ instance.web.form.FormRenderingEngine = instance.web.Class.extend({ } break; default: - to_compute.push($td); + var width = _.str.trim($child.attr('width') || ''), + iwidth = parseInt(width, 10); + if (iwidth) { + if (width.substr(-1) === '%') { + total -= iwidth; + width = iwidth + '%'; + } + $td.attr('width', width); + $child.removeAttr('width'); + row_cols--; + } else { + to_compute.push($td); + } + } }); var unit = Math.floor(total / row_cols); From 630eabbbb221cdf2ca0bece16f09c858efcbde9a Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 19 Apr 2012 17:38:57 +0200 Subject: [PATCH 32/44] [fix] some problem in editable list, still not solved but made more usable until we find a real fix bzr revid: nicolas.vanhoren@openerp.com-20120419153857-cdnau0g5yt2e1iy6 --- addons/web/static/src/js/view_list_editable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index 2015232349a..ca6dcc7c1c8 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -420,7 +420,7 @@ openerp.web.list_editable = function (instance) { w.appendTo($td); $td.appendTo($element); }); - $("").appendTo($element); + $("").appendTo($element); }, }); }; From 8a66f58d52dc556737029a90b95fa33ac0a5135c Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Thu, 19 Apr 2012 17:55:14 +0200 Subject: [PATCH 33/44] [fix] problem in editable lists: could not edit an existing row bzr revid: nicolas.vanhoren@openerp.com-20120419155514-j8bslmn6z7z1dh8h --- addons/web/static/src/js/view_form.js | 5 +---- addons/web/static/src/js/view_list_editable.js | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index c13e283354c..1d17e1acab0 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -52,7 +52,6 @@ instance.web.FormView = instance.web.View.extend({ this.mutating_mutex = new $.Mutex(); this.on_change_mutex = new $.Mutex(); this.reload_mutex = new $.Mutex(); - this.mode = null; this.rendering_engine = new instance.web.form.FormRenderingEngineReadonly(this); this.qweb = null; // A QWeb instance will be created if the view is a QWeb template }, @@ -499,9 +498,8 @@ instance.web.FormView = instance.web.View.extend({ } }, switch_mode: function() { - var mode = this.get("mode"); var self = this; - if(mode=="view") { + if(this.get("mode") == "view") { self.$buttons.find('.oe_form_buttons_edit').hide(); self.$buttons.find('.oe_form_buttons_view').show(); _.each(this.fields,function(field){ @@ -514,7 +512,6 @@ instance.web.FormView = instance.web.View.extend({ field.set({"force_readonly": false}); }); } - self.mode = mode; }, on_button_save: function() { var self = this; diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js index ca6dcc7c1c8..816143afa5d 100644 --- a/addons/web/static/src/js/view_list_editable.js +++ b/addons/web/static/src/js/view_list_editable.js @@ -372,6 +372,7 @@ openerp.web.list_editable = function (instance) { init: function() { this._super.apply(this, arguments); this.rendering_engine = new instance.web.ListEditableRenderingEngine(this); + this.options.initial_mode = "edit"; }, renderElement: function() {} }); From 58483fcd65cc0515afa343876a94e0a9d17c64a2 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 19 Apr 2012 22:44:18 +0200 Subject: [PATCH 34/44] [IMP] form change cancel button into discard link bzr revid: al@openerp.com-20120419204418-mn8r1w624j4ba46o --- addons/web/static/src/js/view_form.js | 16 ++++++++-------- addons/web/static/src/xml/base.xml | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 1d17e1acab0..c457554e44b 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -88,13 +88,12 @@ instance.web.FormView = instance.web.View.extend({ } else { this.$element.find('.oe_form_buttons').replaceWith(this.$buttons); } - this.$buttons - .on('click','button.oe_form_button_save',this.on_button_save) - .on('click','button.oe_form_button_cancel',this.on_button_cancel) - .on('click','button.oe_form_button_edit',this.on_button_edit) - .on('click','button.oe_form_button_create',this.on_button_create) - .on('click','button.oe_form_button_duplicate',this.on_button_duplicate) - .on('click','button.oe_form_button_delete',this.on_button_delete); + this.$buttons.on('click','.oe_form_button_create',this.on_button_create); + this.$buttons.on('click','.oe_form_button_edit',this.on_button_edit); + this.$buttons.on('click','.oe_form_button_duplicate',this.on_button_duplicate); + this.$buttons.on('click','.oe_form_button_delete',this.on_button_delete); + this.$buttons.on('click','.oe_form_button_save',this.on_button_save); + this.$buttons.on('click','.oe_form_button_cancel',this.on_button_cancel); this.$pager = $(QWeb.render("FormView.pager", {'widget':self})); if (this.options.$pager) { @@ -519,10 +518,11 @@ instance.web.FormView = instance.web.View.extend({ self.set({mode: "view"}); }); }, - on_button_cancel: function() { + on_button_cancel: function(event) { if (this.can_be_discarded()) { this.set({mode: "view"}); } + return false; }, on_button_new: function() { var self = this; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index b47c8d01684..b11eadde42d 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -715,8 +715,8 @@ - - + or + Discard From af1eeca0c3ad29643eb4d838d490a16e80c2d0e5 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 19 Apr 2012 22:52:52 +0200 Subject: [PATCH 35/44] [FIX] restore default user menu avatar bzr revid: al@openerp.com-20120419205252-jsbldr26uc7ioi35 --- addons/web/static/src/img/user_menu_avatar.png | Bin 0 -> 846 bytes addons/web/static/src/xml/base.xml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 addons/web/static/src/img/user_menu_avatar.png diff --git a/addons/web/static/src/img/user_menu_avatar.png b/addons/web/static/src/img/user_menu_avatar.png new file mode 100644 index 0000000000000000000000000000000000000000..a2c70ea7d498e746904ee270cffe6fcb45f7c6b6 GIT binary patch literal 846 zcmex=_1P|rX?qqI0P zFI~aY%U!`Mz|~!$%*;qrN1?DZF(6Oj-S5fuR$!pIEN!@|nR z%E~Fi%grl7GWdUhL6Cz%j6sZ4 zD%dK(z{JSR%*4VBay3wOEl{3;MUYiU(a@1iI53f2sZhkIapFP_Wv7h?MT0JWP%%y_ zYU1P)6PJ*bQdLve(9|+9H8Z!cv~qTFb#wRd^a>6M4GWKmj7m;PO-s+n%qlJ^Ei136 ztZHs)ZENr7?3y%r%G7DoXUv?nXz`Mz%a*TLxoXqqEnBy3-?4Mop~FXx9y@;G&P778mFHFAhJO|>fcdxG1 zdgg7NTwEgXvoM9P{?`@8&+{}EUR_+~9<**bYeYh`D?`=wgKzCLzI5-t!)!9SGJ3D5 sgT
  • - +
      From fc585722019735e0b2ac441f54b774901f1d7a98 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 19 Apr 2012 23:47:19 +0200 Subject: [PATCH 36/44] [REM] default homepage bzr revid: al@openerp.com-20120419214719-pj23mry2gs0fi44y --- addons/board/board_data_admin.xml | 3 +-- addons/board/board_data_home.xml | 31 ------------------------------- addons/board/board_demo.xml | 4 ---- 3 files changed, 1 insertion(+), 37 deletions(-) diff --git a/addons/board/board_data_admin.xml b/addons/board/board_data_admin.xml index 1942aa7c066..dfe4134be99 100644 --- a/addons/board/board_data_admin.xml +++ b/addons/board/board_data_admin.xml @@ -35,10 +35,9 @@
      - + -
      diff --git a/addons/board/board_data_home.xml b/addons/board/board_data_home.xml index 8794173810a..f1e90ace7ad 100644 --- a/addons/board/board_data_home.xml +++ b/addons/board/board_data_home.xml @@ -37,36 +37,5 @@ - - - Homepage Board - board.board - form - -
      - - - - - -
      -
      -
      - - Home Page - board.board - form - form - - - - - - - - - - - diff --git a/addons/board/board_demo.xml b/addons/board/board_demo.xml index 384e29abdf2..d36ec6161fe 100644 --- a/addons/board/board_demo.xml +++ b/addons/board/board_demo.xml @@ -1,9 +1,5 @@ - - - - From 5522c5e10022fa2d049ab83a21741a6fb5b70906 Mon Sep 17 00:00:00 2001 From: Antony Lesuisse Date: Thu, 19 Apr 2012 23:53:44 +0200 Subject: [PATCH 37/44] [REM] homepage support, trigger first menu item instead bzr revid: al@openerp.com-20120419215344-vn1yyk70oztpn2mw --- addons/web/static/src/js/chrome.js | 8 +- .../web_dashboard/static/src/js/dashboard.js | 155 ------------------ .../static/src/xml/web_dashboard.xml | 62 ------- 3 files changed, 7 insertions(+), 218 deletions(-) diff --git a/addons/web/static/src/js/chrome.js b/addons/web/static/src/js/chrome.js index f1d3faef367..f43da0431ff 100644 --- a/addons/web/static/src/js/chrome.js +++ b/addons/web/static/src/js/chrome.js @@ -638,6 +638,7 @@ instance.web.Menu = instance.web.Widget.extend({ } }, on_menu_click: function(ev, id) { + // TODO If first level menu doesnt have action trigger first leaf this.do_hide_more(); id = id || 0; var $clicked_menu, manual = false; @@ -984,13 +985,18 @@ instance.web.WebClient = instance.web.Widget.extend({ }); }, bind_hashchange: function() { + var self = this; $(window).bind('hashchange', this.on_hashchange); var state = $.bbq.getState(true); if (! _.isEmpty(state)) { $(window).trigger('hashchange'); } else { - this.action_manager.do_action({type: 'ir.actions.client', tag: 'default_home'}); + self.menu.has_been_loaded.then(function() { + var first_menu_id = self.menu.$element.find("a:first").data("menu"); + if(first_menu_id) + self.menu.on_menu_click(null,first_menu_id); + }); } }, on_hashchange: function(event) { diff --git a/addons/web_dashboard/static/src/js/dashboard.js b/addons/web_dashboard/static/src/js/dashboard.js index f0c04d6d270..d9f4443ac24 100644 --- a/addons/web_dashboard/static/src/js/dashboard.js +++ b/addons/web_dashboard/static/src/js/dashboard.js @@ -277,87 +277,6 @@ instance.web.form.tags.add('hpaned', 'instance.web.form.DashBoardLegacy'); instance.web.form.tags.add('vpaned', 'instance.web.form.DashBoardLegacy'); instance.web.form.tags.add('board', 'instance.web.form.DashBoard'); -/* - * ConfigOverview - * This client action designed to be used as a dashboard widget display - * ir.actions.todo in a fancy way - */ -instance.web.client_actions.add( 'board.config.overview', 'instance.web_dashboard.ConfigOverview'); -instance.web_dashboard.ConfigOverview = instance.web.View.extend({ - template: 'ConfigOverview', - init: function (parent) { - this._super(parent); - this.user = _.extend(new instance.web.DataSet(this, 'res.users'), { - index: 0, - ids: [this.session.uid] - }); - this.dataset = new instance.web.DataSetSearch(this, 'ir.actions.todo'); - }, - start: function () { - var self = this; - return this.user.read_index(['groups_id']).pipe(function(record) { - var todos_filter = [ - ['type', '!=', 'automatic'], - '|', ['groups_id', '=', false], - ['groups_id', 'in', record['groups_id']]]; - return $.when( - self.dataset.read_slice( - ['state', 'action_id', 'category_id'], - { domain: todos_filter } - ), - self.dataset.call('progress').pipe( - function (arg) { return arg; }, null)) - }, null).then(this.on_records_loaded); - - }, - on_records_loaded: function (records, progress) { - var grouped_todos = _(records).chain() - .map(function (record) { - return { - id: record.id, - name: record.action_id[1], - done: record.state !== 'open', - to_do: record.state === 'open', - category: record['category_id'][1] || _t("Uncategorized") - } - }) - .groupBy(function (record) {return record.category}) - .value(); - this.$element.html(QWeb.render('ConfigOverview.content', { - completion: 100 * progress.done / progress.total, - groups: grouped_todos, - task_title: _t("Execute task \"%s\""), - checkbox_title: _t("Mark this task as done"), - _: _ - })); - var $progress = this.$element.find('div.oe-config-progress-bar'); - $progress.progressbar({value: $progress.data('completion')}); - - var self = this; - this.$element.find('dl') - .delegate('input', 'click', function (e) { - // switch todo status - e.stopImmediatePropagation(); - var new_state = this.checked ? 'done' : 'open', - todo_id = parseInt($(this).val(), 10); - self.dataset.write(todo_id, {state: new_state}, {}, function () { - self.start(); - }); - }) - .delegate('li:not(.oe-done)', 'click', function () { - self.getParent().getParent().getParent().do_execute_action({ - type: 'object', - name: 'action_launch' - }, self.dataset, - $(this).data('id'), function () { - // after action popup closed, refresh configuration - // thingie - self.start(); - }); - }); - } -}); - /* * Widgets * This client action designed to be used as a dashboard widget display @@ -397,79 +316,5 @@ instance.web_dashboard.Widget = instance.web.View.extend(/** @lends instance.web } }); -/* - * HomeTiles this client action display either the list of application to - * install (if none is installed yet) or a list of root menu items - */ -instance.web.client_actions.add('default_home', 'session.web_dashboard.ApplicationTiles'); -instance.web_dashboard.ApplicationTiles = instance.web.OldWidget.extend({ - template: 'web_dashboard.ApplicationTiles', - init: function(parent) { - this._super(parent); - }, - start: function() { - var self = this; - var domain = [['application','=',true], ['state','=','installed'], ['name', '!=', 'base']]; - var ds = new instance.web.DataSetSearch(this, 'ir.module.module',{},domain); - ds.read_slice(['id']).then(function(result) { - if(result.length) { - self.on_installed_database(); - } else { - self.on_uninstalled_database(); - } - }); - }, - on_uninstalled_database: function() { - installer = new instance.web_dashboard.ApplicationInstaller(this); - installer.appendTo(this.$element); - }, - on_installed_database: function() { - var self = this; - self.rpc('/web/menu/get_user_roots', {}).then(function (menu_ids) { - var menuds = new instance.web.DataSet(this, 'ir.ui.menu',{}) - .read_ids(menu_ids, ['name', 'web_icon_data', 'web_icon_hover_data', 'module']).then(function (applications) { - var tiles = QWeb.render('ApplicationTiles.content', {applications: applications}); - $(tiles).appendTo(self.$element).find('.oe_install-module-link').click(function () { - instance.webclient.menu.on_menu_click(null, $(this).data('menu')) - }); - }); - }); - } -}); - -/** - * ApplicationInstaller - * This client action display a list of applications to install. - */ -instance.web.client_actions.add( 'board.application.installer', 'instance.web_dashboard.ApplicationInstaller'); -instance.web_dashboard.ApplicationInstaller = instance.web.OldWidget.extend({ - template: 'web_dashboard.ApplicationInstaller', - start: function () { - // TODO menu hide - var r = this._super(); - this.action_manager = new instance.web.ActionManager(this); - this.action_manager.appendTo(this.$element.find('.oe_installer')); - this.action_manager.do_action({ - type: 'ir.actions.act_window', - res_model: 'ir.module.module', - domain: [['application','=',true]], - views: [[false, 'kanban']], - flags: { - display_title:false, - search_view: false, - views_switcher: false, - action_buttons: false, - sidebar: false, - pager: false - } - }); - return r; - }, - destroy: function() { - this.action_manager.destroy(); - return this._super(); - } -}); - }; diff --git a/addons/web_dashboard/static/src/xml/web_dashboard.xml b/addons/web_dashboard/static/src/xml/web_dashboard.xml index 9a9c0486400..c182d8b58a7 100644 --- a/addons/web_dashboard/static/src/xml/web_dashboard.xml +++ b/addons/web_dashboard/static/src/xml/web_dashboard.xml @@ -56,71 +56,9 @@ -
      - -
      -
      - progress: % -
      -
      -
      -

      Click on the functionalites listed below to launch them and configure your system

      -
      - -
      -
        -
      • - - -
      • -
      -
      - -
      - -