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() diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index 2df0af247c7..48c2ef29278 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') @@ -107,16 +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') != '': - 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','')) - html += "
    %s"%(detail_html) + html += "
    " + html += "%s"%(detail_html) + html += "
    " final[quality_result['name']] = (quality_result['final_score'],html,test_detail) fp = open('quality_log.pck','wb') @@ -127,7 +137,7 @@ def check_quality(uri, user, pwd, dbname, modules): else: print 'Login Failed...' clean() - sys.exit(1) + sys.exit(1) diff --git a/bin/netsvc.py b/bin/netsvc.py index aadded32d7a..56d0eb2918a 100644 --- a/bin/netsvc.py +++ b/bin/netsvc.py @@ -173,7 +173,7 @@ class Logger(object): msg = tools.ustr(msg).strip() if level in (LOG_ERROR,LOG_CRITICAL): - msg = common().get_server_environment() + msg + msg = common().get_server_environment() + '\n' + msg result = msg.split('\n') if len(result)>1: 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:] 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, 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 )