Merge lp:~openerp/openobject-server/web-dashboard into lp:openobject-server

Proposed by Vaibhav Darji
Status: Rejected
Rejected by: Harry (OpenERP)
Proposed branch: lp:~openerp/openobject-server/web-dashboard
Merge into: lp:openobject-server
Diff against target: 172 lines (+45/-11)
6 files modified
bin/addons/base/base_menu.xml (+2/-5)
bin/addons/base/ir/ir.xml (+6/-0)
bin/addons/base/ir/ir_ui_menu.py (+26/-2)
bin/addons/base/res/partner/partner_view.xml (+1/-1)
bin/import_xml.rng (+2/-0)
bin/tools/convert.py (+8/-3)
To merge this branch: bzr merge lp:~openerp/openobject-server/web-dashboard
Reviewer Review Type Date Requested Status
Olivier Dony (Odoo) Needs Fixing
Xavier (Open ERP) (community) Needs Fixing
Review via email: mp+41389@code.launchpad.net

Description of the change

Implemented Web dashboard.
Added sample image for Administration.

To post a comment you must log in.
3032. By Vaibhav Darji

[REM] Removed unnecessary code.

Revision history for this message
Navrang Oza (noz-tiny) wrote :

@xmo,

From web client side, I have checked its working fine by applying web and server branch.
But for server side approval waiting.

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

Small issue: the handling of the web_icon and the web_icon_hover seem mostly independent, but what happens if we have a web_icon_hover and no web_icon?

review: Needs Information
Revision history for this message
Navrang Oza (noz-tiny) wrote :

> Small issue: the handling of the web_icon and the web_icon_hover seem mostly
> independent, but what happens if we have a web_icon_hover and no web_icon?
It is possible for reverse case also.

I think we can go for, If any one icon is available instead of two then both the times (hover and normal) same icon will be there.

possible ?

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

Also in the first section of the bin/addons/base/ir/ir_ui_menu.py code, why `res[menu.id].update({'web_icon_hover_datas': icon_hover,})`?

* Why call update rather than __setitem__
* Why provide a dict rather than use kwargs?

All in all, why not just use `res[menu.id]['web_icon_hover_datas'] = icon_hover`

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

Also, we should provide pre-set images, currently if I use this branch I don't have any images left on my home screen, which looks kinda weird.

review: Needs Fixing
3033. By Vaibhav Darji

[FIX] Code improvements.

Revision history for this message
Navrang Oza (noz-tiny) wrote :

> Also, we should provide pre-set images, currently if I use this branch I don't
> have any images left on my home screen, which looks kinda weird.

Can we set static image like "No image available" ?
Changes have been committed to the branch as you said.

Thanks for review.

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

> I think we can go for, If any one icon is available instead of two then both the times (hover and normal) same icon will be there.

Sure, so if only one image is present we use it for both situations (or we use it for regular and disable hover, that works as well)

> Can we set static image like "No image available" ?

Nah I meant set them on existing menuitem objects and stuff, currently they live in CSS but that was removed (as it was broken with i18n), so cleanup CSS and set images in modules and stuff. Because currently if you create new db with trunk (even using/merging this branch) the home page is completely empty of pictures whereas before there were lots of nice pictures.

3034. By Vaibhav Darji

[FIX] Add web icon for sale.

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Some additional feedback:

