openerp-dev-web team mailing list archive
-
openerp-dev-web team
-
Mailing list archive
-
Message #00770
[Merge] lp:~openerp-dev/openobject-server/gpa-server-framework into lp:openobject-server
gpa(Open ERP) has proposed merging lp:~openerp-dev/openobject-server/gpa-server-framework into lp:openobject-server.
Requested reviews:
Olivier Dony (OpenERP) (odo)
Improvement for the web client dash board, transformation of the icon file paths inside read_image() using addons.get_module_resource.
--
https://code.launchpad.net/~openerp-dev/openobject-server/gpa-server-framework/+merge/41822
Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-server/gpa-server-framework.
=== modified file 'bin/addons/base/ir/ir.xml'
--- bin/addons/base/ir/ir.xml 2010-11-12 11:08:42 +0000
+++ bin/addons/base/ir/ir.xml 2010-11-25 05:33:01 +0000
@@ -1379,6 +1379,12 @@
<field name="action" colspan="4" />
<field name="icon" on_change="onchange_icon(icon)" colspan="2"/>
<field name="icon_pict" widget="picture" nolabel="1" colspan="2"/>
+ <group col="4" colspan="8">
+ <field name="web_icon" groups="base.group_extended" />
+ <field name="web_icon_hover" groups="base.group_extended" />
+ <field name="web_icon_data" widget="image" groups="base.group_extended"/>
+ <field name="web_icon_hover_data" widget="image" groups="base.group_extended"/>
+ </group>
</group>
<notebook colspan="4">
<page string="Groups">
=== modified file 'bin/addons/base/ir/ir_ui_menu.py'
--- bin/addons/base/ir/ir_ui_menu.py 2010-10-17 04:53:44 +0000
+++ bin/addons/base/ir/ir_ui_menu.py 2010-11-25 05:33:01 +0000
@@ -22,6 +22,7 @@
from osv import fields, osv
import re
import tools
+import base64
def one_in(setA, setB):
"""Check the presence of an element of setA in setB
@@ -260,8 +261,26 @@
return False
level -= 1
return True
-
-
+
+ def read_image(self, path):
+ icon = tools.file_open(path,'rb').read()
+ return base64.encodestring(icon)
+
+ def _get_image_icon(self, cr, uid, ids, name, args, context=None):
+ if context.get('bin_size', False):
+ context.update({'bin_size':False})
+ res = {}
+ for menu in self.browse(cr, uid, ids, context=context):
+ res[menu.id] = {
+ 'web_icon_data': False,
+ 'web_icon_hover_data': False,
+ }
+ if not menu.parent_id:
+ if menu.web_icon_hover:
+ res[menu.id]['web_icon_hover_data'] = self.read_image(menu.web_icon_hover)
+ if menu.web_icon:
+ res[menu.id]['web_icon_data'] = self.read_image(menu.web_icon)
+ return res
_columns = {
'name': fields.char('Menu', size=64, required=True, translate=True),
@@ -275,6 +294,10 @@
string='Complete Name', type='char', size=128),
'icon': fields.selection(tools.icons, 'Icon', size=64),
'icon_pict': fields.function(_get_icon_pict, method=True, type='char', size=32),
+ 'web_icon': fields.char('Icon File', size=128),
+ 'web_icon_hover':fields.char('Icon hover File', size=128),
+ 'web_icon_data': fields.function(_get_image_icon, string='Web Icons', type='binary', method=True, readonly=True, store=True, multi='icon'),
+ 'web_icon_hover_data':fields.function(_get_image_icon, string='Web Icons Hover', type='binary', method=True, readonly=True, store=True,multi='icon'),
'action': fields.function(_action, fnct_inv=_action_inv,
method=True, type='reference', string='Action',
selection=[
=== modified file 'bin/import_xml.rng'
--- bin/import_xml.rng 2010-10-08 14:23:01 +0000
+++ bin/import_xml.rng 2010-11-25 05:33:01 +0000
@@ -176,6 +176,8 @@
<rng:optional> <rng:attribute name="name"/></rng:optional>
<rng:optional> <rng:attribute name="parent"/> </rng:optional>
<rng:optional> <rng:attribute name="icon"/> </rng:optional>
+ <rng:optional> <rng:attribute name="web_icon"/> </rng:optional>
+ <rng:optional> <rng:attribute name="web_icon_hover"/> </rng:optional>
<rng:optional> <rng:attribute name="action"/> </rng:optional>
<rng:optional> <rng:attribute name="string"/> </rng:optional>
<rng:optional> <rng:attribute name="sequence"/> </rng:optional>
=== modified file 'bin/tools/convert.py'
--- bin/tools/convert.py 2010-11-16 21:53:59 +0000
+++ bin/tools/convert.py 2010-11-25 05:33:01 +0000
@@ -25,6 +25,7 @@
import os.path
import pickle
import re
+import addons
# for eval context:
import time
@@ -284,7 +285,7 @@
d_search = rec.get("search",'').encode('utf-8')
d_id = rec.get("id",'')
ids = []
-
+
if d_search:
idref = _get_idref(self, cr, self.uid, d_model, context={}, idref={})
ids = self.pool.get(d_model).search(cr, self.uid, unsafe_eval(d_search, idref))
@@ -556,7 +557,7 @@
values = {'parent_id': False}
if rec.get('parent', False) is False and len(m_l) > 1:
- # No parent attribute specified and the menu name has several menu components,
+ # No parent attribute specified and the menu name has several menu components,
# try to determine the ID of the parent according to menu path
pid = False
res = None
@@ -638,6 +639,11 @@
if rec.get('icon'):
values['icon'] = str(rec.get('icon'))
+ if rec.get('web_icon'):
+ values['web_icon'] = addons.get_module_resource(self.module,str(rec.get('web_icon')))
+ if rec.get('web_icon_hover'):
+ values['web_icon_hover'] = addons.get_module_resource(self.module,str(rec.get('web_icon_hover')))
+
if rec.get('groups'):
g_names = rec.get('groups','').split(',')
groups_value = []