Improvement for the web client dash board
bzr revid: gpa@tinyerp.com-20101124104936-rk38vyhz7bll6f9r
This commit is contained in:
parent
cb34b3f368
commit
1a6ab82f7b
|
@ -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">
|
||||
|
|
|
@ -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 @@ class ir_ui_menu(osv.osv):
|
|||
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 @@ class ir_ui_menu(osv.osv):
|
|||
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=[
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -25,6 +25,7 @@ import logging
|
|||
import os.path
|
||||
import pickle
|
||||
import re
|
||||
import addons
|
||||
|
||||
# for eval context:
|
||||
import time
|
||||
|
@ -284,7 +285,7 @@ form: module.record_id""" % (xml_id,)
|
|||
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 @@ form: module.record_id""" % (xml_id,)
|
|||
|
||||
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 @@ form: module.record_id""" % (xml_id,)
|
|||
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 = []
|
||||
|
|
Loading…
Reference in New Issue