[trunk] Cannot properly override tree view functionality

Bug #941807 reported by Stefan Rijnhart (Opener)

This bug report was converted into a question: question #201081: [trunk] Cannot properly override tree view functionality.

8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
Confirmed
Wishlist
OpenERP R&D Web Team

Bug Description

Hi,

We are having a lot of fun creating web addons based on the new architecture. You did a great job with that!

However, we are now running in to trouble with the openerp.web.TreeView class, which is used to display a 'proper' tree, not a list. We are implementing an addon that expands the path in the tree down given a specially crafted act_window that contains the active record. In order to do so, we cannot simply tag on to the on_loaded method, but need to copy it instead together with a large chunk of other code as it contains asynchronous code that does not return its promise, and we depend on that code having been executed.

Replacing a class method by a copy is of course heresy to the whole design of the web client and makes loading two independent addons that work on the same piece of code impossible.

To see what I mean, please have a look at addons/web/static/src/js/view_tree.js (see [1]). My guess would be to make the callback function that you pass to dataset.read_slice() a named method on the class, and make it pass the promise that TreeView.getdata() should pass in its turn so that we can tag on to that method instead.

Cheers,
Stefan.

[1] http://bazaar.launchpad.net/~openerp/openerp-web/trunk/view/head:/addons/web/static/src/js/view_tree.js#L89

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

Wouldn't on_loaded correctly returning the deferred of read_slice (piped with getdata if needed, with getdata returning its own read_slice's result) suffice?

Alternatively, would it not make just as much sense to override getdata (before currently, after if getdata correctly returned its own deferred)?

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Xavier,

The first suggestion sounds good to me. Don't know about overriding getdata instead of on_loaded given that our code needs to run only once, at load time ;-)

Cheers,
Stefan.

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello,

It's not a bug rather than a question, So I am converting this into question...
Also I would like to request to XMO or any web team member please give a answer of this question.

Thank you!

Changed in openerp-web:
status: New → Invalid
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Setting confirmed as per Xavier's comment

Changed in openerp-web:
importance: Undecided → Wishlist
status: Invalid → Confirmed
Amit Parik (amit-parik)
Changed in openerp-web:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.