- why are you using type='char' for the *.datas fields - these should be binary fields, right? Have you ensured to be compatible with the current fields.binary implementation that allows reading size instead of content of binary fields. We don't want GTK to be reading these, do we?
- please rename the *datas field - data is already a plural form - "datas" does not exist (yes I know we have many typos like that already.. so let's not introduce more!)
- why do you do the resolution of the "web_icon*" paths during menu creation in convert.py? What if I want to move my addons after installing the module? Please do it in the function fields.
- final note: if these values are accessed often, you would do good to make the function fields "stored", so the icons can be cached (user can simply save the menu again to refresh it) And when you do that, you really need to make them type='binary' and conform to the binary logic

Thanks!

review: Needs Fixing
Revision history for this message
Harry (OpenERP) (hmo-tinyerp) wrote :

Hello All!

sorry I'm rejected this merge proposal. but You can Review this merge proposal for this feature : https://code.launchpad.net/~openerp-dev/openobject-server/gpa-server-framework/+merge/41707

Thanks

Unmerged revisions

3034. By Vaibhav Darji

[FIX] Add web icon for sale.

3033. By Vaibhav Darji

[FIX] Code improvements.

3032. By Vaibhav Darji

[REM] Removed unnecessary code.

3031. By Vaibhav Darji

[ADD] Web dashboard.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/base/base_menu.xml'
2--- bin/addons/base/base_menu.xml 2010-10-17 19:02:08 +0000
3+++ bin/addons/base/base_menu.xml 2010-11-23 11:42:13 +0000
4@@ -1,8 +1,7 @@
5 <?xml version="1.0" encoding="utf-8"?>
6 <openerp>
7 <data>
8- <menuitem icon="terp-administration" id="menu_administration" name="Administration" sequence="50"/>
9-
10+ <menuitem icon="terp-administration" id="menu_administration" name="Administration" sequence="50" web_icon="image/admin.png" web_icon_hover="image/admin_hover.png"/>
11 <menuitem icon="terp-administration" id="menu_administration_shortcut" parent="menu_administration" name="Custom Shortcuts" sequence="50"/>
12 <menuitem id="next_id_4" name="Low Level Objects"
13 parent="base.menu_administration" sequence="3"
14@@ -22,9 +21,7 @@
15 groups="base.group_extended"/>
16 <menuitem id="menu_management" name="Modules" parent="base.menu_administration" sequence="10"
17 groups="base.group_extended"/>
18- <menuitem id="reporting_menu"
19- parent="base.menu_custom" name="Reporting" sequence="30"
20- />
21+ <menuitem id="reporting_menu" parent="base.menu_custom" name="Reporting" sequence="30"/>
22
23 <menuitem id="base.menu_reporting" name="Reporting" parent="base.menu_administration" sequence="11"
24 groups="base.group_extended"/>
25
26=== added directory 'bin/addons/base/image'
27=== added file 'bin/addons/base/image/admin.png'
28Binary files bin/addons/base/image/admin.png 1970-01-01 00:00:00 +0000 and bin/addons/base/image/admin.png 2010-11-23 11:42:13 +0000 differ
29=== added file 'bin/addons/base/image/admin_hover.png'
30Binary files bin/addons/base/image/admin_hover.png 1970-01-01 00:00:00 +0000 and bin/addons/base/image/admin_hover.png 2010-11-23 11:42:13 +0000 differ
31=== added file 'bin/addons/base/image/sale.png'
32Binary files bin/addons/base/image/sale.png 1970-01-01 00:00:00 +0000 and bin/addons/base/image/sale.png 2010-11-23 11:42:13 +0000 differ
33=== added file 'bin/addons/base/image/sale_hover.png'
34Binary files bin/addons/base/image/sale_hover.png 1970-01-01 00:00:00 +0000 and bin/addons/base/image/sale_hover.png 2010-11-23 11:42:13 +0000 differ
35=== modified file 'bin/addons/base/ir/ir.xml'
36--- bin/addons/base/ir/ir.xml 2010-11-12 11:08:42 +0000
37+++ bin/addons/base/ir/ir.xml 2010-11-23 11:42:13 +0000
38@@ -1379,6 +1379,12 @@
39 <field name="action" colspan="4" />
40 <field name="icon" on_change="onchange_icon(icon)" colspan="2"/>
41 <field name="icon_pict" widget="picture" nolabel="1" colspan="2"/>
42+ <group col="4" colspan="8">
43+ <field name="web_icon" groups="base.group_extended" />
44+ <field name="web_icon_hover" groups="base.group_extended" />
45+ <field name="web_icon_datas" widget="picture" groups="base.group_extended"/>
46+ <field name="web_icon_hover_datas" widget="picture" groups="base.group_extended"/>
47+ </group>
48 </group>
49 <notebook colspan="4">
50 <page string="Groups">
51
52=== modified file 'bin/addons/base/ir/ir_ui_menu.py'
53--- bin/addons/base/ir/ir_ui_menu.py 2010-10-17 04:53:44 +0000
54+++ bin/addons/base/ir/ir_ui_menu.py 2010-11-23 11:42:13 +0000
55@@ -22,6 +22,7 @@
56 from osv import fields, osv
57 import re
58 import tools
59+import base64
60
61 def one_in(setA, setB):
62 """Check the presence of an element of setA in setB
63@@ -260,8 +261,27 @@
64 return False
65 level -= 1
66 return True
67-
68-
69+
70+ def _get_image_icon(self, cr, uid, ids, name, args, context=None):
71+ res = {}
72+ for menu in self.browse(cr, uid, ids, context=context):
73+ res[menu.id] = {
74+ 'web_icon_datas': False,
75+ 'web_icon_hover_datas': False,
76+ }
77+ if not menu.parent_id:
78+ if menu.web_icon_hover:
79+ fp_icon_hover = file(menu.web_icon_hover,'r')
80+ file_data_icon_hover = fp_icon_hover.read()
81+ icon_hover = base64.encodestring(file_data_icon_hover)
82+ res[menu.id]['web_icon_hover_datas'] = icon_hover
83+ if menu.web_icon:
84+ fp_icon = file(menu.web_icon,'r')
85+ file_data_icon = fp_icon.read()
86+ icon = base64.encodestring(file_data_icon)
87+ res[menu.id]['web_icon_datas'] = icon
88+ return res
89+
90
91 _columns = {
92 'name': fields.char('Menu', size=64, required=True, translate=True),
93@@ -275,6 +295,10 @@
94 string='Complete Name', type='char', size=128),
95 'icon': fields.selection(tools.icons, 'Icon', size=64),
96 'icon_pict': fields.function(_get_icon_pict, method=True, type='char', size=32),
97+ 'web_icon': fields.char('Icon File', size=128),
98+ 'web_icon_hover':fields.char('Icon hover File', size=128),
99+ 'web_icon_datas': fields.function(_get_image_icon, method=True, string='Web Icons', type='char', readonly=True, multi='icon'),
100+ 'web_icon_hover_datas':fields.function(_get_image_icon, method=True, type='char', string='Web Icons Hover', readonly=True, multi='icon'),
101 'action': fields.function(_action, fnct_inv=_action_inv,
102 method=True, type='reference', string='Action',
103 selection=[
104
105=== modified file 'bin/addons/base/res/partner/partner_view.xml'
106--- bin/addons/base/res/partner/partner_view.xml 2010-10-17 12:17:42 +0000
107+++ bin/addons/base/res/partner/partner_view.xml 2010-11-23 11:42:13 +0000
108@@ -1,7 +1,7 @@
109 <?xml version="1.0" encoding="utf-8"?>
110 <openerp>
111 <data>
112- <menuitem icon="terp-partner" id="menu_base_partner" name="Sales" sequence="0"/>
113+ <menuitem icon="terp-partner" id="menu_base_partner" name="Sales" sequence="0" web_icon="addons/base/image/sale.png" web_icon_hover="addons/base/image/sale_hover.png"/>
114
115 <menuitem id="menu_address_book" name="Address Book" parent="menu_base_partner" sequence="2"/>
116
117
118=== modified file 'bin/import_xml.rng'
119--- bin/import_xml.rng 2010-10-08 14:23:01 +0000
120+++ bin/import_xml.rng 2010-11-23 11:42:13 +0000
121@@ -176,6 +176,8 @@
122 <rng:optional> <rng:attribute name="name"/></rng:optional>
123 <rng:optional> <rng:attribute name="parent"/> </rng:optional>
124 <rng:optional> <rng:attribute name="icon"/> </rng:optional>
125+ <rng:optional> <rng:attribute name="web_icon"/> </rng:optional>
126+ <rng:optional> <rng:attribute name="web_icon_hover"/> </rng:optional>
127 <rng:optional> <rng:attribute name="action"/> </rng:optional>
128 <rng:optional> <rng:attribute name="string"/> </rng:optional>
129 <rng:optional> <rng:attribute name="sequence"/> </rng:optional>
130
131=== modified file 'bin/tools/convert.py'
132--- bin/tools/convert.py 2010-11-16 21:53:59 +0000
133+++ bin/tools/convert.py 2010-11-23 11:42:13 +0000
134@@ -25,7 +25,7 @@
135 import os.path
136 import pickle
137 import re
138-
139+import addons
140 # for eval context:
141 import time
142 import release
143@@ -284,7 +284,7 @@
144 d_search = rec.get("search",'').encode('utf-8')
145 d_id = rec.get("id",'')
146 ids = []
147-
148+
149 if d_search:
150 idref = _get_idref(self, cr, self.uid, d_model, context={}, idref={})
151 ids = self.pool.get(d_model).search(cr, self.uid, unsafe_eval(d_search, idref))
152@@ -556,7 +556,7 @@
153
154 values = {'parent_id': False}
155 if rec.get('parent', False) is False and len(m_l) > 1:
156- # No parent attribute specified and the menu name has several menu components,
157+ # No parent attribute specified and the menu name has several menu components,
158 # try to determine the ID of the parent according to menu path
159 pid = False
160 res = None
161@@ -638,6 +638,11 @@
162 if rec.get('icon'):
163 values['icon'] = str(rec.get('icon'))
164
165+ if rec.get('web_icon'):
166+ values['web_icon'] = addons.get_module_resource(self.module,str(rec.get('web_icon')))
167+ if rec.get('web_icon_hover'):
168+ values['web_icon_hover'] = addons.get_module_resource(self.module,str(rec.get('web_icon_hover')))
169+
170 if rec.get('groups'):
171 g_names = rec.get('groups','').split(',')
172 groups_value = []