[REF] get_module_resource() must imported from openerp.modules (instead of openerp.addons).
bzr revid: vmt@openerp.com-20130416151844-gatbo4s2l2e6reme
This commit is contained in:
parent
39c88d0922
commit
3fe1f53514
|
@ -20,12 +20,13 @@
|
|||
##############################################################################
|
||||
|
||||
import base64
|
||||
from StringIO import StringIO
|
||||
|
||||
from openerp.modules.module import get_module_resource
|
||||
import openerp.modules.registry
|
||||
from openerp.osv import osv
|
||||
from openerp_sxw2rml import sxw2rml
|
||||
from StringIO import StringIO
|
||||
from openerp import addons
|
||||
|
||||
|
||||
|
||||
class report_xml(osv.osv):
|
||||
_inherit = 'ir.actions.report.xml'
|
||||
|
@ -36,9 +37,9 @@ class report_xml(osv.osv):
|
|||
'''
|
||||
sxwval = StringIO(base64.decodestring(file_sxw))
|
||||
if file_type=='sxw':
|
||||
fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
|
||||
fp = open(get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
|
||||
if file_type=='odt':
|
||||
fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
|
||||
fp = open(get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
|
||||
return {'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read()))}
|
||||
|
||||
def upload_report(self, cr, uid, report_id, file_sxw, file_type, context=None):
|
||||
|
@ -47,9 +48,9 @@ class report_xml(osv.osv):
|
|||
'''
|
||||
sxwval = StringIO(base64.decodestring(file_sxw))
|
||||
if file_type=='sxw':
|
||||
fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
|
||||
fp = open(get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_oo2rml.xsl'),'rb')
|
||||
if file_type=='odt':
|
||||
fp = open(addons.get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
|
||||
fp = open(get_module_resource('base_report_designer','openerp_sxw2rml', 'normalized_odt2rml.xsl'),'rb')
|
||||
report = self.pool['ir.actions.report.xml'].write(cr, uid, [report_id], {
|
||||
'report_sxw_content': base64.decodestring(file_sxw),
|
||||
'report_rml_content': str(sxw2rml(sxwval, xsl=fp.read())),
|
||||
|
|
|
@ -23,7 +23,7 @@ from openerp.osv import fields
|
|||
from openerp.osv import osv
|
||||
import base64
|
||||
from openerp.tools.translate import _
|
||||
from openerp import addons
|
||||
from openerp.modules.module import get_module_resource
|
||||
|
||||
class base_report_designer_installer(osv.osv_memory):
|
||||
_name = 'base_report_designer.installer'
|
||||
|
@ -31,7 +31,7 @@ class base_report_designer_installer(osv.osv_memory):
|
|||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
data = super(base_report_designer_installer, self).default_get(cr, uid, fields, context=context)
|
||||
plugin_file = open(addons.get_module_resource('base_report_designer','plugin', 'openerp_report_designer.zip'),'rb')
|
||||
plugin_file = open(get_module_resource('base_report_designer','plugin', 'openerp_report_designer.zip'),'rb')
|
||||
data['plugin_file'] = base64.encodestring(plugin_file.read())
|
||||
return data
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
Mail script will fetch his request from mail server. Then I process that mail after read EML file.
|
||||
-
|
||||
!python {model: mail.thread}: |
|
||||
from openerp import addons
|
||||
request_file = open(addons.get_module_resource('crm','test', 'customer_request.eml'),'rb')
|
||||
request_file = open(openerp.modules.module.get_module_resource('crm','test', 'customer_request.eml'),'rb')
|
||||
request_message = request_file.read()
|
||||
self.message_process(cr, uid, 'crm.lead', request_message)
|
||||
-
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
Mail script will be fetched him request from mail server. so I process that mail after read EML file
|
||||
-
|
||||
!python {model: mail.thread}: |
|
||||
from openerp import addons
|
||||
request_file = open(addons.get_module_resource('crm_claim','test', 'customer_claim.eml'),'rb')
|
||||
request_file = open(openerp.modules.module.get_module_resource('crm_claim','test', 'customer_claim.eml'),'rb')
|
||||
request_message = request_file.read()
|
||||
self.message_process(cr, uid, 'crm.claim', request_message)
|
||||
-
|
||||
|
|
|
@ -47,10 +47,9 @@
|
|||
-
|
||||
!python {model: ir.attachment}: |
|
||||
from document_webdav import test_davclient as te
|
||||
import addons
|
||||
dc = te.DAVClient()
|
||||
dc.get_creds(self, cr, uid)
|
||||
tdp = addons.get_module_resource('document_webdav', 'test_davclient.py')
|
||||
tdp = openerp.modules.module.get_module_resource('document_webdav', 'test_davclient.py')
|
||||
res = dc.gd_put(path=cr.dbname+'/Documents/test_davclient.py', srcpath=tdp)
|
||||
-
|
||||
I will try to get the file from the root
|
||||
|
@ -60,5 +59,5 @@
|
|||
import addons
|
||||
dc = te.DAVClient()
|
||||
dc.get_creds(self, cr, uid)
|
||||
tdp = addons.get_module_resource('document_webdav', 'test_davclient.py')
|
||||
tdp = openerp.modules.module.get_module_resource('document_webdav', 'test_davclient.py')
|
||||
res = dc.gd_get(path=cr.dbname+'/Documents/test_davclient.py', crange=(4,508), compare=tdp)
|
||||
|
|
|
@ -608,7 +608,7 @@ try:
|
|||
if base_path and base_path == '/':
|
||||
dir_path = config.get_misc('static-http', 'dir_path', False)
|
||||
else:
|
||||
dir_path = openerp.addons.get_module_resource('document_webdav','public_html')
|
||||
dir_path = openerp.modules.module.get_module_resource('document_webdav','public_html')
|
||||
# an _ugly_ hack: we put that dir back in tools.config.misc, so that
|
||||
# the StaticHttpHandler can find its dir_path.
|
||||
config.misc.setdefault('static-http',{})['dir_path'] = dir_path
|
||||
|
|
|
@ -19,10 +19,12 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import addons
|
||||
import logging
|
||||
|
||||
from openerp.modules.module import get_module_resource
|
||||
from openerp.osv import fields, osv
|
||||
from openerp import tools
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class hr_employee_category(osv.osv):
|
||||
|
@ -259,7 +261,7 @@ class hr_employee(osv.osv):
|
|||
return {'value': {'work_email' : work_email}}
|
||||
|
||||
def _get_default_image(self, cr, uid, context=None):
|
||||
image_path = addons.get_module_resource('hr', 'static/src/img', 'default_image.png')
|
||||
image_path = get_module_resource('hr', 'static/src/img', 'default_image.png')
|
||||
return tools.image_resize_image_big(open(image_path, 'rb').read().encode('base64'))
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -25,7 +25,8 @@ from lxml import etree
|
|||
import os
|
||||
from time import strftime
|
||||
|
||||
from openerp import addons, tools
|
||||
from openerp import tools
|
||||
from openerp.modules.module import get_module_resource
|
||||
from openerp.osv import fields, osv
|
||||
import openerp.report
|
||||
from openerp.tools import to_xml
|
||||
|
@ -412,7 +413,7 @@ class survey_question_wiz(osv.osv_memory):
|
|||
response_id = surv_name_wiz.read(cr, uid, context.get('sur_name_id',False))['response']
|
||||
report = self.create_report(cr, uid, [survey_id], 'report.survey.browse.response', survey_data.title,context)
|
||||
attachments = {}
|
||||
pdf_filename = addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf"
|
||||
pdf_filename = get_module_resource('survey', 'report') + survey_data.title + ".pdf"
|
||||
if os.path.exists(pdf_filename):
|
||||
file = open(pdf_filename)
|
||||
file_data = ""
|
||||
|
@ -424,7 +425,7 @@ class survey_question_wiz(osv.osv_memory):
|
|||
|
||||
attachments[survey_data.title + ".pdf"] = file_data
|
||||
file.close()
|
||||
os.remove(addons.get_module_resource('survey', 'report') + survey_data.title + ".pdf")
|
||||
os.remove(get_module_resource('survey', 'report') + survey_data.title + ".pdf")
|
||||
context.update({'response_id':response_id})
|
||||
user_email = user_obj.browse(cr, uid, uid, context).email
|
||||
resp_email = survey_data.responsible_id and survey_data.responsible_id.email or False
|
||||
|
@ -466,7 +467,7 @@ class survey_question_wiz(osv.osv_memory):
|
|||
try:
|
||||
uid = 1
|
||||
result, format = openerp.report.render_report(cr, uid, res_ids, report_name[len('report.'):], {}, context)
|
||||
ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf'
|
||||
ret_file_name = get_module_resource('survey', 'report') + file_name + '.pdf'
|
||||
fp = open(ret_file_name, 'wb+');
|
||||
fp.write(result);
|
||||
fp.close();
|
||||
|
|
|
@ -26,7 +26,8 @@ import os
|
|||
import datetime
|
||||
import socket
|
||||
|
||||
from openerp import addons, tools
|
||||
from openerp import tools
|
||||
from openerp.modules.module import get_module_resource
|
||||
from openerp.osv import fields, osv
|
||||
import openerp.report
|
||||
from openerp.tools.translate import _
|
||||
|
@ -85,7 +86,7 @@ Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'we
|
|||
if not report_name or not res_ids:
|
||||
return (False, Exception('Report name and Resources ids are required !!!'))
|
||||
try:
|
||||
ret_file_name = addons.get_module_resource('survey', 'report') + file_name + '.pdf'
|
||||
ret_file_name = get_module_resource('survey', 'report') + file_name + '.pdf'
|
||||
result, format = openerp.report.render_report(cr, uid, res_ids, report_name[len('report.'):], {}, {})
|
||||
fp = open(ret_file_name, 'wb+');
|
||||
fp.write(result);
|
||||
|
@ -128,7 +129,7 @@ Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'we
|
|||
new_user.append(use.id)
|
||||
for id in survey_ref.browse(cr, uid, survey_ids):
|
||||
report = self.create_report(cr, uid, [id.id], 'report.survey.form', id.title)
|
||||
file = open(addons.get_module_resource('survey', 'report') + id.title +".pdf")
|
||||
file = open(get_module_resource('survey', 'report') + id.title +".pdf")
|
||||
file_data = ""
|
||||
while 1:
|
||||
line = file.readline()
|
||||
|
@ -137,7 +138,7 @@ Thanks,''') % (name, self.pool.get('ir.config_parameter').get_param(cr, uid, 'we
|
|||
break
|
||||
file.close()
|
||||
attachments[id.title +".pdf"] = file_data
|
||||
os.remove(addons.get_module_resource('survey', 'report') + id.title +".pdf")
|
||||
os.remove(get_module_resource('survey', 'report') + id.title +".pdf")
|
||||
|
||||
for partner in self.pool.get('res.partner').browse(cr, uid, partner_ids):
|
||||
if not partner.email:
|
||||
|
|
Loading…
Reference in New Issue