Improvement for the transformation of the icon file paths inside

bzr revid: gpa@tinyerp.com-20101125052729-bajcewtj468rhcjx
This commit is contained in:
gpa 2010-11-25 10:57:29 +05:30
parent 1a6ab82f7b
commit 9de5e301e1
2 changed files with 6 additions and 5 deletions

View File

@ -23,6 +23,7 @@ from osv import fields, osv
import re
import tools
import base64
import addons
def one_in(setA, setB):
"""Check the presence of an element of setA in setB
@ -263,7 +264,9 @@ class ir_ui_menu(osv.osv):
return True
def read_image(self, path):
icon = tools.file_open(path,'rb').read()
file = path.split(',')
icon_path = addons.get_module_resource(file[0],file[1])
icon = tools.file_open(icon_path,'rb').read()
return base64.encodestring(icon)
def _get_image_icon(self, cr, uid, ids, name, args, context=None):

View File

@ -25,7 +25,6 @@ import logging
import os.path
import pickle
import re
import addons
# for eval context:
import time
@ -638,11 +637,10 @@ form: module.record_id""" % (xml_id,)
values['sequence'] = int(rec.get('sequence'))
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')))
values['web_icon'] = "%s,%s" %(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')))
values['web_icon_hover'] = "%s,%s" %(self.module, str(rec.get('web_icon_hover')))
if rec.get('groups'):
g_names = rec.get('groups','').split(',')