From 460f3102bc7d2edd13b8efc302bb585d5a7e079a Mon Sep 17 00:00:00 2001 From: "ACH(OpenERP)" <> Date: Wed, 2 Sep 2009 20:23:54 +0530 Subject: [PATCH 1/6] [FIX] Send Mail : Unicode error handled lp bug: https://launchpad.net/bugs/421162 fixed bzr revid: jvo@tinyerp.com-20090902145354-5b43k67lpbe513cj --- bin/tools/misc.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/tools/misc.py b/bin/tools/misc.py index 7760a9a851d..d8bd58bfcbd 100644 --- a/bin/tools/misc.py +++ b/bin/tools/misc.py @@ -331,7 +331,10 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non email_bcc = [] if not attach: - msg = MIMEText(body.encode('utf-8') or '',_subtype=subtype,_charset='utf-8') + try: + msg = MIMEText(body.encode('utf8') or '',_subtype=subtype,_charset='utf-8') + except: + msg = MIMEText(body or '',_subtype=subtype,_charset='utf-8') else: msg = MIMEMultipart() @@ -362,8 +365,10 @@ def email_send(email_from, email_to, subject, body, email_cc=None, email_bcc=Non msg['Message-Id'] = "<%s-tinycrm-%s@%s>" % (time.time(), tinycrm, socket.gethostname()) if attach: - msg.attach( MIMEText(body.encode('utf-8') or '', _charset='utf-8', _subtype=subtype) ) - + try: + msg.attach(MIMEText(body.encode('utf8') or '',_subtype=subtype,_charset='utf-8')) + except: + msg.attach(MIMEText(body or '', _charset='utf-8', _subtype=subtype) ) for (fname,fcontent) in attach: part = MIMEBase('application', "octet-stream") part.set_payload( fcontent ) From 02fd0eb506ff822a8c09580be7f352d63f953ef0 Mon Sep 17 00:00:00 2001 From: "ACH,Jay" <> Date: Thu, 3 Sep 2009 18:19:28 +0530 Subject: [PATCH 2/6] [FIX] Translation issue with cache: it needed to restart server,SOLVED lp bug: https://launchpad.net/bugs/399208 fixed bzr revid: jvo@tinyerp.com-20090903124928-mbzr7ekxoo4sba49 --- bin/addons/base/ir/ir_translation.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/bin/addons/base/ir/ir_translation.py b/bin/addons/base/ir/ir_translation.py index 68e9138479e..9bf6e0ae776 100644 --- a/bin/addons/base/ir/ir_translation.py +++ b/bin/addons/base/ir/ir_translation.py @@ -143,6 +143,33 @@ class ir_translation(osv.osv): res = cr.fetchone() trad = res and res[0] or '' return trad + + def create(self, cursor, user, vals, context=None): + if not context: + context = {} + ids = super(ir_translation, self).create(cursor, user, vals, context=context) + for trans_obj in self.read(cursor, user, [ids], ['name','type','res_id'], context=context): + self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], lang=context.get('lang','en_US')) + self._get_ids.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], context.get('lang','en_US'), [trans_obj['res_id']]) + return ids + + def write(self, cursor, user, ids, vals, context=None): + if not context: + context = {} + result = super(ir_translation, self).write(cursor, user, ids, vals, context=context) + for trans_obj in self.read(cursor, user, ids, ['name','type','res_id'], context=context): + self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], lang=context.get('lang','en_US')) + self._get_ids.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], context.get('lang','en_US'), [trans_obj['res_id']]) + return result + + def unlink(self, cursor, user, ids, context=None): + if not context: + context = {} + for trans_obj in self.read(cursor, user, ids, ['name','type','res_id'], context=context): + self._get_source.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], lang=context.get('lang','en_US')) + self._get_ids.clear_cache(cursor.dbname, user, trans_obj['name'], trans_obj['type'], context.get('lang','en_US'), [trans_obj['res_id']]) + result = super(ir_translation, self).unlink(cursor, user, ids, context=context) + return result ir_translation() From a5488afe63cb97ab590286d4e39851567356056d Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Fri, 4 Sep 2009 11:03:10 +0530 Subject: [PATCH 3/6] [IMP]quality_integration_server: put max_limit in server connection bzr revid: hmo@tinyerp.com-20090904053310-djdif3t0fvehsh9e --- .../base_quality_interrogation.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index 2df0af247c7..620edd7dade 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -34,6 +34,8 @@ import socket admin_passwd = 'admin' waittime = 10 +wait_count = 0 +wait_limit = 12 def start_server(root_path, port, addons_path): if root_path: @@ -47,19 +49,27 @@ def clean(): ps.close() if pid: os.kill(pid,9) - + def execute(connector, method, *args): + global wait_count res = False try: res = getattr(connector,method)(*args) except socket.error,e: - if e.args[0] == 111: + if e.args[0] == 111: + if wait_count > wait_limit: + print "Server is taking too long to start, it has exceeded the maximum limit of %d seconds."%(wait_limit) + clean() + sys.exit(1) print 'Please wait %d sec to start server....'%(waittime) + wait_count += 1 time.sleep(waittime) res = execute(connector, method, *args) else: raise e - return res + wait_count = 0 + return res + def login(uri, dbname, user, pwd): conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/common') @@ -110,12 +120,13 @@ def check_quality(uri, user, pwd, dbname, modules): html += "" for x,y,detail in quality_result['check_detail_ids']: if detail.get('detail') != '': - test = detail.get('name') + msg = detail.get('message') + test = detail.get('name') score = round(float(detail.get('score',0)),2) html += "
  • %s (%.2f)
  • "%(test,test,score) detail_html +="

    %s (Score : %s)

    %s
    "%(test,test,score,detail.get('detail')) detail_html +='''Go to Top''' - test_detail[test] = (score,detail.get('detail','')) + test_detail[test] = (score,msg,detail.get('detail','')) html += "
    %s"%(detail_html) final[quality_result['name']] = (quality_result['final_score'],html,test_detail) From b3d0c54ef7ccbde4b0501b3a5ef3e8ddec08567a Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Mon, 7 Sep 2009 14:06:32 +0530 Subject: [PATCH 4/6] [IMP]quality_integration_server : quality html log bzr revid: hmo@tinyerp.com-20090907083632-z6pte2jqhrayjj23 --- .../base_quality_interrogation.py | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index 620edd7dade..48c2ef29278 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -117,17 +117,16 @@ def check_quality(uri, user, pwd, dbname, modules): html = '''''' html +="

    Module : %s

    "%(quality_result['name']) html += "

    Final score : %s

    "%(quality_result['final_score']) - html += "" - for x,y,detail in quality_result['check_detail_ids']: - if detail.get('detail') != '': - msg = detail.get('message') - test = detail.get('name') - score = round(float(detail.get('score',0)),2) - html += "
  • %s (%.2f)
  • "%(test,test,score) - detail_html +="

    %s (Score : %s)

    %s
    "%(test,test,score,detail.get('detail')) - detail_html +='''Go to Top''' - test_detail[test] = (score,msg,detail.get('detail','')) - html += "
    %s"%(detail_html) + html += "
    " + html += "
      " + for x,y,detail in quality_result['check_detail_ids']: + test = detail.get('name') + score = round(float(detail.get('score',0)),2) + html += "
    • %s
    • "%(test.replace(' ','-'),test) + detail_html +="

      %s (Score : %s)

      %s
      "%(test.replace(' ','-'),test,score,detail.get('detail')) + test_detail[test] = (score,detail.get('detail','')) + html += "
    %s"%(detail_html) + html += "
    " final[quality_result['name']] = (quality_result['final_score'],html,test_detail) fp = open('quality_log.pck','wb') @@ -138,7 +137,7 @@ def check_quality(uri, user, pwd, dbname, modules): else: print 'Login Failed...' clean() - sys.exit(1) + sys.exit(1) From dc8dd85fe1d7b89c56c04f3e9b97d88496343d1d Mon Sep 17 00:00:00 2001 From: "Christophe Chauvet(Syleam)" <> Date: Mon, 7 Sep 2009 15:59:47 +0530 Subject: [PATCH 5/6] [FIX] Export : Error solved while Exporting O2M records with None value of any field lp bug: https://launchpad.net/bugs/425430 fixed bzr revid: jvo@tinyerp.com-20090907102947-ne1p4q3mi1qz6gq7 --- bin/osv/orm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 9838c6ba400..08086f5d49b 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -497,7 +497,7 @@ class orm_template(object): for rr in r : if isinstance(rr.name, browse_record): rr = rr.name - dt+=rr.name+',' + dt += rr.name or '' + ',' data[fpos] = dt[:-1] break lines += lines2[1:] From 776779e908176d65fe14695beb3bbc22bca17c21 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 9 Sep 2009 11:17:02 +0530 Subject: [PATCH 6/6] [FIX] Report: context was missing while printing any report with header in a non-English Language bzr revid: jvo@tinyerp.com-20090909054702-2ea1ugshop9cdmr1 --- bin/report/report_sxw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index 539b8990485..1adca0b8176 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -156,7 +156,7 @@ class rml_parse(object): self.cr = cr self.uid = uid self.pool = pooler.get_pool(cr.dbname) - user = self.pool.get('res.users').browse(cr, uid, uid) + user = self.pool.get('res.users').browse(cr, uid, uid, context=context) self.localcontext = { 'user': user, 'company': user.company_id,