Hello, somehow I never had a look at formats.js, don't know why.
Your solution is just great! Thank you so much! Sven Petersen Von: Bui Ngoc Tu [mailto:tnbui...@gmail.com] Gesendet: Dienstag, 10. Juli 2012 08:10 An: Sven Petersen Cc: openerp-community@lists.launchpad.net; Niels Huylebroeck Betreff: Re: [Openerp-community] Solution/Example for displaying icons in a Tree View (OpenERP 6.1)? Hello, Did you find a way to fix this problem? I also got the same problem when trying to display an image in the tree view base on the value of the record. Below is what i did to fix it: 1. In the xml file, use a new widget "my_new_widget" for the field which I want to display the image <field name="day_1" widget="my_new_widget"/> 1. In the function "openerp.web.format_cell" of the file web/addons/web/static/src/js/formats.js, add source code to handle my new widget. case 'progressbar': return _.template( '<progress value="<%-value%>" max="100"><%-value%>%</progress>', { value: row_data[column.id<http://column.id>].value }); case 'my_new_widget': var data = row_data[column.id<http://column.id>]; var src_image = '/web/static/src/img/icons/available.png'; if (data === 'case1') { src_image = '/web/static/src/img/icons/case1.png'; } else if (data === 'case2') { src_image = '/web/static/src/img/icons/case2.png'; } return _.str.sprintf('<img src="%s"/>', src_image); Hope that help ;) Regards, Tu Bui Technical Project Manager - Trobz Web: www.trobz.com<http://www.trobz.com> On Tue, Jul 3, 2012 at 10:11 PM, Sven Petersen <s.peter...@conexus.at<mailto:s.peter...@conexus.at>> wrote: Hello again, well there is a render_cell function in web/static/src/js/view_list.js of the webclient, but honestly I'm not sure if this would be the right place to start for rendering an image? I would be happy for suggestions! thank you! Von: Sven Petersen Gesendet: Donnerstag, 28. Juni 2012 12:01 An: Sven Petersen; Niels Huylebroeck Cc: openerp-community@lists.launchpad.net<mailto:openerp-community@lists.launchpad.net> Betreff: AW: [Openerp-community] Solution/Example for displaying icons in a Tree View (OpenERP 6.1)? Hello, the Web Client seems to ignore widget="image" in Tree Views, so that doesn't work. Any other Ideas? (except waiting for v7 and playing around with jquery? :)) thanks! Von: openerp-community-bounces+office=conexus...@lists.launchpad.net<mailto:openerp-community-bounces+office=conexus...@lists.launchpad.net> [mailto:openerp-community-bounces+office=conexus...@lists.launchpad.net]<mailto:[mailto:openerp-community-bounces+office=conexus...@lists.launchpad.net]> Im Auftrag von Sven Petersen Gesendet: Mittwoch, 27. Juni 2012 14:21 An: Niels Huylebroeck Cc: openerp-community@lists.launchpad.net<mailto:openerp-community@lists.launchpad.net> Betreff: Re: [Openerp-community] Solution/Example for displaying icons in a Tree View (OpenERP 6.1)? I'll try that. Thank you! Von: Niels Huylebroeck [mailto:n...@agaplan.eu]<mailto:[mailto:n...@agaplan.eu]> Gesendet: Mittwoch, 27. Juni 2012 14:17 An: Sven Petersen Cc: Eric Caudal; openerp-community@lists.launchpad.net<mailto:openerp-community@lists.launchpad.net> Betreff: Re: [Openerp-community] Solution/Example for displaying icons in a Tree View (OpenERP 6.1)? 2012/6/27 Sven Petersen <s.peter...@conexus.at<mailto:s.peter...@conexus.at>> Thank you for your answer, but I'm in need of displaying custom icons according to a field value of a record line. So far icons can only be set for buttons, or am I wrong? Not sure if this will work but what about showing a fields.binary with widget="image" on your tree form ? It would require you to "store" the images inside the database though (only once if you use a functional field to fetch values on the fly) -- Niels Huylebroeck Lead Architect -- Agaplan Tel. : +32 (0) 93 95 98 90 Web : http://www.agaplan.eu _______________________________________________ Mailing list: https://launchpad.net/~openerp-community<https://launchpad.net/%7Eopenerp-community> Post to : openerp-community@lists.launchpad.net<mailto:openerp-community@lists.launchpad.net> Unsubscribe : https://launchpad.net/~openerp-community<https://launchpad.net/%7Eopenerp-community> More help : https://help.launchpad.net/ListHelp
_______________________________________________ Mailing list: https://launchpad.net/~openerp-community Post to : openerp-community@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-community More help : https://help.launchpad.net/ListHelp