Merge lp:~openerp-dev/openerp-web/7.0-opw-586295-msh into lp:openerp-web/7.0

Proposed by Mohammed Shekha(Open ERP)
Status: Needs review
Proposed branch: lp:~openerp-dev/openerp-web/7.0-opw-586295-msh
Merge into: lp:openerp-web/7.0
Diff against target: 15 lines (+5/-1)
1 file modified
addons/web/static/src/js/view_list.js (+5/-1)
To merge this branch: bzr merge lp:~openerp-dev/openerp-web/7.0-opw-586295-msh
Reviewer Review Type Date Requested Status
Xavier (Open ERP) (community) Needs Fixing
Mohammed Shekha(Open ERP) (community) Needs Resubmitting
Martin Trigaux (OpenERP) Pending
Review via email: mp+153347@code.launchpad.net

Description of the change

Hello,

Fixed the issue of create button which should be disabled when there is grouped data in list view.

Demo:- Open any list view and select group by filter, see still create button is enabled whereas it should be disabled, there is already code written to prop button but not at proper place.

Initially fields_view_get is called so on done of fields_view_get load_list is called at that time grouping will not be there so initially create button will be enabled now grouping is applied so again fields_view_get is called but now buttons are available in this.$buttons so it not going to disable the create button.

Thanks.

To post a comment you must log in.
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

Why test `if (this.$buttons)` since lines above always assign this.$buttons if does not already exist?

review: Needs Fixing
Revision history for this message
Mohammed Shekha(Open ERP) (msh-openerp) wrote :

Hello Xavier,

Thanks for the review.

Initially field_View get called and we will not have buttons in this object, but while grouping data again list reloaded but now this time we will have $buttons in this object so it is not going to be inside if(see line 233 view_list.js) so button is not going to be disabled as prop is inside if, also click shoild binded single time so keep it as it is, just put prop outside if there are this.$button available.

Thanks.

review: Needs Resubmitting
Revision history for this message
Xavier (Open ERP) (xmo-deactivatedaccount) wrote :

> Initially field_View get called and we will not have buttons in this object

The buttons are set right above this, at line 273 and 274 if there are no buttons on the object we add them, by the time the new code is reached this.$buttons *can only be true*, there's nothing which could remove them.

review: Needs Fixing

Unmerged revisions

3841. By Mohammed Shekha<email address hidden>

[FIX]Fixed the issue of create button which should be disabled when there is grouped data in list view.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'addons/web/static/src/js/view_list.js'
--- addons/web/static/src/js/view_list.js 2013-02-27 21:25:07 +0000
+++ addons/web/static/src/js/view_list.js 2013-03-14 12:44:23 +0000
@@ -278,7 +278,11 @@
278 this.$el.find('.oe_list_buttons').replaceWith(this.$buttons);278 this.$el.find('.oe_list_buttons').replaceWith(this.$buttons);
279 }279 }
280 this.$buttons.find('.oe_list_add')280 this.$buttons.find('.oe_list_add')
281 .click(this.proxy('do_add_record'))281 .click(this.proxy('do_add_record'));
282 }
283
284 if(this.$buttons) {
285 this.$buttons.find('.oe_list_add')
282 .prop('disabled', this.grouped);286 .prop('disabled', this.grouped);
283 }287 }
284288