From f2087d57f3ca135493aeb89f180b939b2a607f29 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Wed, 23 Sep 2009 14:42:19 +0530 Subject: [PATCH 001/200] [IMP]quality_integration_server: quality log : add new option to specify qualitylog path to store html pages of log bzr revid: hmo@tinyerp.com-20090923091219-owu6zi4jio20xt1f --- .../base_quality_interrogation.py | 31 ++++++++++++------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index f4e84f5194a..3f3010350f3 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -101,8 +101,9 @@ def import_translate(uri, user, pwd, dbname, translate_in): state = res['state'] -def check_quality(uri, user, pwd, dbname, modules): +def check_quality(uri, user, pwd, dbname, modules, quality_logs): uid = login(uri, dbname, user, pwd) + quality_logs += 'quality-logs' if uid: conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/object') final = {} @@ -111,7 +112,7 @@ def check_quality(uri, user, pwd, dbname, modules): test_detail = {} quality_result = execute(conn,'execute', dbname, uid, pwd,'module.quality.check','check_quality',module) detail_html = '' - html = '''''' + html = '''''' html +="

Module : %s

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

Final score : %s

"%(quality_result['final_score']) html += "
" @@ -126,15 +127,21 @@ def check_quality(uri, user, pwd, dbname, modules): detail['detail'] = '''%s'''%(detail.get('summary','')) detail_html +="

%s (Score : %s)

%s
"%(test.replace(' ','-'),test,score,detail.get('detail','')) test_detail[test] = (score,msg,detail.get('detail','')) - html += "%s"%(detail_html) - html += "
" - final[quality_result['name']] = (quality_result['final_score'],html,test_detail) + html += "" + html += "%s"%(detail_html) + html += "" + if not os.path.isdir(quality_logs): + os.mkdir(quality_logs) + fp = open('%s/%s.html'%(quality_logs,module),'wb') + fp.write(str(html)) + fp.close() + #final[quality_result['name']] = (quality_result['final_score'],html,test_detail) - fp = open('quality_log.pck','wb') - pck_obj = pickle.dump(final,fp) - fp.close() - print "LOG PATH%s"%(os.path.realpath('quality_log.pck')) - return final + #fp = open('quality_log.pck','wb') + #pck_obj = pickle.dump(final,fp) + #fp.close() + #print "LOG PATH%s"%(os.path.realpath('quality_log.pck')) + return True else: print 'Login Failed...' clean() @@ -273,6 +280,7 @@ parser = optparse.OptionParser(usage) parser.add_option("--modules", dest="modules", help="specify modules to install or check quality") parser.add_option("--addons-path", dest="addons_path", help="specify the addons path") +parser.add_option("--quality-logs", dest="quality_logs", help="specify the path of quality logs files which has to stores") parser.add_option("--root-path", dest="root_path", help="specify the root path") parser.add_option("-p", "--port", dest="port", help="specify the TCP port", type="int") parser.add_option("-d", "--database", dest="db_name", help="specify the database name") @@ -303,6 +311,7 @@ die(opt.translate_in and (not opt.db_name), options = { 'addons-path' : opt.addons_path or 'addons', + 'quality-logs' : opt.quality_logs or '', 'root-path' : opt.root_path or '', 'translate-in': [], 'port' : opt.port or 8069, @@ -337,7 +346,7 @@ try: if command == 'upgrade-module': upgrade_module(uri, options['database'], options['modules'], options['login'], options['pwd']) if command == 'check-quality': - check_quality(uri, options['login'], options['pwd'], options['database'], options['modules']) + check_quality(uri, options['login'], options['pwd'], options['database'], options['modules'], options['quality-logs']) if command == 'install-translation': import_translate(uri, options['login'], options['pwd'], options['database'], options['translate-in']) clean() From 244de09ee563f0e72fa6330c71f316415bb690ad Mon Sep 17 00:00:00 2001 From: "uco(OpenERP)" <> Date: Thu, 24 Sep 2009 19:52:27 +0530 Subject: [PATCH 002/200] [FIX] Update Module : Float8 to float and numeric to float casting made possible lp bug: https://launchpad.net/bugs/433886 fixed bzr revid: jvo@tinyerp.com-20090924142227-qbx2y0a56r6d263n --- bin/osv/orm.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index cf215adf12e..812c5de3791 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1786,6 +1786,8 @@ class orm(orm_template): ('varchar', 'text', 'TEXT', ''), ('int4', 'float', get_pg_type(f)[1], '::'+get_pg_type(f)[1]), ('date', 'datetime', 'TIMESTAMP', '::TIMESTAMP'), + ('numeric', 'float', get_pg_type(f)[1], '::'+get_pg_type(f)[1]), + ('float8', 'float', get_pg_type(f)[1], '::'+get_pg_type(f)[1]), ] # !!! Avoid reduction of varchar field !!! if f_pg_type == 'varchar' and f._type == 'char' and f_pg_size < f.size: @@ -1798,13 +1800,15 @@ class orm(orm_template): cr.commit() for c in casts: if (f_pg_type==c[0]) and (f._type==c[1]): - logger.notifyChannel('orm', netsvc.LOG_INFO, "column '%s' in table '%s' changed type to %s." % (k, self._table, c[1])) - ok = True - cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_size' % (self._table, k)) - cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (self._table, k, c[2])) - cr.execute(('UPDATE "%s" SET "%s"=temp_change_size'+c[3]) % (self._table, k)) - cr.execute('ALTER TABLE "%s" DROP COLUMN temp_change_size CASCADE' % (self._table,)) - cr.commit() + if f_pg_type != f_obj_type: + logger.notifyChannel('orm', netsvc.LOG_INFO, "column '%s' in table '%s' changed type to %s." % (k, self._table, c[1])) + ok = True + cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO temp_change_size' % (self._table, k)) + cr.execute('ALTER TABLE "%s" ADD COLUMN "%s" %s' % (self._table, k, c[2])) + cr.execute(('UPDATE "%s" SET "%s"=temp_change_size'+c[3]) % (self._table, k)) + cr.execute('ALTER TABLE "%s" DROP COLUMN temp_change_size CASCADE' % (self._table,)) + cr.commit() + break if f_pg_type != f_obj_type: if not ok: From 369755e92a0f235901f13d114171839b2a379100 Mon Sep 17 00:00:00 2001 From: nch-openerp <> Date: Fri, 25 Sep 2009 13:10:13 +0530 Subject: [PATCH 003/200] [FIX]quality_integration_server: ascci encoding problem in quality html log bzr revid: hmo@tinyerp.com-20090925074013-dsnxc54vo7t7payg --- .../base_quality_interrogation.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index 3f3010350f3..aae89368a8f 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -37,6 +37,18 @@ waittime = 10 wait_count = 0 wait_limit = 12 +def to_decode(s): + try: + return s.encode('utf-8') + except UnicodeError: + try: + return s.encode('latin') + except UnicodeError: + try: + return s.decode('ascii') + except UnicodeError: + return s + def start_server(root_path, port, addons_path): os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --port=%s --no-netrpc --addons-path=%s' %(root_path, str(port), addons_path)) def clean(): @@ -133,7 +145,7 @@ def check_quality(uri, user, pwd, dbname, modules, quality_logs): if not os.path.isdir(quality_logs): os.mkdir(quality_logs) fp = open('%s/%s.html'%(quality_logs,module),'wb') - fp.write(str(html)) + fp.write(to_decode(html)) fp.close() #final[quality_result['name']] = (quality_result['final_score'],html,test_detail) From a5d33505a8864949d73ad8200be86d5b291a4033 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Tue, 29 Sep 2009 18:09:23 +0530 Subject: [PATCH 004/200] [FIX] Export Translation : Warning on Non-existing record instead of breaking flow lp bug: https://launchpad.net/bugs/437729 fixed bzr revid: jvo@tinyerp.com-20090929123923-yw60232e0sgu5nbp --- bin/tools/translate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/tools/translate.py b/bin/tools/translate.py index 51966b992bc..62f48aaa3c6 100644 --- a/bin/tools/translate.py +++ b/bin/tools/translate.py @@ -424,14 +424,14 @@ def trans_generate(lang, modules, dbname=None): xml_name = "%s.%s" % (module, encode(xml_name)) if not pool.get(model): - logger.notifyChannel("db", netsvc.LOG_ERROR, "unable to find object %r" % (model,)) + logger.notifyChannel("db", netsvc.LOG_ERROR, "Unable to find object %r" % (model,)) continue - try: - obj = pool.get(model).browse(cr, uid, res_id) - except BrowseRecordError: - logger.notifyChannel("db", netsvc.LOG_ERROR, "unable to find object %r with id %d" % (model, res_id)) + exists = pool.get(model).exists(cr, uid, res_id) + if not exists: + logger.notifyChannel("db", netsvc.LOG_WARNING, "Unable to find object %r with id %d" % (model, res_id)) continue + obj = pool.get(model).browse(cr, uid, res_id) if model=='ir.ui.view': d = xml.dom.minidom.parseString(encode(obj.arch)) From 92df67814c628cb475ebd5fd4921c4bed570f31b Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Wed, 30 Sep 2009 12:24:19 +0530 Subject: [PATCH 005/200] [IMP] base_quality_interrrogation: put message if the score of quality less then minimal and remove unit test condition bzr revid: mra@tinyerp.com-20090930065419-23hlpso95d35z810 --- .../base_quality_interrogation.py | 165 +++++++++--------- 1 file changed, 81 insertions(+), 84 deletions(-) diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index aae89368a8f..ca9bbddc593 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -49,24 +49,24 @@ def to_decode(s): except UnicodeError: return s -def start_server(root_path, port, addons_path): - os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --port=%s --no-netrpc --addons-path=%s' %(root_path, str(port), addons_path)) +def start_server(root_path, port, addons_path): + os.system('python2.5 %sopenerp-server.py --pidfile=openerp.pid --port=%s --no-netrpc --addons-path=%s' %(root_path, str(port), addons_path)) def clean(): if os.path.isfile('openerp.pid'): - ps = open('openerp.pid') + ps = open('openerp.pid') if ps: pid = int(ps.read()) - ps.close() - if pid: + ps.close() + if pid: os.kill(pid,9) def execute(connector, method, *args): - global wait_count + global wait_count res = False - try: + try: res = getattr(connector,method)(*args) - except socket.error,e: - if e.args[0] == 111: + except socket.error,e: + 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() @@ -78,23 +78,23 @@ def execute(connector, method, *args): else: raise e wait_count = 0 - return res + return res def login(uri, dbname, user, pwd): conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/common') - uid = execute(conn,'login',dbname, user, pwd) + uid = execute(conn,'login',dbname, user, pwd) return uid -def import_translate(uri, user, pwd, dbname, translate_in): - uid = login(uri, dbname, user, pwd) - if uid: +def import_translate(uri, user, pwd, dbname, translate_in): + uid = login(uri, dbname, user, pwd) + if uid: conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/wizard') wiz_id = execute(conn,'create',dbname, uid, pwd, 'module.lang.import') for trans_in in translate_in: - lang,ext = os.path.splitext(trans_in.split('/')[-1]) - state = 'init' + lang,ext = os.path.splitext(trans_in.split('/')[-1]) + state = 'init' datas = {'form':{}} - while state!='end': + while state!='end': res = execute(conn,'execute',dbname, uid, pwd, wiz_id, datas, state, {}) if 'datas' in res: datas['form'].update( res['datas'].get('form',{}) ) @@ -110,34 +110,31 @@ def import_translate(uri, user, pwd, dbname, translate_in): }) trans_obj.close() elif res['type']=='action': - state = res['state'] - - -def check_quality(uri, user, pwd, dbname, modules, quality_logs): + state = res['state'] + + +def check_quality(uri, user, pwd, dbname, modules, quality_logs): uid = login(uri, dbname, user, pwd) quality_logs += 'quality-logs' if uid: conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/object') - final = {} - for module in modules: + final = {} + for module in modules: qualityresult = {} - test_detail = {} + test_detail = {} quality_result = execute(conn,'execute', dbname, uid, pwd,'module.quality.check','check_quality',module) detail_html = '' html = '''''' - html +="

Module : %s

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

Final score : %s

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

Module: %s

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

Final score: %s

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

    %s (Score : %s)

    %s
    "%(test.replace(' ','-'),test,score,detail.get('detail','')) + detail_html +='''

    %s (Score : %s)

    %s
    %s
    '''%(test.replace(' ', '-'), test, score, msg, detail.get('detail', '')) test_detail[test] = (score,msg,detail.get('detail','')) html += "
" html += "%s"%(detail_html) @@ -155,9 +152,9 @@ def check_quality(uri, user, pwd, dbname, modules, quality_logs): #print "LOG PATH%s"%(os.path.realpath('quality_log.pck')) return True else: - print 'Login Failed...' + print 'Login Failed...' clean() - sys.exit(1) + sys.exit(1) @@ -176,25 +173,25 @@ def create_db(uri, dbname, user='admin', pwd='admin', lang='en_US'): login_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/common') db_list = execute(conn, 'list') if dbname not in db_list: - id = execute(conn,'create',admin_passwd, dbname, True, lang) + id = execute(conn,'create',admin_passwd, dbname, True, lang) wait(id,uri) - uid = login_conn.login(dbname, user, pwd) + uid = login_conn.login(dbname, user, pwd) wiz_id = execute(wiz_conn,'create', dbname, uid, user, 'base_setup.base_setup') state = 'init' datas = {'form':{}} - while state!='config': + while state!='config': res = execute(wiz_conn, 'execute', dbname, uid, pwd, wiz_id, datas, state, {}) if state=='init': datas['form'].update( res['datas'] ) if res['type']=='form': - for field in res['fields'].keys(): + for field in res['fields'].keys(): datas['form'][field] = datas['form'].get(field,False) state = res['state'][-1][0] datas['form'].update({ - 'profile': -1 + 'profile': -1 }) elif res['type']=='state': state = res['state'] @@ -206,71 +203,71 @@ def drop_db(uri, dbname): conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/db') db_list = execute(conn,'list') if dbname in db_list: - execute(conn, 'drop', admin_passwd, dbname) + execute(conn, 'drop', admin_passwd, dbname) return True - + def make_links(uri, uid, dbname, source, destination, module, user, pwd): if module in ('base','quality_integration_server'): - return True - if not os.path.islink(destination + '/' + module): - if not os.path.isdir(destination + '/' + module): + return True + if not os.path.islink(destination + '/' + module): + if not os.path.isdir(destination + '/' + module): for path in source: if os.path.isdir(path + '/' + module): os.symlink(path + '/' + module, destination + '/' + module) obj_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/object') execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'update_list') module_ids = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'search', [('name','=',module)]) - if len(module_ids): + if len(module_ids): data = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'read', module_ids[0],['name','dependencies_id']) dep_datas = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module.dependency', 'read', data['dependencies_id'],['name']) - for dep_data in dep_datas: + for dep_data in dep_datas: make_links(uri, uid, dbname, source, destination, dep_data['name'], user, pwd) - return True - return False + return True + return False def install_module(uri, dbname, modules, addons='', extra_addons='', user='admin', pwd='admin'): uid = login(uri, dbname, user, pwd) if extra_addons: extra_addons = extra_addons.split(',') - if uid: + if uid: if addons and extra_addons: - for module in modules: - make_links(uri, uid, dbname, extra_addons, addons, module, user, pwd) + for module in modules: + make_links(uri, uid, dbname, extra_addons, addons, module, user, pwd) obj_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/object') wizard_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/wizard') module_ids = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'search', [('name','in',modules)]) - execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'button_install', module_ids) + execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'button_install', module_ids) wiz_id = execute(wizard_conn, 'create', dbname, uid, pwd, 'module.upgrade.simple') state = 'init' datas = {} #while state!='menu': - while state!='end': - res = execute(wizard_conn, 'execute', dbname, uid, pwd, wiz_id, datas, state, {}) + while state!='end': + res = execute(wizard_conn, 'execute', dbname, uid, pwd, wiz_id, datas, state, {}) if state == 'init': state = 'start' elif state == 'start': - state = 'end' + state = 'end' return True def upgrade_module(uri, dbname, modules, user='admin', pwd='admin'): uid = login(uri, dbname, user, pwd) - if uid: + if uid: obj_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/object') - wizard_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/wizard') - module_ids = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'search', [('name','in',modules)]) - execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'button_upgrade', module_ids) + wizard_conn = xmlrpclib.ServerProxy(uri + '/xmlrpc/wizard') + module_ids = execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'search', [('name','in',modules)]) + execute(obj_conn, 'execute', dbname, uid, pwd, 'ir.module.module', 'button_upgrade', module_ids) wiz_id = execute(wizard_conn, 'create', dbname, uid, pwd, 'module.upgrade.simple') state = 'init' datas = {} #while state!='menu': - while state!='end': - res = execute(wizard_conn, 'execute', dbname, uid, pwd, wiz_id, datas, state, {}) + while state!='end': + res = execute(wizard_conn, 'execute', dbname, uid, pwd, wiz_id, datas, state, {}) if state == 'init': state = 'start' elif state == 'start': - state = 'end' - + state = 'end' + return True @@ -283,21 +280,21 @@ Basic Commands: start-server Start Server create-db Create new database drop-db Drop database - install-module Install module + install-module Install module upgrade-module Upgrade module install-translation Install translation file check-quality Calculate quality and dump quality result into quality_log.pck using pickle """ -parser = optparse.OptionParser(usage) +parser = optparse.OptionParser(usage) parser.add_option("--modules", dest="modules", help="specify modules to install or check quality") parser.add_option("--addons-path", dest="addons_path", help="specify the addons path") parser.add_option("--quality-logs", dest="quality_logs", help="specify the path of quality logs files which has to stores") parser.add_option("--root-path", dest="root_path", help="specify the root path") parser.add_option("-p", "--port", dest="port", help="specify the TCP port", type="int") -parser.add_option("-d", "--database", dest="db_name", help="specify the database name") -parser.add_option("--login", dest="login", help="specify the User Login") -parser.add_option("--password", dest="pwd", help="specify the User Password") +parser.add_option("-d", "--database", dest="db_name", help="specify the database name") +parser.add_option("--login", dest="login", help="specify the User Login") +parser.add_option("--password", dest="pwd", help="specify the User Password") parser.add_option("--translate-in", dest="translate_in", help="specify .po files to import translation terms") parser.add_option("--extra-addons", dest="extra_addons", @@ -308,7 +305,7 @@ if len(args) != 1: parser.error("incorrect number of arguments") command = args[0] if command not in ('start-server','create-db','drop-db','install-module','upgrade-module','check-quality','install-translation'): - parser.error("incorrect command") + parser.error("incorrect command") def die(cond, msg): if cond: @@ -326,7 +323,7 @@ options = { 'quality-logs' : opt.quality_logs or '', 'root-path' : opt.root_path or '', 'translate-in': [], - 'port' : opt.port or 8069, + 'port' : opt.port or 8069, 'database': opt.db_name or 'terp', 'modules' : opt.modules or [], 'login' : opt.login or 'admin', @@ -337,33 +334,33 @@ options = { options['modules'] = opt.modules and map(lambda m: m.strip(), opt.modules.split(',')) or [] # Hint:i18n-import=purchase:ar_AR.po+sale:fr_FR.po,nl_BE.po if opt.translate_in: - translate = opt.translate_in - for module_name,po_files in map(lambda x:tuple(x.split(':')),translate.split('+')): - for po_file in po_files.split(','): + translate = opt.translate_in + for module_name,po_files in map(lambda x:tuple(x.split(':')),translate.split('+')): + for po_file in po_files.split(','): po_link = '%s/%s/i18n/%s'%(options['addons-path'], module_name, po_file) - options['translate-in'].append(po_link) - + options['translate-in'].append(po_link) + uri = 'http://localhost:' + str(options['port']) server_thread = threading.Thread(target=start_server, args=(options['root-path'], options['port'], options['addons-path'])) -try: - server_thread.start() - if command == 'create-db': +try: + server_thread.start() + if command == 'create-db': create_db(uri, options['database'], options['login'], options['pwd']) - if command == 'drop-db': + if command == 'drop-db': drop_db(uri, options['database']) - if command == 'install-module': + if command == 'install-module': install_module(uri, options['database'], options['modules'],options['addons-path'],options['extra-addons'],options['login'], options['pwd']) - if command == 'upgrade-module': + if command == 'upgrade-module': upgrade_module(uri, options['database'], options['modules'], options['login'], options['pwd']) if command == 'check-quality': check_quality(uri, options['login'], options['pwd'], options['database'], options['modules'], options['quality-logs']) - if command == 'install-translation': + if command == 'install-translation': import_translate(uri, options['login'], options['pwd'], options['database'], options['translate-in']) clean() sys.exit(0) - + except xmlrpclib.Fault, e: print e.faultString clean() @@ -372,7 +369,7 @@ except Exception, e: print e clean() sys.exit(1) - + From 22bb413066964ad4a1aafe66da52e8e3a3451e15 Mon Sep 17 00:00:00 2001 From: "uco(Open ERP)" <> Date: Thu, 1 Oct 2009 16:36:41 +0530 Subject: [PATCH 006/200] [FIX] Allowing sql keywords as fields(don't use them in order by clause) lp bug: https://launchpad.net/bugs/430728 fixed bzr revid: jvo@tinyerp.com-20091001110641-jks9s9pntnmewvgm --- bin/osv/orm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 812c5de3791..f46788bcf88 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1773,7 +1773,7 @@ class orm(orm_template): f_pg_notnull = f_pg_def['attnotnull'] if isinstance(f, fields.function) and not f.store: logger.notifyChannel('orm', netsvc.LOG_INFO, 'column %s (%s) in table %s removed: converted to a function !\n' % (k, f.string, self._table)) - cr.execute('ALTER TABLE %s DROP COLUMN %s'% (self._table, k)) + cr.execute('ALTER TABLE "%s" DROP COLUMN "%s"'% (self._table, k)) cr.commit() f_obj_type = None else: @@ -1821,7 +1821,7 @@ class orm(orm_template): default = self._defaults[k](self, cr, 1, {}) if (default is not None): ss = self._columns[k]._symbol_set - query = 'UPDATE "%s" SET "%s"=%s WHERE %s is NULL' % (self._table, k, ss[0], k) + query = 'UPDATE "%s" SET "%s"=%s WHERE "%s" is NULL' % (self._table, k, ss[0], k) cr.execute(query, (ss[1](default),)) # add the NOT NULL constraint cr.commit() From 1b607549a7281cba356e71492737284ff9da15bb Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 2 Oct 2009 18:00:07 +0200 Subject: [PATCH 007/200] [IMP] cron: check the arguments to avoid security issues [IMP] cron: failed jobs are logged [IMP] cron: clean code lp bug: https://launchpad.net/bugs/433395 fixed bzr revid: christophe@tinyerp.com-20091002160007-mw7a55oy0l6bp5xd --- bin/addons/base/ir/ir_cron.py | 69 +++++++++++++++++++++-------------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/bin/addons/base/ir/ir_cron.py b/bin/addons/base/ir/ir_cron.py index 166a5781d44..0ef23a6c423 100644 --- a/bin/addons/base/ir/ir_cron.py +++ b/bin/addons/base/ir/ir_cron.py @@ -27,6 +27,9 @@ import tools import pooler from osv import fields,osv +def str2tuple(s): + return eval('tuple(%s)' % s) + _intervalTypes = { 'work_days': lambda interval: DateTime.RelativeDateTime(days=interval), 'days': lambda interval: DateTime.RelativeDateTime(days=interval), @@ -65,25 +68,39 @@ class ir_cron(osv.osv, netsvc.Agent): 'doall' : lambda *a: 1 } + def _check_args(self, cr, uid, ids, context=None): + try: + for this in self.browse(cr, uid, ids, context): + str2tuple(this.args) + except: + return False + return True + + _constraints= [ + (_check_args, 'Invalid arguments', ['args']), + ] + def _callback(self, cr, uid, model, func, args): - args = (args or []) and eval(args) - m=self.pool.get(model) + args = str2tuple(args) + m = self.pool.get(model) if m and hasattr(m, func): f = getattr(m, func) - f(cr, uid, *args) + try: + f(cr, uid, *args) + except Exception, e: + self._logger.notifyChannel('timers', netsvc.LOG_ERROR, "Job call of self.pool.get('%s').%s(cr, uid, *%r) failed" % (model, func, args)) + self._logger.notifyChannel('timers', netsvc.LOG_ERROR, tools.exception_to_unicode(e)) + def _poolJobs(self, db_name, check=False): try: db, pool = pooler.get_db_and_pool(db_name) except: return False - if pool._init: - # retry in a few minutes - next_call = 600 - else: - now = DateTime.now() - try: - cr = db.cursor() + try: + cr = db.cursor() + if not pool._init: + now = DateTime.now() cr.execute('select * from ir_cron where numbercall<>0 and active and nextcall<=now() order by priority') for job in cr.dictfetchall(): nextcall = DateTime.strptime(job['nextcall'], '%Y-%m-%d %H:%M:%S') @@ -103,24 +120,22 @@ class ir_cron(osv.osv, netsvc.Agent): addsql = ', active=False' cr.execute("update ir_cron set nextcall=%s, numbercall=%s"+addsql+" where id=%s", (nextcall.strftime('%Y-%m-%d %H:%M:%S'), numbercall, job['id'])) cr.commit() - finally: - cr.commit() - cr.close() - # - # Can be improved to do at the min(min(nextcalls), time()+next_call) - # But is this an improvement ? - # - cr = db.cursor() - cr.execute('select min(nextcall) as min_next_call from ir_cron where numbercall<>0 and active and nextcall>=now()') - next_call = cr.dictfetchone()['min_next_call'] - cr.close() - if next_call: - next_call = time.mktime(time.strptime(next_call, '%Y-%m-%d %H:%M:%S')) - else: - next_call = int(time.time()) + 3600 # if do not find active cron job from database, it will run again after 1 day - if not check: - self.setAlarm(self._poolJobs, next_call, db_name, db_name) + + cr.execute('select min(nextcall) as min_next_call from ir_cron where numbercall<>0 and active and nextcall>=now()') + next_call = cr.dictfetchone()['min_next_call'] + if next_call: + next_call = time.mktime(time.strptime(next_call, '%Y-%m-%d %H:%M:%S')) + else: + next_call = int(time.time()) + 3600 # if do not find active cron job from database, it will run again after 1 day + + if not check: + self.setAlarm(self._poolJobs, next_call, db_name, db_name) + + finally: + cr.commit() + cr.close() + def create(self, cr, uid, vals, context=None): res = super(ir_cron, self).create(cr, uid, vals, context=context) From f822efa07454eb09f52216d1408f3b55739de85b Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Sat, 3 Oct 2009 15:18:58 +0530 Subject: [PATCH 008/200] [FIX] Name_search() is having now record limit to be 80 instead of None lp bug: https://launchpad.net/bugs/430133 fixed bzr revid: jvo@tinyerp.com-20091003094858-njohqhj91rc6is6n --- bin/osv/orm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index f46788bcf88..e4f36a041bd 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1332,7 +1332,7 @@ class orm_template(object): def name_get(self, cr, user, ids, context=None): raise _('The name_get method is not implemented on this object !') - def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=None): + def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80): raise _('The name_search method is not implemented on this object !') def copy(self, cr, uid, id, default=None, context=None): @@ -2880,7 +2880,7 @@ class orm(orm_template): return [(r['id'], tools.ustr(r[self._rec_name])) for r in self.read(cr, user, ids, [self._rec_name], context, load='_classic_write')] - def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=None): + def name_search(self, cr, user, name='', args=None, operator='ilike', context=None, limit=80): if not args: args = [] if not context: From f590b743189f5d20068905a3dfd5581f11ac2006 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 5 Oct 2009 17:40:29 +0530 Subject: [PATCH 009/200] [FIX] Import : Context of the action/screen passed,taken into consideration while importing bzr revid: jvo@tinyerp.com-20091005121029-6sy1k3uvkpi2i8of --- bin/addons/base/ir/ir_model.py | 25 +++++++++++++------------ bin/osv/orm.py | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 2fe3375d0a0..d69688bf6fc 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -445,10 +445,11 @@ class ir_model_data(osv.osv): id = False return id - def _update(self,cr, uid, model, module, values, xml_id=False, store=True, noupdate=False, mode='init', res_id=False): + def _update(self,cr, uid, model, module, values, xml_id=False, store=True, noupdate=False, mode='init', res_id=False, context=None): warning = True model_obj = self.pool.get(model) - context = {} + if not context: + context = {} if xml_id and ('.' in xml_id): assert len(xml_id.split('.'))==2, _('"%s" contains too many dots. XML ids should not contain dots ! These are used to refer to other modules data, as in module.reference_id') % (xml_id) warning = False @@ -471,12 +472,12 @@ class ir_model_data(osv.osv): res_id,action_id = res_id2,action_id2 if action_id and res_id: - model_obj.write(cr, uid, [res_id], values) + model_obj.write(cr, uid, [res_id], values, context=context) self.write(cr, uid, [action_id], { 'date_update': time.strftime('%Y-%m-%d %H:%M:%S'), - }) + },context=context) elif res_id: - model_obj.write(cr, uid, [res_id], values) + model_obj.write(cr, uid, [res_id], values, context=context) if xml_id: self.create(cr, uid, { 'name': xml_id, @@ -484,21 +485,21 @@ class ir_model_data(osv.osv): 'module':module, 'res_id':res_id, 'noupdate': noupdate, - }) + },context=context) if model_obj._inherits: for table in model_obj._inherits: inherit_id = model_obj.browse(cr, uid, - res_id)[model_obj._inherits[table]] + res_id,context=context)[model_obj._inherits[table]] self.create(cr, uid, { 'name': xml_id + '_' + table.replace('.', '_'), 'model': table, 'module': module, 'res_id': inherit_id, 'noupdate': noupdate, - }) + },context=context) else: if mode=='init' or (mode=='update' and xml_id): - res_id = model_obj.create(cr, uid, values) + res_id = model_obj.create(cr, uid, values, context=context) if xml_id: self.create(cr, uid, { 'name': xml_id, @@ -506,18 +507,18 @@ class ir_model_data(osv.osv): 'module': module, 'res_id': res_id, 'noupdate': noupdate - }) + },context=context) if model_obj._inherits: for table in model_obj._inherits: inherit_id = model_obj.browse(cr, uid, - res_id)[model_obj._inherits[table]] + res_id,context=context)[model_obj._inherits[table]] self.create(cr, uid, { 'name': xml_id + '_' + table.replace('.', '_'), 'model': table, 'module': module, 'res_id': inherit_id, 'noupdate': noupdate, - }) + },context=context) if xml_id: if res_id: self.loads[(module, xml_id)] = (model, res_id) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index e4f36a041bd..f9a62a02f18 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -577,6 +577,7 @@ class orm_template(object): raise Exception(_('Please check that all your lines have %d columns.') % (len(fields),)) if not line[i]: continue + field = fields[i] if (len(field)==len(prefix)+1) and field[len(prefix)].endswith(':db_id'): # Database ID @@ -811,7 +812,7 @@ class orm_template(object): try: id = ir_model_data_obj._update(cr, uid, self._name, current_module, res, xml_id=data_id, mode=mode, - noupdate=noupdate, res_id=res_id) + noupdate=noupdate, res_id=res_id, context=context) except Exception, e: import psycopg2 if isinstance(e,psycopg2.IntegrityError): From 3b60f632f14668b8b3e031111c08314335b41cb9 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 5 Oct 2009 19:46:55 +0200 Subject: [PATCH 010/200] [FIX] default context bzr revid: fp@tinyerp.com-20091005174655-cq9b2q92ww4onets --- 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 cf215adf12e..b4ceeed1342 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1535,7 +1535,7 @@ class orm_memory(orm_template): # get the default values from the context for key in context or {}: - if key.startswith('default_'): + if key.startswith('default_') and (key[8:] in fieds_list): value[key[8:]] = context[key] return value From 1996f293d8808e54084380af47cba8458fc21872 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 7 Oct 2009 17:34:53 +0530 Subject: [PATCH 011/200] [FIX] Audittrail : Assigned Access Rights to non-admin user. lp bug: https://launchpad.net/bugs/401035 fixed bzr revid: jvo@tinyerp.com-20091007120453-2zp66ob2ria9r9tc --- addons/audittrail/security/ir.model.access.csv | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/audittrail/security/ir.model.access.csv b/addons/audittrail/security/ir.model.access.csv index 90895f202c4..ac367182f26 100644 --- a/addons/audittrail/security/ir.model.access.csv +++ b/addons/audittrail/security/ir.model.access.csv @@ -2,3 +2,6 @@ "access_audittrail_rule_group_system","audittrail rule system","model_audittrail_rule","base.group_system",1,1,1,1 "access_audittrail_log_group_system","audittrail log system","model_audittrail_log","base.group_system",1,1,1,1 "access_audittrail_logline_group_system","audittrail log line system","model_audittrail_log_line","base.group_system",1,1,1,1 +"access_audittrail_rule_all_users","audittrail rule all","model_audittrail_rule","base.group_user",1,0,0,0 +"access_audittrail_log_all_users","audittrail log all","model_audittrail_log","base.group_user",1,0,1,0 +"access_audittrail_log_line_all_users","audittrail log line all","model_audittrail_log_line","base.group_user",1,0,1,0 From 3c28a101b9c353973a7516c710134405ba55baca Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 7 Oct 2009 14:38:07 +0200 Subject: [PATCH 012/200] [FIX] Use an alternative for the locale.RADIXCHAR if this one doesn't exist lp bug: https://launchpad.net/bugs/400614 fixed bzr revid: stephane@openerp.com-20091007123807-qsn2uk6jarosd7nz --- bin/report/render/rml2pdf/utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py index 59724d7d1b4..8e747f5b02a 100644 --- a/bin/report/render/rml2pdf/utils.py +++ b/bin/report/render/rml2pdf/utils.py @@ -42,6 +42,7 @@ import reportlab from lxml import etree import copy import tools +import locale _regex = re.compile('\[\[(.+?)\]\]') @@ -133,6 +134,15 @@ units = [ def unit_get(size): global units if size: + if size.find('.') == -1: + decimal_point = '.' + try: + decimal_point = locale.RADIXCHAR + except: + decimal_point = locale.localeconv()['decimal_point'] + + size = size.replace(decimal_point, '.') + for unit in units: res = unit[0].search(size, 0) if res: From 7b6f176319214ceb1070eacb56785abab14371c8 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 7 Oct 2009 20:08:23 +0530 Subject: [PATCH 013/200] [FIX] Stock-MRP : Split production wizard made individual to mrp if mrp is not installed lp bug: https://launchpad.net/bugs/383057 fixed bzr revid: jvo@tinyerp.com-20091007143823-l2hx2mjzth33hv1z --- addons/mrp/mrp_wizard.xml | 7 ++ addons/mrp/wizard/__init__.py | 1 + addons/mrp/wizard/wizard_track_line.py | 131 +++++++++++++++++++++++ addons/stock/wizard/wizard_track_line.py | 24 +++-- 4 files changed, 152 insertions(+), 11 deletions(-) create mode 100644 addons/mrp/wizard/wizard_track_line.py diff --git a/addons/mrp/mrp_wizard.xml b/addons/mrp/mrp_wizard.xml index 94d7f663e01..d88ea321ac9 100644 --- a/addons/mrp/mrp_wizard.xml +++ b/addons/mrp/mrp_wizard.xml @@ -27,6 +27,13 @@ name="product.product.procurement" keyword="client_action_multi" id="product_procurement_wizard"/> + + diff --git a/addons/mrp/wizard/__init__.py b/addons/mrp/wizard/__init__.py index 232b4f9f00b..1fcb7406959 100644 --- a/addons/mrp/wizard/__init__.py +++ b/addons/mrp/wizard/__init__.py @@ -28,6 +28,7 @@ import wizard_workcenter_load import wizard_track_prod import wizard_change_production_qty import make_procurement +import wizard_track_line # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/mrp/wizard/wizard_track_line.py b/addons/mrp/wizard/wizard_track_line.py new file mode 100644 index 00000000000..26236c55e13 --- /dev/null +++ b/addons/mrp/wizard/wizard_track_line.py @@ -0,0 +1,131 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +import wizard +import netsvc +import pooler + +import time +from osv import osv +from tools.translate import _ + +track_form = ''' +
+ + + + +''' +fields = { + 'tracking_prefix': { + 'string': 'Tracking prefix', + 'type': 'char', + 'size': 64, + }, + 'quantity': { + 'string': 'Quantity per lot', + 'type': 'float', + 'default': 1, + } +} + +def _track_lines(self, cr, uid, data, context): + move_id = data['id'] + + pool = pooler.get_pool(cr.dbname) + prodlot_obj = pool.get('stock.production.lot') + move_obj = pool.get('stock.move') + production_obj = pool.get('mrp.production') + ir_sequence_obj = pool.get('ir.sequence') + + sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial') + if not sequence: + raise wizard.except_wizard(_('Error!'), _('No production sequence defined')) + if data['form']['tracking_prefix']: + sequence=data['form']['tracking_prefix']+'/'+(sequence or '') + + move = move_obj.browse(cr, uid, [move_id])[0] + quantity=data['form']['quantity'] + if quantity <= 0 or move.product_qty == 0: + return {} + uos_qty=quantity/move.product_qty*move.product_uos_qty + + quantity_rest = move.product_qty%quantity + uos_qty_rest = quantity_rest/move.product_qty*move.product_uos_qty + + update_val = { + 'product_qty': quantity, + 'product_uos_qty': uos_qty, + } + new_move = [] + production_ids = [] + for idx in range(int(move.product_qty//quantity)): + if idx: + current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id}) + new_move.append(current_move) + else: + current_move = move.id + new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id}) + update_val['prodlot_id'] = new_prodlot + move_obj.write(cr, uid, [current_move], update_val) + production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])]) + + if quantity_rest > 0: + idx = int(move.product_qty//quantity) + update_val['product_qty']=quantity_rest + update_val['product_uos_qty']=uos_qty_rest + if idx: + current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id}) + current_move = move_obj.copy(cr, uid, move.id, {'state': move.state}) + new_move.append(current_move) + else: + current_move = move.id + new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id}) + update_val['prodlot_id'] = new_prodlot + move_obj.write(cr, uid, [current_move], update_val) + + products = production_obj.read(cr, uid, production_ids, ['move_lines']) + for p in products: + for new in new_move: + if new not in p['move_lines']: + p['move_lines'].append(new) + production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]}) + + return {} + +class wizard_track_move(wizard.interface): + states = { + 'init': { + 'actions': [], + 'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]}, + }, + 'track': { + 'actions': [_track_lines], + 'result': {'type':'state', 'state':'end'} + } + } + +wizard_track_move('mrp.stock.move.track') + + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/stock/wizard/wizard_track_line.py b/addons/stock/wizard/wizard_track_line.py index 1aeeb0ad215..79c105b962b 100644 --- a/addons/stock/wizard/wizard_track_line.py +++ b/addons/stock/wizard/wizard_track_line.py @@ -54,7 +54,7 @@ def _track_lines(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) prodlot_obj = pool.get('stock.production.lot') move_obj = pool.get('stock.move') - production_obj = pool.get('mrp.production') +# production_obj = pool.get('mrp.production') ir_sequence_obj = pool.get('ir.sequence') sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial') @@ -77,24 +77,26 @@ def _track_lines(self, cr, uid, data, context): 'product_uos_qty': uos_qty, } new_move = [] - production_ids = [] +# production_ids = [] for idx in range(int(move.product_qty//quantity)): if idx: - current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id}) +# current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id}) + current_move = move_obj.copy(cr, uid, move.id, {'state': move.state}) new_move.append(current_move) else: current_move = move.id new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id}) update_val['prodlot_id'] = new_prodlot move_obj.write(cr, uid, [current_move], update_val) - production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])]) +# production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])]) if quantity_rest > 0: idx = int(move.product_qty//quantity) update_val['product_qty']=quantity_rest update_val['product_uos_qty']=uos_qty_rest if idx: - current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id}) +# current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id}) + current_move = move_obj.copy(cr, uid, move.id, {'state': move.state}) new_move.append(current_move) else: current_move = move.id @@ -102,12 +104,12 @@ def _track_lines(self, cr, uid, data, context): update_val['prodlot_id'] = new_prodlot move_obj.write(cr, uid, [current_move], update_val) - products = production_obj.read(cr, uid, production_ids, ['move_lines']) - for p in products: - for new in new_move: - if new not in p['move_lines']: - p['move_lines'].append(new) - production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]}) +# products = production_obj.read(cr, uid, production_ids, ['move_lines']) +# for p in products: +# for new in new_move: +# if new not in p['move_lines']: +# p['move_lines'].append(new) +# production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]}) return {} From bebd7fd223a96b390558211ce92b753ab8dff955 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 8 Oct 2009 11:03:44 +0530 Subject: [PATCH 014/200] [FIX] Improved Previous bad commit for pagelayout error bzr revid: jvo@tinyerp.com-20091008053344-rkh1m6oaxw2kjlwd --- bin/report/render/rml2pdf/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py index 8e747f5b02a..07bbbbcd05e 100644 --- a/bin/report/render/rml2pdf/utils.py +++ b/bin/report/render/rml2pdf/utils.py @@ -137,7 +137,7 @@ def unit_get(size): if size.find('.') == -1: decimal_point = '.' try: - decimal_point = locale.RADIXCHAR + decimal_point = locale.nl_langinfo(locale.RADIXCHAR) except: decimal_point = locale.localeconv()['decimal_point'] From 7b7c6250cdb222963f886da6e89b6fbe95882af8 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 8 Oct 2009 11:33:06 +0530 Subject: [PATCH 015/200] [FIX] Stock: Picking report correction lp bug: https://launchpad.net/bugs/445547 fixed bzr revid: jvo@tinyerp.com-20091008060306-ppamofraaq3hlr3b --- addons/stock/report/picking.rml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/stock/report/picking.rml b/addons/stock/report/picking.rml index 8de93045b84..1540357c590 100644 --- a/addons/stock/report/picking.rml +++ b/addons/stock/report/picking.rml @@ -132,7 +132,9 @@ [[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.title) or '' ]] [[ picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.name ]] - [[ picking.address_id and picking.address_id.street or '' ]][[ picking.address_id and picking.address_id.zip or '' ]] + [[ picking.address_id and picking.address_id.street or '' ]] + [[ picking.address_id and picking.address_id.zip or '' ]] [[ picking.address_id and picking.address_id.city or '']] + @@ -190,7 +192,7 @@ Expected Shipping Date - weight + Weight From 3de195d3730638334f30e9d665f903ccad28a417 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 8 Oct 2009 11:49:24 +0530 Subject: [PATCH 016/200] [FIX] Base_vat : Spanish numbers validation corrected lp bug: https://launchpad.net/bugs/366944 fixed bzr revid: jvo@tinyerp.com-20091008061924-3malnmzjrtc44ryn --- addons/base_vat/partner.py | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/addons/base_vat/partner.py b/addons/base_vat/partner.py index ca91ab33562..e470244e5e4 100644 --- a/addons/base_vat/partner.py +++ b/addons/base_vat/partner.py @@ -378,10 +378,10 @@ class res_partner(osv.osv): 22: 'K', 23: 'E', } - - if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'): + #Legal persons with profit aim + if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'U', 'V'): try: - int(vat[1:]) + int(vat[1:8]) except: return False sum = mult_add(2, int(vat[1])) + int(vat[2]) + \ @@ -391,10 +391,11 @@ class res_partner(osv.osv): check = 10 - (sum % 10) if check == 10: check = 0 - if check != int(vat[8]): - return False +# if check != int(vat[8]): +# return False return True - elif vat[0] in ('N', 'P', 'Q', 'S'): + #Legal persons with non-profit aim + elif vat[0] in ('N', 'P', 'Q', 'R', 'S', 'W'): try: int(vat[1:8]) except: @@ -408,17 +409,26 @@ class res_partner(osv.osv): if check != vat[8]: return False return True - elif vat[0] in ('K', 'L', 'M', 'X'): + #Foreign natural persons, under age 14 or non-residents + elif vat[0] in ('K', 'L', 'M', 'X', 'Y', 'Z'): + if vat[0] == 'Y': + check_value = '1' + vat[1:8] + elif vat[0] == 'Z': + check_value = '2' + vat[1:8] + else: + check_value = vat[1:8] + try: - int(vat[1:8]) + int(check_value) except: return False - check = 1 + (int(vat[1:8]) % 23) + check = 1 + (int(check_value) % 23) check = conv[check] if check != vat[8]: return False return True + #Spanish natural persons else: try: int(vat[:8]) From 90d81da72bf57b7ed2acfb750ddc32cf27c76afb Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 8 Oct 2009 13:23:35 +0530 Subject: [PATCH 017/200] [FIX] Domain was getting failed when trying to work upon M2M,O2M field of object lp bug: https://launchpad.net/bugs/420507 fixed bzr revid: jvo@tinyerp.com-20091008075335-obo9xs9usni3ey4n --- bin/osv/expression.py | 93 +++++++++++++++++++++++++++++++++---------- 1 file changed, 71 insertions(+), 22 deletions(-) diff --git a/bin/osv/expression.py b/bin/osv/expression.py index 3c330aaaa1a..23ac071e6dd 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -44,14 +44,25 @@ class expression(object): and (((not internal) and element[1] in OPS) \ or (internal and element[1] in INTERNAL_OPS)) - def __execute_recursive_in(self, cr, s, f, w, ids): + def __execute_recursive_in(self, cr, s, f, w, ids, op, type): res = [] - for i in range(0, len(ids), cr.IN_MAX): - subids = ids[i:i+cr.IN_MAX] - cr.execute('SELECT "%s"' \ - ' FROM "%s"' \ - ' WHERE "%s" in (%s)' % (s, f, w, ','.join(['%s']*len(subids))), - subids) + if ids: + if op in ['<','>','>=','<=']: + cr.execute('SELECT "%s"' \ + ' FROM "%s"' \ + ' WHERE "%s" %s %s' % (s, f, w, op, ids[0])) + res.extend([r[0] for r in cr.fetchall()]) + else: + for i in range(0, len(ids), cr.IN_MAX): + subids = ids[i:i+cr.IN_MAX] + cr.execute('SELECT "%s"' \ + ' FROM "%s"' \ + ' WHERE "%s" in (%s)' % (s, f, w, ','.join(['%s']*len(subids))), + subids) + res.extend([r[0] for r in cr.fetchall()]) + else: + cr.execute('SELECT distinct("%s")' \ + ' FROM "%s" where "%s" is not null' % (s, f, s)), res.extend([r[0] for r in cr.fetchall()]) return res @@ -101,7 +112,6 @@ class expression(object): if self._is_operator(e) or e == self.__DUMMY_LEAF: continue left, operator, right = e - working_table = table main_table = table fargs = left.split('.', 1) @@ -154,14 +164,32 @@ class expression(object): elif field._type == 'one2many': - if isinstance(right, basestring): - ids2 = [x[0] for x in field_obj.name_search(cr, uid, right, [], operator, limit=None)] - else: - ids2 = list(right) - if not ids2: - self.__exp[i] = ('id', '=', '0') - else: - self.__exp[i] = ('id', 'in', self.__execute_recursive_in(cr, field._fields_id, field_obj._table, 'id', ids2)) + call_null = True + + if right: + if isinstance(right, basestring): + ids2 = [x[0] for x in field_obj.name_search(cr, uid, right, [], operator, limit=None)] + operator = 'in' + else: + if not isinstance(right,list): + ids2 = [right] + else: + ids2 = right + if not ids2: + call_null = True + operator = 'in' # operator changed because ids are directly related to main object + else: + call_null = False + o2m_op = 'in' + if operator in ['not like','not ilike','not in','<>','!=']: + o2m_op = 'not in' + self.__exp[i] = ('id', o2m_op, self.__execute_recursive_in(cr, field._fields_id, field_obj._table, 'id', ids2, operator, field._type)) + + if call_null: + o2m_op = 'not in' + if operator in ['not like','not ilike','not in','<>','!=']: + o2m_op = 'in' + self.__exp[i] = ('id', o2m_op, self.__execute_recursive_in(cr, field._fields_id, field_obj._table, 'id', [], operator, field._type) or [0]) elif field._type == 'many2many': #FIXME @@ -174,17 +202,38 @@ class expression(object): def _rec_convert(ids): if field_obj == table: return ids - return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids) + return self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, ids, operator, field._type) dom = _rec_get(ids2, field_obj) ids2 = field_obj.search(cr, uid, dom, context=context) self.__exp[i] = ('id', 'in', _rec_convert(ids2)) else: - if isinstance(right, basestring): - res_ids = [x[0] for x in field_obj.name_search(cr, uid, right, [], operator)] - else: - res_ids = list(right) - self.__exp[i] = ('id', 'in', self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, res_ids) or [0]) + call_null_m2m = True + if right: + if isinstance(right, basestring): + res_ids = [x[0] for x in field_obj.name_search(cr, uid, right, [], operator)] + operator = 'in' + else: + if not isinstance(right, list): + res_ids = [right] + else: + res_ids = right + if not res_ids: + call_null_m2m = True + operator = 'in' # operator changed because ids are directly related to main object + else: + call_null_m2m = False + m2m_op = 'in' + if operator in ['not like','not ilike','not in','<>','!=']: + m2m_op = 'not in' + + self.__exp[i] = ('id', m2m_op, self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, res_ids, operator, field._type) or [0]) + if call_null_m2m: + m2m_op = 'not in' + if operator in ['not like','not ilike','not in','<>','!=']: + m2m_op = 'in' + self.__exp[i] = ('id', m2m_op, self.__execute_recursive_in(cr, field._id1, field._rel, field._id2, [], operator, field._type) or [0]) + elif field._type == 'many2one': if operator == 'child_of': if isinstance(right, basestring): From bf46b6e10585084c9393c3113afac9b03453c69e Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 8 Oct 2009 14:20:16 +0530 Subject: [PATCH 018/200] [FIX] Mrp_subproduct : Wrong calculation of QTYs corrected(Product qty,UOS qty) lp bug: https://launchpad.net/bugs/445267 fixed bzr revid: jvo@tinyerp.com-20091008085016-6s9tgo0qejtpxq1q --- addons/mrp_subproduct/mrp_subproduct.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mrp_subproduct/mrp_subproduct.py b/addons/mrp_subproduct/mrp_subproduct.py index b45d3e6424a..92622845818 100644 --- a/addons/mrp_subproduct/mrp_subproduct.py +++ b/addons/mrp_subproduct/mrp_subproduct.py @@ -68,9 +68,9 @@ class mrp_production(osv.osv): qty2 = production.product_uos and production.product_uos_qty or False if sub_product.subproduct_type=='variable': if production.product_qty: - qty1 *= production.product_qty / (sub_product.product_qty or 1.0) + qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0) if production.product_uos_qty: - qty2 *= production.product_uos_qty / (sub_product.product_qty or 1.0) + qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0) data = { 'name':'PROD:'+production.name, 'date_planned': production.date_planned, From fbee346b9261dc633c438e1335656f5f7cfd43f6 Mon Sep 17 00:00:00 2001 From: "YSA(OpenERP)" <> Date: Thu, 8 Oct 2009 15:14:57 +0530 Subject: [PATCH 019/200] [FIX] Import made successful when field is O2M and it has relation under that. lp bug: https://launchpad.net/bugs/430805 fixed bzr revid: jvo@tinyerp.com-20091008094457-3ta5gkrhqspiiqyr --- bin/osv/orm.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index f9a62a02f18..8c87b1bccf1 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -579,6 +579,9 @@ class orm_template(object): continue field = fields[i] + if prefix and not prefix[0] in field: + continue + if (len(field)==len(prefix)+1) and field[len(prefix)].endswith(':db_id'): # Database ID res = False @@ -635,7 +638,7 @@ class orm_template(object): id = ir_model_data_obj._get_id(cr, uid, module, xml_id) res_id = ir_model_data_obj.read(cr, uid, [id], ['res_id'])[0]['res_id'] - row[field[0][:-3]] = res_id or False + row[field[-1][:-3]] = res_id or False continue if (len(field) == len(prefix)+1) and \ len(field[len(prefix)].split(':lang=')) == 2: @@ -671,7 +674,7 @@ class orm_template(object): try: _check_db_id(self, model_name, line[i]) data_res_id = is_db_id = int(line[i]) - except Exception,e: + except Exception,e: warning += [tools.exception_to_unicode(e)] logger.notifyChannel("import", netsvc.LOG_ERROR, tools.exception_to_unicode(e)) From 9a0d6aa9471287f7e43b567eb2de560587fc0e4d Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 8 Oct 2009 15:30:57 +0200 Subject: [PATCH 020/200] [MERGE] Backport: http://bazaar.launchpad.net/~openobject-training/+junk/server/revision/1821 [FIX] Workflow button desactivation regarding user roles bzr revid: stephane@openerp.com-20091008133057-3htx9jwebv9pprgd --- bin/osv/orm.py | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 8c87b1bccf1..7c2c6718915 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1062,19 +1062,37 @@ class orm_template(object): buttons = (n for n in node.getElementsByTagName('button') if n.getAttribute('type') != 'object') for button in buttons: - ok = True + can_click = True if user != 1: # admin user has all roles user_roles = usersobj.read(cr, user, [user], ['roles_id'])[0]['roles_id'] - cr.execute("select role_id from wkf_transition where signal=%s", (button.getAttribute('name'),)) + # TODO handle the case of more than one workflow for a model + cr.execute("""SELECT DISTINCT t.role_id + FROM wkf + INNER JOIN wkf_activity a ON a.wkf_id = wkf.id + INNER JOIN wkf_transition t ON (t.act_to = a.id) + WHERE wkf.osv = %s + AND t.signal = %s + """, (self._name, button.getAttribute('name'),)) roles = cr.fetchall() - for role in roles: - if role[0]: - ok = ok and rolesobj.check(cr, user, user_roles, role[0]) + + # draft -> valid = signal_next (role X) + # draft -> cancel = signal_cancel (no role) + # + # valid -> running = signal_next (role Y) + # valid -> cancel = signal_cancel (role Z) + # + # running -> done = signal_next (role Z) + # running -> cancel = signal_cancel (role Z) + - if not ok: - button.setAttribute('readonly', '1') - else: - button.setAttribute('readonly', '0') + # As we don't know the object state, in this scenario, + # the button "signal_cancel" will be always shown as there is no restriction to cancel in draft + # the button "signal_next" will be show if the user has any of the roles (X Y or Z) + # The verification will be made later in workflow process... + if roles: + can_click = any((not role) or rolesobj.check(cr, user, user_roles, role) for (role,) in roles) + + button.setAttribute('readonly', str(int(not can_click))) arch = node.toxml(encoding="utf-8").replace('\t', '') fields = self.fields_get(cr, user, fields_def.keys(), context) From 1052e1213dd405fb9050ac6e9e3b5e25d68b4e61 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Thu, 8 Oct 2009 15:32:35 +0200 Subject: [PATCH 021/200] [MERGE] Backport: http://bazaar.launchpad.net/~openobject-training/+junk/server/revision/1822 [IMP] Allow to specify the view via the context bzr revid: stephane@openerp.com-20091008133235-3ogpljqem67ae032 --- bin/osv/orm.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 7c2c6718915..73015dffbde 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1230,6 +1230,15 @@ class orm_template(object): model = True sql_res = False while ok: + view_ref = context.get(view_type + '_view_ref', False) + if view_ref: + if '.' in view_ref: + module, view_ref = view_ref.split('.', 1) + cr.execute("SELECT res_id FROM ir_model_data WHERE model='ir.ui.view' AND module=%s AND name=%s", (module, view_ref)) + view_ref_res = cr.fetchone() + if view_ref_res: + view_id = view_ref_res[0] + if view_id: where = (model and (" and model='%s'" % (self._name,))) or '' cr.execute('SELECT arch,name,field_parent,id,type,inherit_id FROM ir_ui_view WHERE id=%s'+where, (view_id,)) From f895d6718c6ff02fc98c455011f5af4484913ddc Mon Sep 17 00:00:00 2001 From: "Niels(Red15)" <> Date: Thu, 8 Oct 2009 19:10:36 +0530 Subject: [PATCH 022/200] [FIX] CRM : Mailgate script has host as parameter now onwards lp bug: https://launchpad.net/bugs/446205 fixed bzr revid: jvo@tinyerp.com-20091008134036-7y5iplbsauwp3f0v --- addons/crm/scripts/openerp-mailgate/openerp-mailgate.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py b/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py index 6901fde7a14..f363d6f7df6 100755 --- a/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py +++ b/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py @@ -62,8 +62,8 @@ class rpc_proxy(object): return self.rpc.execute(self.dbname, self.user_id, self.passwd, *request) class email_parser(object): - def __init__(self, uid, password, section, email, email_default, dbname): - self.rpc = rpc_proxy(uid, password, dbname=dbname) + def __init__(self, uid, password, section, email, email_default, dbname, host): + self.rpc = rpc_proxy(uid, password, host=host, dbname=dbname) try: self.section_id = int(section) except: @@ -315,9 +315,11 @@ if __name__ == '__main__': parser.add_option("-s", "--section", dest="section", help="ID or code of the case section", default="support") parser.add_option("-m", "--default", dest="default", help="Default eMail in case of any trouble.", default=None) parser.add_option("-d", "--dbname", dest="dbname", help="Database name (default: terp)", default='terp') + parser.add_option("-h", "--host", dest="host", help="Hostname of the Open ERP Server", default="localhost") + (options, args) = parser.parse_args() - parser = email_parser(options.userid, options.password, options.section, options.email, options.default, dbname=options.dbname) + parser = email_parser(options.userid, options.password, options.section, options.email, options.default, dbname=options.dbname, host=options.host) msg_txt = email.message_from_file(sys.stdin) From 829dee02d85ed51c4d2203a8cdc658e0296323e4 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 9 Oct 2009 10:51:00 +0530 Subject: [PATCH 023/200] [FIX] CRM : Mailgate script added option -he was conflicting,improved bzr revid: jvo@tinyerp.com-20091009052100-sh7y0361763v6th8 --- addons/crm/scripts/openerp-mailgate/openerp-mailgate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py b/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py index f363d6f7df6..e0bb8c2eae7 100755 --- a/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py +++ b/addons/crm/scripts/openerp-mailgate/openerp-mailgate.py @@ -315,7 +315,7 @@ if __name__ == '__main__': parser.add_option("-s", "--section", dest="section", help="ID or code of the case section", default="support") parser.add_option("-m", "--default", dest="default", help="Default eMail in case of any trouble.", default=None) parser.add_option("-d", "--dbname", dest="dbname", help="Database name (default: terp)", default='terp') - parser.add_option("-h", "--host", dest="host", help="Hostname of the Open ERP Server", default="localhost") + parser.add_option("--host", dest="host", help="Hostname of the Open ERP Server", default="localhost") (options, args) = parser.parse_args() From 811dea54b48b2830c2d001b0385b03dee4793f92 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Fri, 9 Oct 2009 13:12:53 +0530 Subject: [PATCH 024/200] [FIX]: [account_followup] wrong sender for email lp bug: https://launchpad.net/bugs/446520 fixed bzr revid: mga@tinyerp.com-20091009074253-8he22w5jhgx529e0 --- addons/account_followup/wizard/wizard_followup_print.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_followup/wizard/wizard_followup_print.py b/addons/account_followup/wizard/wizard_followup_print.py index 7729d267365..54e8f4a0eb7 100644 --- a/addons/account_followup/wizard/wizard_followup_print.py +++ b/addons/account_followup/wizard/wizard_followup_print.py @@ -162,7 +162,7 @@ class followup_all_print(wizard.interface): if (not dest) and adr.type=='default': if adr.email: dest = [adr.email] - src = tools.config.options['smtp_user'] + src = tools.config.options['email_from'] if not data['form']['partner_lang']: body = data['form']['email_body'] else: From 58a4fff0dd2af0561fe7c731e2b8d0ed631e995c Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Fri, 9 Oct 2009 14:29:36 +0530 Subject: [PATCH 025/200] [FIX] Account : Refund wuzard malfunctioned with modify invoice option lp bug: https://launchpad.net/bugs/446681 fixed bzr revid: jvo@tinyerp.com-20091009085936-dn97fmq2jpw9zhdi --- addons/account/wizard/wizard_refund.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/wizard/wizard_refund.py b/addons/account/wizard/wizard_refund.py index 39d92b58a35..2f93b0e3459 100644 --- a/addons/account/wizard/wizard_refund.py +++ b/addons/account/wizard/wizard_refund.py @@ -152,10 +152,10 @@ class wiz_refund(wizard.interface): invoice = invoice[0] del invoice['id'] invoice_lines = pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line']) - invoice_lines = pool.get('account.invoice')._refund_cleanup_lines(invoice_lines) + invoice_lines = pool.get('account.invoice')._refund_cleanup_lines(cr, uid, invoice_lines) tax_lines = pool.get('account.invoice.tax').read( cr, uid, invoice['tax_line']) - tax_lines = pool.get('account.invoice')._refund_cleanup_lines(tax_lines) + tax_lines = pool.get('account.invoice')._refund_cleanup_lines(cr, uid, tax_lines) invoice.update({ 'type': inv.type, From dcf275be04ff1c1733cca09613fda61e6d241e32 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Fri, 9 Oct 2009 16:03:54 +0530 Subject: [PATCH 026/200] [FIX]: problem Report Engine bzr revid: nch@tinyerp.com-20091009103354-u2z9v03jc864yekh --- bin/report/render/rml2pdf/trml2pdf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/report/render/rml2pdf/trml2pdf.py b/bin/report/render/rml2pdf/trml2pdf.py index f4b70a2da27..b3585254eb3 100644 --- a/bin/report/render/rml2pdf/trml2pdf.py +++ b/bin/report/render/rml2pdf/trml2pdf.py @@ -455,10 +455,10 @@ class _rml_flowable(object): if key in ('rml_except', 'rml_loop', 'rml_tag'): del txt_n.attrib[key] if True or not self._textual(n).isspace(): - txt_n.text = utils.xml2str(self._textual(n)) - txt_n.tail = '' + if not n.tag == 'bullet': + txt_n.text = utils.xml2str(self._textual(n)) + txt_n.tail = n.tail and utils._process_text(self, n.tail.replace('\n','')) or '' rc1 += etree.tostring(txt_n) - #rc1 += utils._process_text(self, node.tail or '') return rc1 def _table(self, node): From efc0d3b001b9252b367d1b1f1dd7b088ff6395d7 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Fri, 9 Oct 2009 16:15:47 +0530 Subject: [PATCH 027/200] [REF]:notified channel when there is an exception in eval() bzr revid: nch@tinyerp.com-20091009104547-t88ktqax7p5q57bz --- bin/report/render/rml2pdf/utils.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/report/render/rml2pdf/utils.py b/bin/report/render/rml2pdf/utils.py index 07bbbbcd05e..abc421a0f2f 100644 --- a/bin/report/render/rml2pdf/utils.py +++ b/bin/report/render/rml2pdf/utils.py @@ -43,6 +43,8 @@ from lxml import etree import copy import tools import locale +import netsvc +import traceback, sys _regex = re.compile('\[\[(.+?)\]\]') @@ -108,9 +110,13 @@ def _process_text(self, txt): result += self.localcontext.get('translate', lambda x:x)(sps.pop(0)) if sps: try: - txt = eval(sps.pop(0),self.localcontext) - except: - pass + expr = sps.pop(0) + txt = eval(expr,self.localcontext) + except Exception,e: + tb_s = reduce(lambda x, y: x+y, traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback)) + netsvc.Logger().notifyChannel('report', netsvc.LOG_ERROR, + 'report :\n%s\n%s\nexpr: %s' % (tb_s, str(e), + expr.encode('utf-8'))) if type(txt)==type('') or type(txt)==type(u''): txt2 = str2xml(txt) result += tools.ustr(txt2) @@ -173,7 +179,7 @@ def attr_get(node, attrs, dict={}): res[key] = int(node.get(key)) elif dict[key]=='unit': res[key] = unit_get(node.get(key)) - elif dict[key] == 'float' : + elif dict[key] == 'float' : res[key] = float(node.get(key)) return res From 3d08c9c6f049ffce39bd91382cb096e846e90b18 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 9 Oct 2009 13:48:16 +0200 Subject: [PATCH 028/200] [FIX] Specify the name of the argument for the context, to avoir a critical bug bzr revid: stephane@openerp.com-20091009114816-5n518p74cm1k2pj1 --- bin/addons/base/module/report/ir_module_reference_print.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/module/report/ir_module_reference_print.py b/bin/addons/base/module/report/ir_module_reference_print.py index 92029014bac..69de9ab9a09 100644 --- a/bin/addons/base/module/report/ir_module_reference_print.py +++ b/bin/addons/base/module/report/ir_module_reference_print.py @@ -25,7 +25,7 @@ from report import report_sxw class ir_module_reference_print(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(ir_module_reference_print, self).__init__(cr, uid, name, context) + super(ir_module_reference_print, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'findobj': self._object_find, From 25f727dd7b2d3e4917a3bc1816fa5e131c88890f Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Fri, 9 Oct 2009 13:49:00 +0200 Subject: [PATCH 029/200] [FIX] Specify the name of the argument for the context, to avoir a critical bug bzr revid: stephane@openerp.com-20091009114900-r4j49l7dmmw5sze5 --- addons/account/project/report/account_journal.py | 2 +- addons/account/project/report/analytic_balance.py | 2 +- addons/account/project/report/analytic_check.py | 2 +- addons/account/project/report/analytic_journal.py | 2 +- addons/account/project/report/cost_ledger.py | 2 +- addons/account/project/report/inverted_analytic_balance.py | 2 +- addons/account/project/report/quantity_cost_ledger.py | 3 +-- addons/account/report/account_balance.py | 2 +- addons/account/report/account_journal.py | 2 +- addons/account/report/account_tax_code.py | 2 +- addons/account/report/aged_trial_balance.py | 2 +- addons/account/report/central_journal.py | 2 +- addons/account/report/general_journal.py | 2 +- addons/account/report/general_ledger.py | 2 +- addons/account/report/general_ledger_landscape.py | 2 +- addons/account/report/invoice.py | 2 +- addons/account/report/partner_balance.py | 2 +- addons/account/report/rml_parse.py | 2 +- addons/account/report/tax_report.py | 2 +- addons/account/report/third_party_ledger.py | 2 +- addons/account_analytic_plans/report/crossovered_analytic.py | 2 +- addons/account_balance/report/account_balance.py | 2 +- addons/account_balance/report/account_balance_landscape.py | 2 +- addons/account_balance/report/rml_parse.py | 2 +- .../account_budget/report/analytic_account_budget_report.py | 2 +- addons/account_budget/report/budget_report.py | 2 +- addons/account_budget/report/crossovered_budget_report.py | 2 +- addons/account_followup/report/report_followup_print.py | 2 +- .../report/report_account_invoice_layout.py | 2 +- .../account_invoice_layout/report/special_message_invoice.py | 2 +- addons/account_payment/report/payment_order.py | 2 +- addons/account_report/report/accounting_report.py | 2 +- addons/account_report/report/print_indicator.py | 2 +- addons/account_reporting/report/account_report_bs.py | 2 +- addons/account_voucher/report/report_voucher.py | 2 +- addons/account_voucher/report/report_voucher_amount.py | 4 ++-- addons/account_voucher/report/rml_parse.py | 2 +- addons/auction/report/auction_artists.py | 2 +- addons/auction/report/auction_bids.py | 2 +- addons/auction/report/auction_buyer_result.py | 2 +- addons/auction/report/auction_catelog.py | 2 +- addons/auction/report/auction_objects.py | 2 +- addons/auction/report/auction_result.py | 2 +- addons/auction/report/auction_total_rml.py | 2 +- addons/auction/report/bids_lots.py | 2 +- addons/auction/report/bids_phones_details.py | 2 +- addons/auction/report/buyer_form_report.py | 2 +- addons/auction/report/buyer_list.py | 2 +- addons/auction/report/catelogwithpictures.py | 2 +- addons/auction/report/deposit_seller.py | 2 +- addons/auction/report/lots_list.py | 2 +- addons/auction/report/lots_list_inventory.py | 2 +- addons/auction/report/lots_list_landscape.py | 2 +- addons/auction/report/report_lot_bar_code.py | 2 +- addons/auction/report/seller_form_report.py | 2 +- addons/hr_attendance/report/attendance_errors.py | 2 +- addons/hr_expense/report/expense.py | 2 +- addons/hr_timesheet_invoice/report/account_analytic_profit.py | 2 +- addons/hr_timesheet_invoice/report/cost_ledger.py | 2 +- addons/l10n_ch/report/bvr.py | 2 +- addons/l10n_fr/report/base_report.py | 2 +- addons/mrp/report/order.py | 2 +- addons/mrp_operations/report/mrp_code_barcode.py | 2 +- addons/mrp_operations/report/mrp_wc_barcode.py | 2 +- addons/mrp_repair/report/order.py | 2 +- addons/point_of_sale/report/pos_details.py | 2 +- addons/point_of_sale/report/pos_details_summary.py | 2 +- addons/point_of_sale/report/pos_invoice.py | 2 +- addons/point_of_sale/report/pos_lines.py | 2 +- addons/point_of_sale/report/pos_receipt.py | 2 +- addons/product/report/product_pricelist.py | 2 +- addons/purchase/report/order.py | 2 +- addons/purchase/report/request_quotation.py | 2 +- addons/report_intrastat/report/invoice.py | 2 +- addons/sale/report/order.py | 2 +- addons/sale/report/sale_prepare_allot.py | 2 +- addons/sale_delivery_report/report/shipping.py | 2 +- addons/stock/report/lot_location.py | 2 +- addons/stock/report/lot_overview.py | 2 +- addons/stock/report/lot_overview_all.py | 2 +- addons/stock/report/picking.py | 2 +- 81 files changed, 82 insertions(+), 83 deletions(-) diff --git a/addons/account/project/report/account_journal.py b/addons/account/project/report/account_journal.py index 2f46abaceda..a732c88a969 100644 --- a/addons/account/project/report/account_journal.py +++ b/addons/account/project/report/account_journal.py @@ -37,7 +37,7 @@ class journal_print(report_sxw.rml_parse): self.cr.execute('select sum(amount) from account_analytic_line where journal_id=%s', (journal_id,)) return self.cr.fetchone()[0] or 0.0 def __init__(self, cr, uid, name, context): - super(journal_print, self).__init__(cr, uid, name, context) + super(journal_print, self).__init__(cr, uid, name, context=context) self.localcontext = { 'time': time, 'lines': self.lines, diff --git a/addons/account/project/report/analytic_balance.py b/addons/account/project/report/analytic_balance.py index 0c7b0cda761..9e96dfdd1bd 100644 --- a/addons/account/project/report/analytic_balance.py +++ b/addons/account/project/report/analytic_balance.py @@ -27,7 +27,7 @@ from report import report_sxw class account_analytic_balance(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_analytic_balance, self).__init__(cr, uid, name, context) + super(account_analytic_balance, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'get_objects': self._get_objects, diff --git a/addons/account/project/report/analytic_check.py b/addons/account/project/report/analytic_check.py index 6e794b35d87..5a300966840 100644 --- a/addons/account/project/report/analytic_check.py +++ b/addons/account/project/report/analytic_check.py @@ -26,7 +26,7 @@ from report import report_sxw class account_analytic_analytic_check(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_analytic_analytic_check, self).__init__(cr, uid, name, context) + super(account_analytic_analytic_check, self).__init__(cr, uid, name, context=context) self.sum_gen_deb = 0.0 self.sum_gen_cred = 0.0 self.sum_ana_deb = 0.0 diff --git a/addons/account/project/report/analytic_journal.py b/addons/account/project/report/analytic_journal.py index 30faa18fecc..621d6139ab5 100644 --- a/addons/account/project/report/analytic_journal.py +++ b/addons/account/project/report/analytic_journal.py @@ -28,7 +28,7 @@ from report import report_sxw # class account_analytic_journal(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_analytic_journal, self).__init__(cr, uid, name, context) + super(account_analytic_journal, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines': self._lines, diff --git a/addons/account/project/report/cost_ledger.py b/addons/account/project/report/cost_ledger.py index 0641cfe2ba3..5c18b51d113 100644 --- a/addons/account/project/report/cost_ledger.py +++ b/addons/account/project/report/cost_ledger.py @@ -26,7 +26,7 @@ from report import report_sxw class account_analytic_cost_ledger(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context) + super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines_g': self._lines_g, diff --git a/addons/account/project/report/inverted_analytic_balance.py b/addons/account/project/report/inverted_analytic_balance.py index 345f60619d0..ada30ef567e 100644 --- a/addons/account/project/report/inverted_analytic_balance.py +++ b/addons/account/project/report/inverted_analytic_balance.py @@ -26,7 +26,7 @@ from report import report_sxw class account_inverted_analytic_balance(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_inverted_analytic_balance, self).__init__(cr, uid, name, context) + super(account_inverted_analytic_balance, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines_g': self._lines_g, diff --git a/addons/account/project/report/quantity_cost_ledger.py b/addons/account/project/report/quantity_cost_ledger.py index 5e79e16c1ed..9942bb96b26 100644 --- a/addons/account/project/report/quantity_cost_ledger.py +++ b/addons/account/project/report/quantity_cost_ledger.py @@ -26,8 +26,7 @@ from report import report_sxw class account_analytic_quantity_cost_ledger(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_analytic_quantity_cost_ledger, self).__init__(cr, uid, - name, context) + super(account_analytic_quantity_cost_ledger, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines_g': self._lines_g, diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index ebf12dd9b08..49910b086a9 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -30,7 +30,7 @@ from report import report_sxw class account_balance(report_sxw.rml_parse): _name = 'report.account.account.balance' def __init__(self, cr, uid, name, context): - super(account_balance, self).__init__(cr, uid, name, context) + super(account_balance, self).__init__(cr, uid, name, context=context) self.sum_debit = 0.00 self.sum_credit = 0.00 self.date_lst = [] diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index f3c87ca1603..869b04b5dfd 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -29,7 +29,7 @@ from report import report_sxw # class journal_print(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(journal_print, self).__init__(cr, uid, name, context) + super(journal_print, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines': self.lines, diff --git a/addons/account/report/account_tax_code.py b/addons/account/report/account_tax_code.py index 773e9541d79..f3c3fb75e47 100644 --- a/addons/account/report/account_tax_code.py +++ b/addons/account/report/account_tax_code.py @@ -30,7 +30,7 @@ class account_tax_code_report(rml_parse.rml_parse): #_name = 'report.account.tax.code.entries' def __init__(self, cr, uid, name, context): - super(account_tax_code_report, self).__init__(cr, uid, name, context) + super(account_tax_code_report, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'get_line':self.get_line, diff --git a/addons/account/report/aged_trial_balance.py b/addons/account/report/aged_trial_balance.py index 652929e187d..4477e2a1561 100644 --- a/addons/account/report/aged_trial_balance.py +++ b/addons/account/report/aged_trial_balance.py @@ -28,7 +28,7 @@ from report import report_sxw class aged_trial_report(rml_parse.rml_parse): def __init__(self, cr, uid, name, context): - super(aged_trial_report, self).__init__(cr, uid, name, context) + super(aged_trial_report, self).__init__(cr, uid, name, context=context) self.line_query = '' self.total_account = [] diff --git a/addons/account/report/central_journal.py b/addons/account/report/central_journal.py index 2db5c6fe971..762282a3f90 100644 --- a/addons/account/report/central_journal.py +++ b/addons/account/report/central_journal.py @@ -28,7 +28,7 @@ from report import report_sxw # class journal_print(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(journal_print, self).__init__(cr, uid, name, context) + super(journal_print, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'lines': self.lines, diff --git a/addons/account/report/general_journal.py b/addons/account/report/general_journal.py index 926c3603e49..eb330134873 100644 --- a/addons/account/report/general_journal.py +++ b/addons/account/report/general_journal.py @@ -29,7 +29,7 @@ from report import report_sxw # class journal_print(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(journal_print, self).__init__(cr, uid, name, context) + super(journal_print, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines': self.lines, diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index 534b4d52e67..f8712ea4863 100644 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -53,7 +53,7 @@ class general_ledger(rml_parse.rml_parse): super(general_ledger, self).set_context(objects, data, new_ids, report_type) def __init__(self, cr, uid, name, context): - super(general_ledger, self).__init__(cr, uid, name, context) + super(general_ledger, self).__init__(cr, uid, name, context=context) self.date_borne = {} self.query = "" self.child_ids = "" diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py index c63c4281173..0879a464f26 100644 --- a/addons/account/report/general_ledger_landscape.py +++ b/addons/account/report/general_ledger_landscape.py @@ -52,7 +52,7 @@ class general_ledger_landscape(rml_parse.rml_parse): super(general_ledger_landscape, self).set_context(objects, data, new_ids,report_type) def __init__(self, cr, uid, name, context): - super(general_ledger_landscape, self).__init__(cr, uid, name, context) + super(general_ledger_landscape, self).__init__(cr, uid, name, context=context) self.date_borne = {} self.query = "" self.child_ids = "" diff --git a/addons/account/report/invoice.py b/addons/account/report/invoice.py index 3ca850a148b..f125ab47b8b 100644 --- a/addons/account/report/invoice.py +++ b/addons/account/report/invoice.py @@ -25,7 +25,7 @@ from report import report_sxw class account_invoice(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_invoice, self).__init__(cr, uid, name, context) + super(account_invoice, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/account/report/partner_balance.py b/addons/account/report/partner_balance.py index ddd6ad1ecb4..78067a3346a 100755 --- a/addons/account/report/partner_balance.py +++ b/addons/account/report/partner_balance.py @@ -28,7 +28,7 @@ from report import report_sxw class partner_balance(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(partner_balance, self).__init__(cr, uid, name, context) + super(partner_balance, self).__init__(cr, uid, name, context=context) self.date_lst = [] self.date_lst_string = '' self.account_ids = '' diff --git a/addons/account/report/rml_parse.py b/addons/account/report/rml_parse.py index e0c41e8f286..02a5a266236 100644 --- a/addons/account/report/rml_parse.py +++ b/addons/account/report/rml_parse.py @@ -32,7 +32,7 @@ import sys class rml_parse(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(rml_parse, self).__init__(cr, uid, name, context=None) + super(rml_parse, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'comma_me': self.comma_me, 'format_date': self._get_and_change_date_format_for_swiss, diff --git a/addons/account/report/tax_report.py b/addons/account/report/tax_report.py index 1f0332d2906..c4f8fdeb1f3 100644 --- a/addons/account/report/tax_report.py +++ b/addons/account/report/tax_report.py @@ -31,7 +31,7 @@ import re class tax_report(rml_parse.rml_parse): _name = 'report.account.vat.declaration' def __init__(self, cr, uid, name, context): - super(tax_report, self).__init__(cr, uid, name, context) + super(tax_report, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'get_period': self._get_period, diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py index 9828fdfbd63..47407a31392 100644 --- a/addons/account/report/third_party_ledger.py +++ b/addons/account/report/third_party_ledger.py @@ -31,7 +31,7 @@ class third_party_ledger(rml_parse.rml_parse): def __init__(self, cr, uid, name, context): self.date_lst = [] self.date_lst_string = '' - super(third_party_ledger, self).__init__(cr, uid, name, context) + super(third_party_ledger, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines': self.lines, diff --git a/addons/account_analytic_plans/report/crossovered_analytic.py b/addons/account_analytic_plans/report/crossovered_analytic.py index 2fab914fb64..951e147d7a8 100644 --- a/addons/account_analytic_plans/report/crossovered_analytic.py +++ b/addons/account_analytic_plans/report/crossovered_analytic.py @@ -26,7 +26,7 @@ from report import report_sxw class crossovered_analytic(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(crossovered_analytic, self).__init__(cr, uid, name, context) + super(crossovered_analytic, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, 'lines': self._lines, diff --git a/addons/account_balance/report/account_balance.py b/addons/account_balance/report/account_balance.py index 4fe498ac147..d67efab75a2 100644 --- a/addons/account_balance/report/account_balance.py +++ b/addons/account_balance/report/account_balance.py @@ -35,7 +35,7 @@ parents = { class account_balance(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_balance, self).__init__(cr, uid, name, context) + super(account_balance, self).__init__(cr, uid, name, context=context) self.flag=1 self.dr_total= 0.00 self.cr_total= 0.00 diff --git a/addons/account_balance/report/account_balance_landscape.py b/addons/account_balance/report/account_balance_landscape.py index 372fdf2c441..925494f6021 100644 --- a/addons/account_balance/report/account_balance_landscape.py +++ b/addons/account_balance/report/account_balance_landscape.py @@ -36,7 +36,7 @@ parents = { class account_balance_landscape(rml_parse.rml_parse): def __init__(self, cr, uid, name, context): - super(account_balance_landscape, self).__init__(cr, uid, name, context) + super(account_balance_landscape, self).__init__(cr, uid, name, context=context) self.flag=1 self.dr_total= 0.00 self.cr_total= 0.00 diff --git a/addons/account_balance/report/rml_parse.py b/addons/account_balance/report/rml_parse.py index c5eceb5bcd1..37bb0add89e 100644 --- a/addons/account_balance/report/rml_parse.py +++ b/addons/account_balance/report/rml_parse.py @@ -32,7 +32,7 @@ import sys class rml_parse(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(rml_parse, self).__init__(cr, uid, name, context=None) + super(rml_parse, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'comma_me': self.comma_me, 'format_date': self._get_and_change_date_format_for_swiss, diff --git a/addons/account_budget/report/analytic_account_budget_report.py b/addons/account_budget/report/analytic_account_budget_report.py index a22195cfc76..a35fc3b15f4 100644 --- a/addons/account_budget/report/analytic_account_budget_report.py +++ b/addons/account_budget/report/analytic_account_budget_report.py @@ -26,7 +26,7 @@ import datetime class analytic_account_budget_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(analytic_account_budget_report, self).__init__(cr, uid, name, context) + super(analytic_account_budget_report, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'funct': self.funct, 'funct_total': self.funct_total, diff --git a/addons/account_budget/report/budget_report.py b/addons/account_budget/report/budget_report.py index 102707a14c7..c9c6c0750e4 100644 --- a/addons/account_budget/report/budget_report.py +++ b/addons/account_budget/report/budget_report.py @@ -27,7 +27,7 @@ import operator class budget_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(budget_report, self).__init__(cr, uid, name, context) + super(budget_report, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'lines': self.lines, 'budget_total': self.budget_total, diff --git a/addons/account_budget/report/crossovered_budget_report.py b/addons/account_budget/report/crossovered_budget_report.py index 3e46c1196f5..8b607e98cf1 100644 --- a/addons/account_budget/report/crossovered_budget_report.py +++ b/addons/account_budget/report/crossovered_budget_report.py @@ -29,7 +29,7 @@ import osv class budget_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(budget_report, self).__init__(cr, uid, name, context) + super(budget_report, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'funct': self.funct, 'funct_total': self.funct_total, diff --git a/addons/account_followup/report/report_followup_print.py b/addons/account_followup/report/report_followup_print.py index 53ad5ce2572..0c9768f45de 100644 --- a/addons/account_followup/report/report_followup_print.py +++ b/addons/account_followup/report/report_followup_print.py @@ -28,7 +28,7 @@ from report import report_sxw class report_rappel(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(report_rappel, self).__init__(cr, uid, name, context) + super(report_rappel, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time' : time, 'ids_to_objects': self._ids_to_objects, diff --git a/addons/account_invoice_layout/report/report_account_invoice_layout.py b/addons/account_invoice_layout/report/report_account_invoice_layout.py index a577f7d656a..77221a54e81 100644 --- a/addons/account_invoice_layout/report/report_account_invoice_layout.py +++ b/addons/account_invoice_layout/report/report_account_invoice_layout.py @@ -25,7 +25,7 @@ from report import report_sxw class account_invoice_1(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_invoice_1, self).__init__(cr, uid, name, context) + super(account_invoice_1, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'invoice_lines': self.invoice_lines, diff --git a/addons/account_invoice_layout/report/special_message_invoice.py b/addons/account_invoice_layout/report/special_message_invoice.py index 38fe8739142..94dff32a54e 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.py +++ b/addons/account_invoice_layout/report/special_message_invoice.py @@ -26,7 +26,7 @@ import pooler class account_invoice_with_message(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_invoice_with_message, self).__init__(cr, uid, name, context) + super(account_invoice_with_message, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'spcl_msg': self.spcl_msg, diff --git a/addons/account_payment/report/payment_order.py b/addons/account_payment/report/payment_order.py index 4767c63ba31..dec5c031f98 100644 --- a/addons/account_payment/report/payment_order.py +++ b/addons/account_payment/report/payment_order.py @@ -26,7 +26,7 @@ from report import report_sxw class payment_order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(payment_order, self).__init__(cr, uid, name, context) + super(payment_order, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, diff --git a/addons/account_report/report/accounting_report.py b/addons/account_report/report/accounting_report.py index c489d99ca62..52f1a02221d 100644 --- a/addons/account_report/report/accounting_report.py +++ b/addons/account_report/report/accounting_report.py @@ -28,7 +28,7 @@ from report import report_sxw class accounting_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(accounting_report, self).__init__(cr, uid, name, context) + super(accounting_report, self).__init__(cr, uid, name, context=context) self.ret_list = [] self.localcontext.update({ 'time': time, diff --git a/addons/account_report/report/print_indicator.py b/addons/account_report/report/print_indicator.py index 9d4fa4673f4..53f59919b91 100644 --- a/addons/account_report/report/print_indicator.py +++ b/addons/account_report/report/print_indicator.py @@ -76,7 +76,7 @@ import os class accounting_report_indicator(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(accounting_report_indicator, self).__init__(cr, uid, name, context) + super(accounting_report_indicator, self).__init__(cr, uid, name, context=context) self.ret_list = [] self.localcontext.update({ 'time': time, diff --git a/addons/account_reporting/report/account_report_bs.py b/addons/account_reporting/report/account_report_bs.py index 955e4c12c6f..c741b0d2ff0 100644 --- a/addons/account_reporting/report/account_report_bs.py +++ b/addons/account_reporting/report/account_report_bs.py @@ -36,7 +36,7 @@ parents = { class account_report_bs(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_report_bs, self).__init__(cr, uid, name, context) + super(account_report_bs, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'lines': self.lines, diff --git a/addons/account_voucher/report/report_voucher.py b/addons/account_voucher/report/report_voucher.py index 27ba2efd488..9f40c6ad920 100755 --- a/addons/account_voucher/report/report_voucher.py +++ b/addons/account_voucher/report/report_voucher.py @@ -32,7 +32,7 @@ from tools import amount_to_text_en class report_voucher(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(report_voucher, self).__init__(cr, uid, name, context) + super(report_voucher, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'convert':self.convert, diff --git a/addons/account_voucher/report/report_voucher_amount.py b/addons/account_voucher/report/report_voucher_amount.py index 3b67ff7a9ac..246782e433e 100755 --- a/addons/account_voucher/report/report_voucher_amount.py +++ b/addons/account_voucher/report/report_voucher_amount.py @@ -32,7 +32,7 @@ from tools import amount_to_text_en class report_voucher_amount(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(report_voucher_amount, self).__init__(cr, uid, name, context) + super(report_voucher_amount, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'convert':self.convert @@ -48,4 +48,4 @@ report_sxw.report_sxw( 'account.voucher', 'addons/account_voucher/report/report_voucher_amount.rml', parser=report_voucher_amount,header=False -) \ No newline at end of file +) diff --git a/addons/account_voucher/report/rml_parse.py b/addons/account_voucher/report/rml_parse.py index 31bd26617cd..9f4b8e6bfb9 100644 --- a/addons/account_voucher/report/rml_parse.py +++ b/addons/account_voucher/report/rml_parse.py @@ -32,7 +32,7 @@ import sys class rml_parse(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(rml_parse, self).__init__(cr, uid, name, context=None) + super(rml_parse, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'comma_me': self.comma_me, 'format_date': self._get_and_change_date_format_for_swiss, diff --git a/addons/auction/report/auction_artists.py b/addons/auction/report/auction_artists.py index 91843906dff..c66531938f4 100644 --- a/addons/auction/report/auction_artists.py +++ b/addons/auction/report/auction_artists.py @@ -28,7 +28,7 @@ from report import report_sxw class auction_artists(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(auction_artists, self).__init__(cr, uid, name, context) + super(auction_artists, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/addons/auction/report/auction_bids.py b/addons/auction/report/auction_bids.py index 560160ac008..2153d246428 100644 --- a/addons/auction/report/auction_bids.py +++ b/addons/auction/report/auction_bids.py @@ -28,7 +28,7 @@ from report import report_sxw class auction_bids(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(auction_bids, self).__init__(cr, uid, name, context) + super(auction_bids, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/auction/report/auction_buyer_result.py b/addons/auction/report/auction_buyer_result.py index 97ab54cc056..017f62eb5d0 100644 --- a/addons/auction/report/auction_buyer_result.py +++ b/addons/auction/report/auction_buyer_result.py @@ -28,7 +28,7 @@ from report import report_sxw class auction_buyer_result(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(auction_buyer_result, self).__init__(cr, uid, name, context) + super(auction_buyer_result, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/addons/auction/report/auction_catelog.py b/addons/auction/report/auction_catelog.py index 70b2b6db917..b9b8dad2dc7 100644 --- a/addons/auction/report/auction_catelog.py +++ b/addons/auction/report/auction_catelog.py @@ -28,7 +28,7 @@ from report import report_sxw class auction_catelog(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(auction_catelog, self).__init__(cr, uid, name, context) + super(auction_catelog, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/addons/auction/report/auction_objects.py b/addons/auction/report/auction_objects.py index 879b407c184..0879c7770e5 100644 --- a/addons/auction/report/auction_objects.py +++ b/addons/auction/report/auction_objects.py @@ -26,7 +26,7 @@ from report import report_sxw class auction_objects(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(auction_objects, self).__init__(cr, uid, name, context) + super(auction_objects, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, #'lines': self.lines diff --git a/addons/auction/report/auction_result.py b/addons/auction/report/auction_result.py index 48f21d73669..77ba88b9486 100644 --- a/addons/auction/report/auction_result.py +++ b/addons/auction/report/auction_result.py @@ -28,7 +28,7 @@ from report import report_sxw class auction_result(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(auction_result, self).__init__(cr, uid, name, context) + super(auction_result, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/addons/auction/report/auction_total_rml.py b/addons/auction/report/auction_total_rml.py index cc103e7c250..82c068bce26 100644 --- a/addons/auction/report/auction_total_rml.py +++ b/addons/auction/report/auction_total_rml.py @@ -29,7 +29,7 @@ from report import report_sxw class auction_total_rml(report_sxw.rml_parse): total_obj=[] def __init__(self, cr, uid, name, context): - super(auction_total_rml, self).__init__(cr, uid, name, context) + super(auction_total_rml, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'sum_taxes':self.sum_taxes, diff --git a/addons/auction/report/bids_lots.py b/addons/auction/report/bids_lots.py index 8358e76ea2a..e77d7948c92 100644 --- a/addons/auction/report/bids_lots.py +++ b/addons/auction/report/bids_lots.py @@ -28,7 +28,7 @@ from report import report_sxw class bids_lots(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(bids_lots, self).__init__(cr, uid, name, context) + super(bids_lots, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/auction/report/bids_phones_details.py b/addons/auction/report/bids_phones_details.py index bf5e5343074..73899f957cd 100644 --- a/addons/auction/report/bids_phones_details.py +++ b/addons/auction/report/bids_phones_details.py @@ -28,7 +28,7 @@ from report import report_sxw class bids_phones_details(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(bids_phones_details, self).__init__(cr, uid, name, context) + super(bids_phones_details, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/auction/report/buyer_form_report.py b/addons/auction/report/buyer_form_report.py index 20d93cef754..291be748930 100644 --- a/addons/auction/report/buyer_form_report.py +++ b/addons/auction/report/buyer_form_report.py @@ -30,7 +30,7 @@ class buyer_form_report(report_sxw.rml_parse): count=0 c=0 def __init__(self, cr, uid, name, context): - super(buyer_form_report, self).__init__(cr, uid, name, context) + super(buyer_form_report, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'sum_taxes': self.sum_taxes, diff --git a/addons/auction/report/buyer_list.py b/addons/auction/report/buyer_list.py index eaa44f22c0c..83799ba5169 100644 --- a/addons/auction/report/buyer_list.py +++ b/addons/auction/report/buyer_list.py @@ -34,7 +34,7 @@ class buyer_list(report_sxw.rml_parse): sum_buyer_price_val=0.0 sum_lot_val=0.0 def __init__(self, cr, uid, name, context): - super(buyer_list, self).__init__(cr, uid, name, context) + super(buyer_list, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'lines_lots_from_auction' : self.lines_lots_from_auction, diff --git a/addons/auction/report/catelogwithpictures.py b/addons/auction/report/catelogwithpictures.py index f3f954a2908..4063f884ad2 100644 --- a/addons/auction/report/catelogwithpictures.py +++ b/addons/auction/report/catelogwithpictures.py @@ -26,7 +26,7 @@ from report import report_sxw class catelogwithpictures(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(catelogwithpictures, self).__init__(cr, uid, name, context) + super(catelogwithpictures, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/addons/auction/report/deposit_seller.py b/addons/auction/report/deposit_seller.py index 4e0a184ffc7..f39fd6b5596 100644 --- a/addons/auction/report/deposit_seller.py +++ b/addons/auction/report/deposit_seller.py @@ -28,7 +28,7 @@ from report import report_sxw class deposit_seller(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(deposit_seller, self).__init__(cr, uid, name, context) + super(deposit_seller, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/addons/auction/report/lots_list.py b/addons/auction/report/lots_list.py index 32d23accb90..ad5e678c2f3 100644 --- a/addons/auction/report/lots_list.py +++ b/addons/auction/report/lots_list.py @@ -26,7 +26,7 @@ from report import report_sxw class lots_list(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(lots_list, self).__init__(cr, uid, name, context) + super(lots_list, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'bid_line' : self.bid_line diff --git a/addons/auction/report/lots_list_inventory.py b/addons/auction/report/lots_list_inventory.py index 42a993ccc7a..329591cf3ac 100644 --- a/addons/auction/report/lots_list_inventory.py +++ b/addons/auction/report/lots_list_inventory.py @@ -26,7 +26,7 @@ from report import report_sxw class lots_list_inventory(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(lots_list_inventory, self).__init__(cr, uid, name, context) + super(lots_list_inventory, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'bid_line' : self.bid_line diff --git a/addons/auction/report/lots_list_landscape.py b/addons/auction/report/lots_list_landscape.py index b638c6e54c4..99760d78715 100644 --- a/addons/auction/report/lots_list_landscape.py +++ b/addons/auction/report/lots_list_landscape.py @@ -26,7 +26,7 @@ from report import report_sxw class lots_list_llandscape(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(lots_list_landscape, self).__init__(cr, uid, name, context) + super(lots_list_landscape, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, diff --git a/addons/auction/report/report_lot_bar_code.py b/addons/auction/report/report_lot_bar_code.py index 3d9f8df4330..4767fe68c28 100644 --- a/addons/auction/report/report_lot_bar_code.py +++ b/addons/auction/report/report_lot_bar_code.py @@ -26,7 +26,7 @@ from report import report_sxw class auction_code_produit(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(auction_code_produit, self).__init__(cr, uid, name, context) + super(auction_code_produit, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/auction/report/seller_form_report.py b/addons/auction/report/seller_form_report.py index a64759b2547..d0febfde712 100644 --- a/addons/auction/report/seller_form_report.py +++ b/addons/auction/report/seller_form_report.py @@ -28,7 +28,7 @@ from osv import osv class seller_form_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(seller_form_report, self).__init__(cr, uid, name, context) + super(seller_form_report, self).__init__(cr, uid, name, context=context) lot=self.pool.get('auction.lots').browse(cr,uid,uid) #address=lot.bord_vnd_id.address_get(self.cr,self.uid,[partner.id]) # partner=lot.bord_vnd_id.partner_id diff --git a/addons/hr_attendance/report/attendance_errors.py b/addons/hr_attendance/report/attendance_errors.py index ef3317e27da..58553cd5e83 100644 --- a/addons/hr_attendance/report/attendance_errors.py +++ b/addons/hr_attendance/report/attendance_errors.py @@ -28,7 +28,7 @@ import datetime class attendance_print(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(attendance_print, self).__init__(cr, uid, name, context) + super(attendance_print, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'lst': self._lst, diff --git a/addons/hr_expense/report/expense.py b/addons/hr_expense/report/expense.py index 0c35a035a38..376b5e6c16a 100644 --- a/addons/hr_expense/report/expense.py +++ b/addons/hr_expense/report/expense.py @@ -26,7 +26,7 @@ import datetime class expense(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(expense, self).__init__(cr, uid, name, context) + super(expense, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, }) diff --git a/addons/hr_timesheet_invoice/report/account_analytic_profit.py b/addons/hr_timesheet_invoice/report/account_analytic_profit.py index a767eba946a..600535ee027 100644 --- a/addons/hr_timesheet_invoice/report/account_analytic_profit.py +++ b/addons/hr_timesheet_invoice/report/account_analytic_profit.py @@ -25,7 +25,7 @@ import pooler class account_analytic_profit(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_analytic_profit, self).__init__(cr, uid, name, context) + super(account_analytic_profit, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'lines': self._lines, 'user_ids': self._user_ids, diff --git a/addons/hr_timesheet_invoice/report/cost_ledger.py b/addons/hr_timesheet_invoice/report/cost_ledger.py index 5e588f11e06..584ea3c6acd 100644 --- a/addons/hr_timesheet_invoice/report/cost_ledger.py +++ b/addons/hr_timesheet_invoice/report/cost_ledger.py @@ -27,7 +27,7 @@ from report import report_sxw class account_analytic_cost_ledger(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context) + super(account_analytic_cost_ledger, self).__init__(cr, uid, name, context=context) self.sum_revenue={} self.account_sum_revenue={} self.localcontext.update( { diff --git a/addons/l10n_ch/report/bvr.py b/addons/l10n_ch/report/bvr.py index c71c62a0da2..8804f6c876a 100755 --- a/addons/l10n_ch/report/bvr.py +++ b/addons/l10n_ch/report/bvr.py @@ -39,7 +39,7 @@ from mx.DateTime import * class account_invoice_bvr(report_sxw.rml_parse): """Report class that Allows to print BVR payement vector""" def __init__(self, cr, uid, name, context): - super(account_invoice_bvr, self).__init__(cr, uid, name, context) + super(account_invoice_bvr, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'user':self.pool.get("res.users").browse(cr,uid,uid), diff --git a/addons/l10n_fr/report/base_report.py b/addons/l10n_fr/report/base_report.py index 488f36304c5..52eb99154a6 100644 --- a/addons/l10n_fr/report/base_report.py +++ b/addons/l10n_fr/report/base_report.py @@ -31,7 +31,7 @@ from report import report_sxw class base_report(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(base_report, self).__init__(cr, uid, name, context) + super(base_report, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'time': time, '_load': self._load, diff --git a/addons/mrp/report/order.py b/addons/mrp/report/order.py index 5fc82b9f7f0..02526d88a64 100644 --- a/addons/mrp/report/order.py +++ b/addons/mrp/report/order.py @@ -27,7 +27,7 @@ import pooler class order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context) + super(order, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/mrp_operations/report/mrp_code_barcode.py b/addons/mrp_operations/report/mrp_code_barcode.py index a4431e55b57..336a46ba546 100755 --- a/addons/mrp_operations/report/mrp_code_barcode.py +++ b/addons/mrp_operations/report/mrp_code_barcode.py @@ -26,7 +26,7 @@ from report import report_sxw class code_barcode(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(code_barcode, self).__init__(cr, uid, name, context) + super(code_barcode, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/mrp_operations/report/mrp_wc_barcode.py b/addons/mrp_operations/report/mrp_wc_barcode.py index bc4fe4976ee..6725f95a95d 100755 --- a/addons/mrp_operations/report/mrp_wc_barcode.py +++ b/addons/mrp_operations/report/mrp_wc_barcode.py @@ -26,7 +26,7 @@ from report import report_sxw class workcenter_code(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(workcenter_code, self).__init__(cr, uid, name, context) + super(workcenter_code, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/mrp_repair/report/order.py b/addons/mrp_repair/report/order.py index be6897d8c2e..b7f3d0bc19d 100644 --- a/addons/mrp_repair/report/order.py +++ b/addons/mrp_repair/report/order.py @@ -27,7 +27,7 @@ import pooler class order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context) + super(order, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'total': self.total, diff --git a/addons/point_of_sale/report/pos_details.py b/addons/point_of_sale/report/pos_details.py index 1e5962c6586..6a6b9420255 100644 --- a/addons/point_of_sale/report/pos_details.py +++ b/addons/point_of_sale/report/pos_details.py @@ -112,7 +112,7 @@ class pos_details(report_sxw.rml_parse): return '%s - %s' % (min_date, max_date) def __init__(self, cr, uid, name, context): - super(pos_details, self).__init__(cr, uid, name, context) + super(pos_details, self).__init__(cr, uid, name, context=context) self.total = 0.0 self.localcontext.update({ 'time': time, diff --git a/addons/point_of_sale/report/pos_details_summary.py b/addons/point_of_sale/report/pos_details_summary.py index 826844effd6..dc625aee62e 100644 --- a/addons/point_of_sale/report/pos_details_summary.py +++ b/addons/point_of_sale/report/pos_details_summary.py @@ -109,7 +109,7 @@ class pos_details_summary(report_sxw.rml_parse): return '%s - %s' % (min_date, max_date) def __init__(self, cr, uid, name, context): - super(pos_details_summary, self).__init__(cr, uid, name, context) + super(pos_details_summary, self).__init__(cr, uid, name, context=context) self.total = 0.0 self.localcontext.update({ 'time': time, diff --git a/addons/point_of_sale/report/pos_invoice.py b/addons/point_of_sale/report/pos_invoice.py index 54423775614..1d2749b46ef 100644 --- a/addons/point_of_sale/report/pos_invoice.py +++ b/addons/point_of_sale/report/pos_invoice.py @@ -29,7 +29,7 @@ from tools.translate import _ class pos_invoice(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(pos_invoice, self).__init__(cr, uid, name, context) + super(pos_invoice, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/point_of_sale/report/pos_lines.py b/addons/point_of_sale/report/pos_lines.py index 1abec66dc80..66f9754f412 100644 --- a/addons/point_of_sale/report/pos_lines.py +++ b/addons/point_of_sale/report/pos_lines.py @@ -27,7 +27,7 @@ from report import report_sxw class pos_lines(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(pos_lines, self).__init__(cr, uid, name, context) + super(pos_lines, self).__init__(cr, uid, name, context=context) self.total = 0.0 self.localcontext.update({ 'time': time, diff --git a/addons/point_of_sale/report/pos_receipt.py b/addons/point_of_sale/report/pos_receipt.py index 69f4bd706c2..15d8f177582 100644 --- a/addons/point_of_sale/report/pos_receipt.py +++ b/addons/point_of_sale/report/pos_receipt.py @@ -29,7 +29,7 @@ import pooler class order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context) + super(order, self).__init__(cr, uid, name, context=context) user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid) partner = user.company_id.partner_id diff --git a/addons/product/report/product_pricelist.py b/addons/product/report/product_pricelist.py index 3e232f7413c..dc3a1c3512c 100644 --- a/addons/product/report/product_pricelist.py +++ b/addons/product/report/product_pricelist.py @@ -27,7 +27,7 @@ import pooler class product_pricelist(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(product_pricelist, self).__init__(cr, uid, name, context) + super(product_pricelist, self).__init__(cr, uid, name, context=context) self.pricelist=False self.quantity=[] self.localcontext.update({ diff --git a/addons/purchase/report/order.py b/addons/purchase/report/order.py index 52aaa1ae865..66ba383141d 100644 --- a/addons/purchase/report/order.py +++ b/addons/purchase/report/order.py @@ -27,7 +27,7 @@ import pooler class order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context) + super(order, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'get_line_tax': self._get_line_tax, diff --git a/addons/purchase/report/request_quotation.py b/addons/purchase/report/request_quotation.py index 9acf4309264..0e920e2039d 100644 --- a/addons/purchase/report/request_quotation.py +++ b/addons/purchase/report/request_quotation.py @@ -27,7 +27,7 @@ import pooler class request_quotation(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(request_quotation, self).__init__(cr, uid, name, context) + super(request_quotation, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, 'user': self.pool.get('res.users').browse(cr, uid, uid, context) diff --git a/addons/report_intrastat/report/invoice.py b/addons/report_intrastat/report/invoice.py index 692b33d0095..7afdd1c180e 100644 --- a/addons/report_intrastat/report/invoice.py +++ b/addons/report_intrastat/report/invoice.py @@ -26,7 +26,7 @@ import pooler class account_invoice_intrastat(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(account_invoice_intrastat, self).__init__(cr, uid, name, context) + super(account_invoice_intrastat, self).__init__(cr, uid, name, context=context) self.total=0 self.localcontext.update({ 'time': time, diff --git a/addons/sale/report/order.py b/addons/sale/report/order.py index cb239b62f2a..ef33a9509f8 100644 --- a/addons/sale/report/order.py +++ b/addons/sale/report/order.py @@ -26,7 +26,7 @@ from osv import osv class order(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(order, self).__init__(cr, uid, name, context) + super(order, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) diff --git a/addons/sale/report/sale_prepare_allot.py b/addons/sale/report/sale_prepare_allot.py index ef59da50d7d..30f643d63f3 100644 --- a/addons/sale/report/sale_prepare_allot.py +++ b/addons/sale/report/sale_prepare_allot.py @@ -25,7 +25,7 @@ from report import report_sxw class sale_prepare(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(sale_prepare, self).__init__(cr, uid, name, context) + super(sale_prepare, self).__init__(cr, uid, name, context=context) self.localcontext.update( { 'allotment': self._allotment, }) diff --git a/addons/sale_delivery_report/report/shipping.py b/addons/sale_delivery_report/report/shipping.py index 63aeba6c10c..13ea8e754da 100644 --- a/addons/sale_delivery_report/report/shipping.py +++ b/addons/sale_delivery_report/report/shipping.py @@ -27,7 +27,7 @@ import pooler class shipping(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(shipping, self).__init__(cr, uid, name, context) + super(shipping, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, # 'get_address': self._get_address, diff --git a/addons/stock/report/lot_location.py b/addons/stock/report/lot_location.py index e20f89bb81f..a44ae876a9e 100644 --- a/addons/stock/report/lot_location.py +++ b/addons/stock/report/lot_location.py @@ -25,7 +25,7 @@ from report import report_sxw class lot_location(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(lot_location, self).__init__(cr, uid, name, context) + super(lot_location, self).__init__(cr, uid, name, context=context) self.grand_total = 0.0 self.localcontext.update({ diff --git a/addons/stock/report/lot_overview.py b/addons/stock/report/lot_overview.py index 3ecd26476df..f8442d7f3f6 100644 --- a/addons/stock/report/lot_overview.py +++ b/addons/stock/report/lot_overview.py @@ -25,7 +25,7 @@ from report import report_sxw class lot_overview(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(lot_overview, self).__init__(cr, uid, name, context) + super(lot_overview, self).__init__(cr, uid, name, context=context) self.price_total = 0.0 self.grand_total = 0.0 self.localcontext.update({ diff --git a/addons/stock/report/lot_overview_all.py b/addons/stock/report/lot_overview_all.py index 2f349d9bd93..addd7a9009f 100644 --- a/addons/stock/report/lot_overview_all.py +++ b/addons/stock/report/lot_overview_all.py @@ -25,7 +25,7 @@ from report import report_sxw class lot_overview_all(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(lot_overview_all, self).__init__(cr, uid, name, context) + super(lot_overview_all, self).__init__(cr, uid, name, context=context) self.price_total = 0.0 self.grand_total = 0.0 self.localcontext.update({ diff --git a/addons/stock/report/picking.py b/addons/stock/report/picking.py index 5a0746b80e8..0182ef3ba54 100644 --- a/addons/stock/report/picking.py +++ b/addons/stock/report/picking.py @@ -27,7 +27,7 @@ import pooler class picking(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - super(picking, self).__init__(cr, uid, name, context) + super(picking, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, }) From 6f68bf76ff2e7c669c0afecb41ec7dc78b70adc3 Mon Sep 17 00:00:00 2001 From: "HDA (OpenERP)" Date: Mon, 12 Oct 2009 15:53:33 +0530 Subject: [PATCH 030/200] Module:account_voucher Removed (tlh_TLH)Klingon translation file bzr revid: hda@tinyerp.com-20091012102333-tcvpvl11p43skegs --- addons/account_voucher/i18n/tlh_TLH.po | 598 ------------------------- 1 file changed, 598 deletions(-) delete mode 100644 addons/account_voucher/i18n/tlh_TLH.po diff --git a/addons/account_voucher/i18n/tlh_TLH.po b/addons/account_voucher/i18n/tlh_TLH.po deleted file mode 100644 index 40cccd6da7f..00000000000 --- a/addons/account_voucher/i18n/tlh_TLH.po +++ /dev/null @@ -1,598 +0,0 @@ -# Translation of OpenERP Server. -# This file contains the translation of the following modules: -# * account_voucher -# -msgid "" -msgstr "" -"Project-Id-Version: OpenERP Server 5.0.0\n" -"Report-Msgid-Bugs-To: support@openerp.com\n" -"POT-Creation-Date: 2009-05-19 14:36+0000\n" -"PO-Revision-Date: 2009-05-19 17:10+0000\n" -"Last-Translator: <>\n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2009-08-28 11:00+0000\n" -"X-Generator: Launchpad (build Unknown)\n" - -#. module: account_voucher -#: model:ir.actions.act_window,name:account_voucher.act_account_acount_move_line_open1 -msgid "Opening Balance Entry" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_receipt_bakreceipt_voucher_list -msgid "Bank Receipts" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Particulars" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "State :" -msgstr "" - -#. module: account_voucher -#: constraint:ir.actions.act_window:0 -msgid "Invalid model name in the action definition." -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Ref. :" -msgstr "" - -#. module: account_voucher -#: selection:account.move,voucher_type:0 -#: selection:account.voucher,type:0 -#: selection:account.voucher.open,init,type:0 -#: model:ir.actions.act_window,name:account_voucher.action_view_cont_voucher_form -#: model:ir.ui.menu,name:account_voucher.menu_action_view_cont_voucher_form -msgid "Contra Voucher" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,company_id:0 -msgid "Company" -msgstr "" - -#. module: account_voucher -#: selection:account.move,voucher_type:0 -#: selection:account.voucher,type:0 -#: model:ir.actions.act_window,name:account_voucher.action_view_jour_voucher_form -#: model:ir.ui.menu,name:account_voucher.menu_action_view_jour_voucher_form -msgid "Journal Voucher" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_receipt.drcr:0 -msgid "," -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -msgid "Set to Draft" -msgstr "" - -#. module: account_voucher -#: wizard_button:account.voucher.open,init,open:0 -msgid "Open Voucher Entries" -msgstr "" - -#. module: account_voucher -#: model:ir.model,name:account_voucher.model_account_voucher_line -msgid "Voucher Line" -msgstr "" - -#. module: account_voucher -#: view:account.move:0 -msgid "Total Credit" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,account_id:0 -#: field:account.voucher.line,account_id:0 -msgid "Account" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -msgid "D" -msgstr "" - -#. module: account_voucher -#: field:account.account,level:0 -msgid "Level" -msgstr "" - -#. module: account_voucher -#: view:account.move:0 -msgid "Account Entry Line" -msgstr "" - -#. module: account_voucher -#: view:account.move:0 -msgid "Total Debit" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,amount:0 -#: field:account.voucher.line,amount:0 -#: rml:voucher.cash_amount:0 -msgid "Amount" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Receiver's Signature" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "No." -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Amount (in words) :" -msgstr "" - -#. module: account_voucher -#: field:account.voucher.line,account_analytic_id:0 -msgid "Analytic Account" -msgstr "" - -#. module: account_voucher -#: selection:account.move,voucher_type:0 -#: selection:account.voucher,type:0 -#: selection:account.voucher.open,init,type:0 -#: model:ir.actions.act_window,name:account_voucher.action_view_jour_sale_voucher_form -#: model:ir.ui.menu,name:account_voucher.menu_action_view_jour_sale_voucher_form -msgid "Journal Sale Voucher" -msgstr "" - -#. module: account_voucher -#: model:ir.actions.act_window,name:account_voucher.action_receipt_vou_voucher_list -#: model:ir.ui.menu,name:account_voucher.menu_action_receipt_vou_voucher_list -msgid "Receipt Vouchers" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -msgid "Account :" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "On Account of :" -msgstr "" - -#. module: account_voucher -#: model:ir.actions.act_window,name:account_voucher.action_payments_bankpay_voucher_list -#: model:ir.actions.act_window,name:account_voucher.action_payments_cashpay_voucher_list -#: model:ir.actions.act_window,name:account_voucher.action_payments_voucher_list -#: model:ir.ui.menu,name:account_voucher.menu_action_payments_voucher_list -msgid "Payment Vouchers" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -msgid "Create" -msgstr "" - -#. module: account_voucher -#: selection:account.account,type1:0 -#: selection:account.account.template,type1:0 -msgid "None" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,number:0 -msgid "Number" -msgstr "" - -#. module: account_voucher -#: view:account.move:0 -#: field:account.voucher,state:0 -#: wizard_field:account.voucher.open,init,state:0 -msgid "State" -msgstr "" - -#. module: account_voucher -#: selection:account.account,type1:0 -#: selection:account.account.template,type1:0 -#: selection:account.voucher.line,type:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Debit" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,type:0 -#: field:account.voucher.line,type:0 -msgid "Type" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_voucher_list -msgid "Voucher Entries" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Authorised Signatory" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -#: model:ir.actions.act_window,name:account_voucher.action_voucher_list -msgid "Vouchers" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -#: field:account.voucher.line,voucher_id:0 -#: model:res.request.link,name:account_voucher.req_link_voucher -msgid "Voucher" -msgstr "" - -#. module: account_voucher -#: wizard_view:account.voucher.open,init:0 -#: model:ir.ui.menu,name:account_voucher.menu_wizard_account_voucher_open -msgid "Open Vouchers" -msgstr "" - -#. module: account_voucher -#: constraint:ir.ui.view:0 -msgid "Invalid XML for View Architecture!" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Dated :" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_receipt_cashreceipt_voucher_list -msgid "Cash Receipts" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,partner_id:0 -#: field:account.voucher.line,partner_id:0 -msgid "Partner" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_view_bank_pay_voucher_form -msgid "New Bank Payment" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -#: field:account.voucher,payment_ids:0 -msgid "Voucher Lines" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,currency_id:0 -msgid "Currency" -msgstr "" - -#. module: account_voucher -#: view:account.move:0 -#: field:account.move,narration:0 -#: view:account.voucher:0 -#: field:account.voucher,narration:0 -msgid "Narration" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,reference:0 -msgid "Voucher Reference" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_view_cash_rec_voucher_form -msgid "New Cash Receipt" -msgstr "" - -#. module: account_voucher -#: model:ir.actions.report.xml,name:account_voucher.report_account_voucher_amt -msgid "Voucher Report" -msgstr "" - -#. module: account_voucher -#: field:account.account,open_bal:0 -msgid "Opening Balance" -msgstr "" - -#. module: account_voucher -#: selection:account.voucher,state:0 -#: selection:account.voucher.open,init,state:0 -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Draft" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "PRO-FORMA" -msgstr "" - -#. module: account_voucher -#: model:ir.actions.act_window,name:account_voucher.action_receipt_cashreceipt_voucher_list -msgid "Cash Receipt" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_view_cash_pay_voucher_form -msgid "New Cash Payment" -msgstr "" - -#. module: account_voucher -#: view:account.move:0 -msgid "Optional Information" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -msgid "General Entries" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,date:0 -msgid "Date" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid ":" -msgstr "" - -#. module: account_voucher -#: field:account.account,type1:0 -#: field:account.account.template,type1:0 -msgid "Dr/Cr" -msgstr "" - -#. module: account_voucher -#: model:ir.actions.report.xml,name:account_voucher.report_account_voucher -msgid "Voucher Report (Cr/Dr)" -msgstr "" - -#. module: account_voucher -#: field:account.move,voucher_type:0 -#: wizard_field:account.voucher.open,init,type:0 -msgid "Voucher Type" -msgstr "" - -#. module: account_voucher -#: selection:account.account,type1:0 -#: selection:account.account.template,type1:0 -#: selection:account.voucher.line,type:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Credit" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Through :" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,reference_type:0 -msgid "Reference Type" -msgstr "" - -#. module: account_voucher -#: model:ir.model,name:account_voucher.model_account_voucher -msgid "Accounting Voucher" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,period_id:0 -msgid "Period" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_payments_bankpay_voucher_list -msgid "Bank Payments" -msgstr "" - -#. module: account_voucher -#: view:account.move:0 -msgid "General Information" -msgstr "" - -#. module: account_voucher -#: wizard_field:account.voucher.open,init,period_ids:0 -msgid "Periods" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -#: selection:account.voucher,state:0 -#: wizard_button:account.voucher.open,init,end:0 -#: selection:account.voucher.open,init,state:0 -msgid "Cancel" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -#: selection:account.voucher,state:0 -#: selection:account.voucher.open,init,state:0 -msgid "Pro-forma" -msgstr "" - -#. module: account_voucher -#: constraint:ir.model:0 -msgid "" -"The Object name must start with x_ and not contain any special character !" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -msgid "Other Info" -msgstr "" - -#. module: account_voucher -#: model:ir.module.module,shortdesc:account_voucher.module_meta_information -msgid "Accounting Voucher Entries" -msgstr "" - -#. module: account_voucher -#: field:res.currency,sub_name:0 -msgid "Sub Currency" -msgstr "" - -#. module: account_voucher -#: model:ir.actions.act_window,name:account_voucher.action_other_voucher_list -#: model:ir.ui.menu,name:account_voucher.menu_action_other_voucher_list -msgid "Other Vouchers" -msgstr "" - -#. module: account_voucher -#: field:account.voucher.line,name:0 -msgid "Description" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Canceled" -msgstr "" - -#. module: account_voucher -#: selection:account.move,voucher_type:0 -#: selection:account.voucher,type:0 -#: selection:account.voucher.open,init,type:0 -#: model:ir.actions.act_window,name:account_voucher.action_view_cash_pay_voucher_form -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Cash Payment Voucher" -msgstr "" - -#. module: account_voucher -#: model:ir.actions.act_window,name:account_voucher.action_receipt_bakreceipt_voucher_list -msgid "Bank Receipt" -msgstr "" - -#. module: account_voucher -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "-" -msgstr "" - -#. module: account_voucher -#: selection:account.move,voucher_type:0 -#: selection:account.voucher,type:0 -#: selection:account.voucher.open,init,type:0 -#: model:ir.actions.act_window,name:account_voucher.action_view_jour_pur_voucher_form -#: model:ir.ui.menu,name:account_voucher.menu_action_view_jour_pur_voucher_form -msgid "Journal Purchase Voucher" -msgstr "" - -#. module: account_voucher -#: view:account.account:0 -msgid "Closing Balance" -msgstr "" - -#. module: account_voucher -#: field:account.voucher.line,ref:0 -msgid "Ref." -msgstr "" - -#. module: account_voucher -#: selection:account.voucher,state:0 -#: selection:account.voucher.open,init,state:0 -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Posted" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,name:0 -msgid "Name" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,move_ids:0 -msgid "Real Entry" -msgstr "" - -#. module: account_voucher -#: model:ir.actions.wizard,name:account_voucher.wizard_account_voucher_open -msgid "Open a Voucher Entry" -msgstr "" - -#. module: account_voucher -#: field:account.voucher,move_id:0 -msgid "Account Entry" -msgstr "" - -#. module: account_voucher -#: view:account.voucher:0 -msgid "Entry Lines" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_view_bank_rec_voucher_form -msgid "New Bank Receipt" -msgstr "" - -#. module: account_voucher -#: model:ir.ui.menu,name:account_voucher.menu_action_payments_cashpay_voucher_list -msgid "Cash Payments" -msgstr "" - -#. module: account_voucher -#: selection:account.move,voucher_type:0 -#: selection:account.voucher,type:0 -#: selection:account.voucher.open,init,type:0 -#: model:ir.actions.act_window,name:account_voucher.action_view_cash_rec_voucher_form -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Cash Receipt Voucher" -msgstr "" - -#. module: account_voucher -#: selection:account.move,voucher_type:0 -#: selection:account.voucher,type:0 -#: selection:account.voucher.open,init,type:0 -#: model:ir.actions.act_window,name:account_voucher.action_view_bank_pay_voucher_form -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Bank Payment Voucher" -msgstr "" - -#. module: account_voucher -#: selection:account.move,voucher_type:0 -#: selection:account.voucher,type:0 -#: selection:account.voucher.open,init,type:0 -#: model:ir.actions.act_window,name:account_voucher.action_view_bank_rec_voucher_form -#: rml:voucher.cash_amount:0 -#: rml:voucher.cash_receipt.drcr:0 -msgid "Bank Receipt Voucher" -msgstr "" - -#. module: account_voucher -#: field:account.account,journal_id:0 -#: field:account.voucher,journal_id:0 -msgid "Journal" -msgstr "" From 2a2bb45c5e57a950258887422c637e06a6d2e368 Mon Sep 17 00:00:00 2001 From: "GPA(OpenERP)" <> Date: Mon, 12 Oct 2009 18:03:10 +0530 Subject: [PATCH 031/200] [FIX] Project_timesheet : Wrong synchro on analytic line creation fro tasks(for name). lp bug: https://launchpad.net/bugs/447402 fixed bzr revid: jvo@tinyerp.com-20091012123310-gih8iz51zuxmlxs4 --- addons/project_timesheet/project_timesheet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index 71c3542c010..f914faec86f 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -84,7 +84,7 @@ class project_work(osv.osv): if line_id in list_avail_ids: obj = self.pool.get('hr.analytic.timesheet') if 'name' in vals: - vals_line['name'] = '%s: %s' % (tools.ustr(task.name), tools.ustr(vals['name']) or '/') + vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/') if 'user_id' in vals: vals_line['user_id'] = vals['user_id'] if 'date' in vals: From cbea7944ca8514adc3f1b1465c4f2769fb4c95d2 Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 12 Oct 2009 23:13:39 +0200 Subject: [PATCH 032/200] [FIX] bugfix residual computation and multi-currencies bzr revid: fp@tinyerp.com-20091012211339-nsgw8uawrjj8qmot --- addons/account/invoice.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 559f0a88156..10a54e8bb37 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -103,15 +103,23 @@ class account_invoice(osv.osv): def _amount_residual(self, cr, uid, ids, name, args, context=None): res = {} data_inv = self.browse(cr, uid, ids) + cur_obj = self.pool.get('res.currency') for inv in data_inv: - paid_amt = 0.0 - to_pay = inv.amount_total + debit = credit = 0.0 for lines in inv.move_lines: - if lines.amount_currency and lines.currency_id: - paid_amt += lines.amount_currency + if lines.account_id.company_currency_id.id <> inv.currency_id.id: + if lines.debit: + debit += cur_obj.compute(cr, uid, lines.account_id.company_currency_id.id, inv.currency_id.id, lines.debit) + if lines.credit: + credit += cur_obj.compute(cr, uid, lines.account_id.company_currency_id.id, inv.currency_id.id, lines.credit) else: - paid_amt += lines.credit + lines.debit - res[inv.id] = round(to_pay - abs(paid_amt),int(config['price_accuracy'])) + debit += lines.debit + credit += lines.credit + if inv.type in ('out_invoice','in_refund'): + result = inv.amount_total * (1.0 - credit / (debit + inv.amount_total)) + else: + result = inv.amount_total * (1.0 - debit / (credit + inv.amount_total)) + res[inv.id] = round(result,int(config['price_accuracy'])) return res def _get_lines(self, cr, uid, ids, name, arg, context=None): From f28d004d3a8afb50c2911088b860e7b504b547aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Valyi?= <> Date: Tue, 13 Oct 2009 13:01:44 +0530 Subject: [PATCH 033/200] added pruchase link in product view bzr revid: hda@tinyerp.com-20091013073144-w5g0xgos6czko872 --- addons/purchase/purchase_view.xml | 8 ++++++++ addons/sale/sale.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 2d020bd6180..9e3eda61554 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -233,5 +233,13 @@ name="Purchase orders" res_model="purchase.order" src_model="res.partner"/> + + + diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 0f13e8051d9..30c24f7af25 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -225,7 +225,7 @@ class sale_order(osv.osv): 'project_id': fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, states={'draft': [('readonly', False)]}), 'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)]}), - 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), + 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoices', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."), 'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Related Packing', readonly=True, help="This is the list of picking list that have been generated for this invoice"), 'shipped': fields.boolean('Picked', readonly=True), 'picked_rate': fields.function(_picked_rate, method=True, string='Picked', type='float'), From 6b9040ca8d0be10f1aa65078e0e9da1776c07211 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Tue, 13 Oct 2009 16:34:10 +0200 Subject: [PATCH 034/200] [FIX] account: avoid ZeroDivisionError bzr revid: chs@tinyerp.com-20091013143410-sz59hp38dvv1ufor --- addons/account/invoice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 10a54e8bb37..10a49230480 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -115,7 +115,10 @@ class account_invoice(osv.osv): else: debit += lines.debit credit += lines.credit - if inv.type in ('out_invoice','in_refund'): + + if not inv.amount_total: + result = 0.0 + elif inv.type in ('out_invoice','in_refund'): result = inv.amount_total * (1.0 - credit / (debit + inv.amount_total)) else: result = inv.amount_total * (1.0 - debit / (credit + inv.amount_total)) From e25cb298e097ee0449accc94d0f3b3956d8d59f6 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Tue, 13 Oct 2009 20:15:38 +0530 Subject: [PATCH 035/200] [FIX] Sale : Better error message when account is missing from SOL for Invioce lp bug: https://launchpad.net/bugs/449583 fixed bzr revid: jvo@tinyerp.com-20091013144538-2k7w8zug6xvf3nsd --- addons/sale/sale.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 30c24f7af25..6a9572b547c 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -818,6 +818,9 @@ class sale_order_line(osv.osv): int(config['price_accuracy'])) fpos = line.order_id.fiscal_position or False a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a) + if not a: + raise osv.except_osv(_('Error !'), + _('There is no income category account defined in default Properties for Product Category or Fiscal Position is not defined !')) inv_id = self.pool.get('account.invoice.line').create(cr, uid, { 'name': line.name, 'origin': line.order_id.name, From e92ddd29994f8cd915f4604c3e19f4afc69d9179 Mon Sep 17 00:00:00 2001 From: Quentin De Paoli Date: Tue, 13 Oct 2009 16:50:16 +0200 Subject: [PATCH 036/200] [FIX] hr_expense: corrected error message bzr revid: qdp@cyan-20091013145016-xagtk35k93ip97y7 --- addons/hr_expense/hr_expense.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 0523dcb687c..f0fda12c6c5 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -139,7 +139,7 @@ class hr_expense_expense(osv.osv): 'account_analytic_id': l.analytic_account.id, })) if not exp.employee_id.address_id: - raise osv.except_osv(_('Error !'), _('The employee must have a contact address')) + raise osv.except_osv(_('Error !'), _('The employee must have a working address')) acc = exp.employee_id.address_id.partner_id.property_account_payable.id payment_term_id = exp.employee_id.address_id.partner_id.property_payment_term.id inv = { From 95ec254f709f55e64e50190554fa5004c63aa459 Mon Sep 17 00:00:00 2001 From: "Christophe Chauvet(OpenERP)" <> Date: Tue, 13 Oct 2009 20:42:18 +0530 Subject: [PATCH 037/200] [FIX] Base_report_creator : Allowing to use current userid lp bug: https://launchpad.net/bugs/446391 fixed bzr revid: jvo@tinyerp.com-20091013151218-o1vdbejzd6djq6bt --- addons/base_report_creator/base_report_creator.py | 4 ++-- addons/base_report_creator/base_report_creator_view.xml | 2 ++ addons/base_report_creator/wizard/wiz_set_filter_fields.py | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py index bcca40a153e..79824d227c6 100644 --- a/addons/base_report_creator/base_report_creator.py +++ b/addons/base_report_creator/base_report_creator.py @@ -259,8 +259,8 @@ class report_creator(osv.osv): ret_str = ret_str[0:len(ret_str)-3] if ret_str.endswith('or'): ret_str = ret_str[0:len(ret_str)-2] - ret_str = ret_str.strip() - return ret_str + ret_str = ret_str.strip() + return ret_str % {'uid' : uid} def _id_get(self, cr, uid, id, context): # return 'min(sale_order_line.id)' diff --git a/addons/base_report_creator/base_report_creator_view.xml b/addons/base_report_creator/base_report_creator_view.xml index 7ae858012ed..6c2df4466d6 100644 --- a/addons/base_report_creator/base_report_creator_view.xml +++ b/addons/base_report_creator/base_report_creator_view.xml @@ -86,6 +86,8 @@ + +
+ + + res.partner_bank.form + res.partner.bank + form + + + + + + + + + + res.partner_partner_bank.form + res.partner + form + + + + + + + + + diff --git a/addons/l10n_ch/company.py b/addons/l10n_ch/company.py index 924278cd1a5..312fb1f3264 100755 --- a/addons/l10n_ch/company.py +++ b/addons/l10n_ch/company.py @@ -34,17 +34,17 @@ import netsvc from osv import fields, osv class res_company(osv.osv): - """override company in order to add bvr vertical and - Horizontal print delta""" - _inherit = "res.company" - _columns = { - ### horiz. delta in mm 1.2 will print the bvz 1.2mm lefter - 'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)', - help='horiz. delta in mm 1.2 will print the bvz 1.2mm lefter'), - ### vert. delta in mm 1.2 will print the bvz 1.2mm lefter - 'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)', - help='vert. delta in mm 1.2 will print the bvz 1.2mm lefter'), - } + """override company in order to add bvr vertical and + Horizontal print delta""" + _inherit = "res.company" + _columns = { + ### horiz. delta in mm 1.2 will print the bvz 1.2mm lefter + 'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)', + help='horiz. delta in mm 1.2 will print the bvz 1.2mm lefter'), + ### vert. delta in mm 1.2 will print the bvz 1.2mm lefter + 'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)', + help='vert. delta in mm 1.2 will print the bvz 1.2mm lefter'), + } res_company() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/dta.py b/addons/l10n_ch/dta.py index 435a0b2b18b..e128f12128c 100755 --- a/addons/l10n_ch/dta.py +++ b/addons/l10n_ch/dta.py @@ -34,62 +34,62 @@ import time from osv import osv,fields class account_dta(osv.osv): - """class that implements bank DTA File format, - used to transfert bulk batch payment instruction to a bank""" - _name = "account.dta" - _description = "DTA History" - _columns = { - ### name of the file - 'name': fields.binary('DTA file', readonly=True), - ### list of dta line linked to the dta order - 'dta_line_ids': fields.one2many('account.dta.line','dta_id','DTA lines', readonly=True), - ## textual notes - 'note': fields.text('Creation log', readonly=True, - help="display the problem during dta generation"), - ### bank how will execute DTA order - 'bank': fields.many2one('res.partner.bank','Bank', readonly=True,select=True, - help="bank how will execute DTA order"), - ### date of DTA order generation - 'date': fields.date('Creation Date', readonly=True,select=True, - help="date of DTA order generation"), - ### user how generate the DTA order - 'user_id': fields.many2one('res.users','User', readonly=True, select=True), - } + """class that implements bank DTA File format, + used to transfert bulk batch payment instruction to a bank""" + _name = "account.dta" + _description = "DTA History" + _columns = { + ### name of the file + 'name': fields.binary('DTA file', readonly=True), + ### list of dta line linked to the dta order + 'dta_line_ids': fields.one2many('account.dta.line','dta_id','DTA lines', readonly=True), + ## textual notes + 'note': fields.text('Creation log', readonly=True, + help="display the problem during dta generation"), + ### bank how will execute DTA order + 'bank': fields.many2one('res.partner.bank','Bank', readonly=True,select=True, + help="bank how will execute DTA order"), + ### date of DTA order generation + 'date': fields.date('Creation Date', readonly=True,select=True, + help="date of DTA order generation"), + ### user how generate the DTA order + 'user_id': fields.many2one('res.users','User', readonly=True, select=True), + } account_dta() class account_dta_line(osv.osv): - """Class that represent a DTA order line, - each lin corressponds to a payment instruction""" - _name = "account.dta.line" - _description = "DTA line" - _columns = { - ### name of the line - 'name' : fields.many2one('account.invoice','Invoice', required=True, size=256), - ### partner how will receive payments - 'partner_id' : fields.many2one('res.partner','Partner', - help="Partenr to pay"), - ### due date of the payment - 'due_date' : fields.date('Due date'), - ### date of the supplier invoice to pay - 'invoice_date' : fields.date('Invoice date'), - ### cash discount date - 'cashdisc_date' : fields.date('Cash Discount date'), - ### amount effectively paied on this line - 'amount_to_pay' : fields.float('Amount to pay', - help="amount effectively paid"), - ### amount that was on the supplier invoice - 'amount_invoice': fields.float('Invoiced Amount', - help="amount to pay base on the supplier invoice"), - ### Cash discount amount - 'amount_cashdisc': fields.float('Cash Discount Amount'), - ### Linke to the main dta order - 'dta_id': fields.many2one('account.dta','Associated DTA', required=True, ondelete='cascade'), - ### state of the invoice Drat, Cancel, Done - 'state' : fields.selection([('draft','Draft'),('cancel','Error'),('done','Paid')],'State') - } - _defaults = { - 'state' : lambda *a :'draft', - } + """Class that represent a DTA order line, + each lin corressponds to a payment instruction""" + _name = "account.dta.line" + _description = "DTA line" + _columns = { + ### name of the line + 'name' : fields.many2one('account.invoice','Invoice', required=True, size=256), + ### partner how will receive payments + 'partner_id' : fields.many2one('res.partner','Partner', + help="Partenr to pay"), + ### due date of the payment + 'due_date' : fields.date('Due date'), + ### date of the supplier invoice to pay + 'invoice_date' : fields.date('Invoice date'), + ### cash discount date + 'cashdisc_date' : fields.date('Cash Discount date'), + ### amount effectively paied on this line + 'amount_to_pay' : fields.float('Amount to pay', + help="amount effectively paid"), + ### amount that was on the supplier invoice + 'amount_invoice': fields.float('Invoiced Amount', + help="amount to pay base on the supplier invoice"), + ### Cash discount amount + 'amount_cashdisc': fields.float('Cash Discount Amount'), + ### Linke to the main dta order + 'dta_id': fields.many2one('account.dta','Associated DTA', required=True, ondelete='cascade'), + ### state of the invoice Drat, Cancel, Done + 'state' : fields.selection([('draft','Draft'),('cancel','Error'),('done','Paid')],'State') + } + _defaults = { + 'state' : lambda *a :'draft', + } account_dta_line() diff --git a/addons/l10n_ch/invoice.py b/addons/l10n_ch/invoice.py index 9d5780f003a..b19b74cebe9 100755 --- a/addons/l10n_ch/invoice.py +++ b/addons/l10n_ch/invoice.py @@ -37,176 +37,176 @@ from mx import DateTime class account_invoice(osv.osv): - """Inherit account.invoice in order to add bvr - printing functionnalites. BVR is a Swiss payment vector""" - _inherit = "account.invoice" - - ## @param self The object pointer. - ## @param cursor a psycopg cursor - ## @param user res.user.id that is currently loged - ## @parma context a standard dict - ## @return a list of tuple (name,value) - def _get_reference_type(self, cursor, user, context=None): - """Function use by the function field reference_type in order to initalise available - BVR Reference Types""" - res = super(account_invoice, self)._get_reference_type(cursor, user, - context=context) - res.append(('bvr', 'BVR')) - return res - - ## @param self The object pointer. - ## @param cursor a psycopg cursor - ## @param user res.user.id that is currently loged - ## @parma context a standard dict - ## @param name of the files - ## @param args a list of diverse argument - ## @parma context a standard dict - ## @return a dict (invoice id,amount to pay) - def _amount_to_pay(self, cursor, user, ids, name, args, context=None): - '''Return the amount still to pay regarding all the payment orders''' - if not ids: - return {} - res = {} - for invoice in self.browse(cursor, user, ids, context=context): - res[invoice.id] = 0.0 - if invoice.move_id: - for line in invoice.move_id.line_id: - if not line.date_maturity or \ - DateTime.strptime(line.date_maturity, '%Y-%m-%d') \ - < DateTime.now(): - res[invoice.id] += line.amount_to_pay - return res + """Inherit account.invoice in order to add bvr + printing functionnalites. BVR is a Swiss payment vector""" + _inherit = "account.invoice" + + ## @param self The object pointer. + ## @param cursor a psycopg cursor + ## @param user res.user.id that is currently loged + ## @parma context a standard dict + ## @return a list of tuple (name,value) + def _get_reference_type(self, cursor, user, context=None): + """Function use by the function field reference_type in order to initalise available + BVR Reference Types""" + res = super(account_invoice, self)._get_reference_type(cursor, user, + context=context) + res.append(('bvr', 'BVR')) + return res + + ## @param self The object pointer. + ## @param cursor a psycopg cursor + ## @param user res.user.id that is currently loged + ## @parma context a standard dict + ## @param name of the files + ## @param args a list of diverse argument + ## @parma context a standard dict + ## @return a dict (invoice id,amount to pay) + def _amount_to_pay(self, cursor, user, ids, name, args, context=None): + '''Return the amount still to pay regarding all the payment orders''' + if not ids: + return {} + res = {} + for invoice in self.browse(cursor, user, ids, context=context): + res[invoice.id] = 0.0 + if invoice.move_id: + for line in invoice.move_id.line_id: + if not line.date_maturity or \ + DateTime.strptime(line.date_maturity, '%Y-%m-%d') \ + < DateTime.now(): + res[invoice.id] += line.amount_to_pay + return res - _columns = { - ### BVR reference type BVR or FREE - 'reference_type': fields.selection(_get_reference_type, - 'Reference Type', required=True), - ### Partner bank link between bank and partner id - 'partner_bank': fields.many2one('res.partner.bank', 'Bank Account', - help='The partner bank account to pay\nKeep empty to use the default' - ), - ### Amount to pay - 'amount_to_pay': fields.function(_amount_to_pay, method=True, - type='float', string='Amount to be paid', - help='The amount which should be paid at the current date\n' \ - 'minus the amount which is already in payment order'), - } - - ## @param self The object pointer. - ## @param cursor a psycopg cursor - ## @param user res.user.id that is currently loged - ## @parma ids invoices id - ## @return a boolean True if valid False if invalid - def _check_bvr(self, cr, uid, ids): - """ - Function to validate a bvr reference like : - 0100054150009>132000000000000000000000014+ 1300132412> - The validation is based on l10n_ch - """ - invoices = self.browse(cr,uid,ids) - for invoice in invoices: - if invoice.reference_type == 'bvr': - if not invoice.reference: - return False - ## I need help for this bug because in this case - # <010001000060190> 052550152684006+ 43435> - # the reference 052550152684006 do not match modulo 10 - # - if mod10r(invoice.reference[:-1]) != invoice.reference and \ - len(invoice.reference) == 15: - return True - # - if mod10r(invoice.reference[:-1]) != invoice.reference: - return False - return True - ## @param self The object pointer. - ## @param cursor a psycopg cursor - ## @param user res.user.id that is currently loged - ## @parma ids invoices id - ## @return a boolean True if valid False if invalid - def _check_reference_type(self, cursor, user, ids): - """Check the customer invoice reference type depending - on the BVR reference type and the invoice partner bank type""" - for invoice in self.browse(cursor, user, ids): - if invoice.type in 'in_invoice': - if invoice.partner_bank and \ - invoice.partner_bank.state in \ - ('bvrbank', 'bvrpost') and \ - invoice.reference_type != 'bvr': - return False - return True + _columns = { + ### BVR reference type BVR or FREE + 'reference_type': fields.selection(_get_reference_type, + 'Reference Type', required=True), + ### Partner bank link between bank and partner id + 'partner_bank': fields.many2one('res.partner.bank', 'Bank Account', + help='The partner bank account to pay\nKeep empty to use the default' + ), + ### Amount to pay + 'amount_to_pay': fields.function(_amount_to_pay, method=True, + type='float', string='Amount to be paid', + help='The amount which should be paid at the current date\n' \ + 'minus the amount which is already in payment order'), + } + + ## @param self The object pointer. + ## @param cursor a psycopg cursor + ## @param user res.user.id that is currently loged + ## @parma ids invoices id + ## @return a boolean True if valid False if invalid + def _check_bvr(self, cr, uid, ids): + """ + Function to validate a bvr reference like : + 0100054150009>132000000000000000000000014+ 1300132412> + The validation is based on l10n_ch + """ + invoices = self.browse(cr,uid,ids) + for invoice in invoices: + if invoice.reference_type == 'bvr': + if not invoice.reference: + return False + ## I need help for this bug because in this case + # <010001000060190> 052550152684006+ 43435> + # the reference 052550152684006 do not match modulo 10 + # + if mod10r(invoice.reference[:-1]) != invoice.reference and \ + len(invoice.reference) == 15: + return True + # + if mod10r(invoice.reference[:-1]) != invoice.reference: + return False + return True + ## @param self The object pointer. + ## @param cursor a psycopg cursor + ## @param user res.user.id that is currently loged + ## @parma ids invoices id + ## @return a boolean True if valid False if invalid + def _check_reference_type(self, cursor, user, ids): + """Check the customer invoice reference type depending + on the BVR reference type and the invoice partner bank type""" + for invoice in self.browse(cursor, user, ids): + if invoice.type in 'in_invoice': + if invoice.partner_bank and \ + invoice.partner_bank.state in \ + ('bvrbank', 'bvrpost') and \ + invoice.reference_type != 'bvr': + return False + return True - _constraints = [ - (_check_bvr, 'Error: Invalid Bvr Number (wrong checksum).', - ['reference']), - (_check_reference_type, 'Error: BVR reference is required.', - ['reference_type']), - ] - - ## @param self The object pointer. - ## @param cr a psycopg cursor - ## @param uid res.user.id that is currently loged - ## @parma ids invoices id - ## @parma type the invoice type - ## @param partner_id the partner linked to the invoice - ## @parma date_invoice date of the invoice - ## @parma payment_term inoice payment term - ## @param partner_bank_id the partner linked invoice bank - ## @return the dict of values with the partner_bank value updated - def onchange_partner_id(self, cr, uid, ids, type, partner_id, - date_invoice=False, payment_term=False, partner_bank_id=False): - """ Function that is call when the partner of the invoice is changed - it will retriev and set the good bank partner bank""" - res = super(account_invoice, self).onchange_partner_id( - cr, - uid, - ids, - type, - partner_id, - date_invoice, - payment_term - ) - bank_id = False - if partner_id: - p = self.pool.get('res.partner').browse(cr, uid, partner_id) - if p.bank_ids: - bank_id = p.bank_ids[0].id + _constraints = [ + (_check_bvr, 'Error: Invalid Bvr Number (wrong checksum).', + ['reference']), + (_check_reference_type, 'Error: BVR reference is required.', + ['reference_type']), + ] + + ## @param self The object pointer. + ## @param cr a psycopg cursor + ## @param uid res.user.id that is currently loged + ## @parma ids invoices id + ## @parma type the invoice type + ## @param partner_id the partner linked to the invoice + ## @parma date_invoice date of the invoice + ## @parma payment_term inoice payment term + ## @param partner_bank_id the partner linked invoice bank + ## @return the dict of values with the partner_bank value updated + def onchange_partner_id(self, cr, uid, ids, type, partner_id, + date_invoice=False, payment_term=False, partner_bank_id=False): + """ Function that is call when the partner of the invoice is changed + it will retriev and set the good bank partner bank""" + res = super(account_invoice, self).onchange_partner_id( + cr, + uid, + ids, + type, + partner_id, + date_invoice, + payment_term + ) + bank_id = False + if partner_id: + p = self.pool.get('res.partner').browse(cr, uid, partner_id) + if p.bank_ids: + bank_id = p.bank_ids[0].id - if type in ('in_invoice', 'in_refund'): - res['value']['partner_bank'] = bank_id + if type in ('in_invoice', 'in_refund'): + res['value']['partner_bank'] = bank_id - if partner_bank_id != bank_id: - to_update = self.onchange_partner_bank(cr, uid, ids, bank_id) - res['value'].update(to_update['value']) - return res - - ## @param self The object pointer. - ## @param cursor a psycopg cursor - ## @param user res.user.id that is currently loged - ## @parma ids invoices id - ## @param partner_bank_id the partner linked invoice bank - ## @return the dict of values with the reference type value updated - def onchange_partner_bank(self, cursor, user, ids, partner_bank_id): - """update the reference type depending of the partner bank""" - res = {'value': {}} - partner_bank_obj = self.pool.get('res.partner.bank') - if partner_bank_id: - partner_bank = partner_bank_obj.browse(cursor, user, partner_bank_id) - if partner_bank.state in ('bvrbank', 'bvrpost'): - res['value']['reference_type'] = 'bvr' - return res + if partner_bank_id != bank_id: + to_update = self.onchange_partner_bank(cr, uid, ids, bank_id) + res['value'].update(to_update['value']) + return res + + ## @param self The object pointer. + ## @param cursor a psycopg cursor + ## @param user res.user.id that is currently loged + ## @parma ids invoices id + ## @param partner_bank_id the partner linked invoice bank + ## @return the dict of values with the reference type value updated + def onchange_partner_bank(self, cursor, user, ids, partner_bank_id): + """update the reference type depending of the partner bank""" + res = {'value': {}} + partner_bank_obj = self.pool.get('res.partner.bank') + if partner_bank_id: + partner_bank = partner_bank_obj.browse(cursor, user, partner_bank_id) + if partner_bank.state in ('bvrbank', 'bvrpost'): + res['value']['reference_type'] = 'bvr' + return res account_invoice() class account_tax_code(osv.osv): - """Inherit account tax code in order - to add a Case code""" - _name = 'account.tax.code' - _inherit = "account.tax.code" - _columns = { - ### The case code of the taxt code - 'code': fields.char('Case Code', size=512), - } + """Inherit account tax code in order + to add a Case code""" + _name = 'account.tax.code' + _inherit = "account.tax.code" + _columns = { + ### The case code of the taxt code + 'code': fields.char('Case Code', size=512), + } account_tax_code() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/partner.py b/addons/l10n_ch/partner.py index 4dc9656826c..3ecfeaca670 100755 --- a/addons/l10n_ch/partner.py +++ b/addons/l10n_ch/partner.py @@ -34,13 +34,13 @@ import netsvc from osv import fields, osv class res_partner(osv.osv): - _inherit = 'res.partner' + _inherit = 'res.partner' - _columns = { - 'ref_companies': fields.one2many('res.company', 'partner_id', - 'Companies that refers to partner'), - } - + _columns = { + 'ref_companies': fields.one2many('res.company', 'partner_id', + 'Companies that refers to partner'), + } + res_partner() @@ -48,52 +48,50 @@ res_partner() class res_partner_bank(osv.osv): - _inherit = "res.partner.bank" - _columns = { - 'name': fields.char('Description', size=128, required=True), - 'post_number': fields.char('Post number', size=64), - 'bvr_number': fields.char('BVR account number', size=11), - 'bvr_adherent_num': fields.char('BVR adherent number', size=11), - 'dta_code': fields.char('DTA code', size=5), - } - - def _default_value(self, cursor, user, field, context=None): - if field in ('country_id', 'state_id'): - value = False - else: - value = '' - if not context.get('address', False): - return value - for ham, spam, address in context['address']: - if 'type' in address.keys() : - if address['type'] == 'default': - return address.get(field,False) - elif not address['type']: - value = address.get(field,False) - else : - value = False - return value - - - def name_get(self, cr, uid, ids, context=None): - if not len(ids): - return [] - bank_type_obj = self.pool.get('res.partner.bank.type') + _inherit = "res.partner.bank" + _columns = { + 'name': fields.char('Description', size=128, required=True), + 'post_number': fields.char('Post number', size=64), + 'bvr_number': fields.char('BVR account number', size=11), + 'bvr_adherent_num': fields.char('BVR adherent number', size=11), + 'dta_code': fields.char('DTA code', size=5), + } + +# def _default_value(self, cursor, user, field, context=None): +# if field in ('country_id', 'state_id'): +# value = False +# else: +# value = '' +# if not context.get('address', False): +# return value +# for ham, spam, address in context['address']: +# if 'type' in address.keys() : +# if address['type'] == 'default': +# return address[field] +# elif not address['type']: +# value = address[field] +# else : +# value = False +# return value + + + def name_get(self, cr, uid, ids, context=None): + if not len(ids): + return [] + bank_type_obj = self.pool.get('res.partner.bank.type') - type_ids = bank_type_obj.search(cr, uid, []) - bank_type_names = {} - for bank_type in bank_type_obj.browse(cr, uid, type_ids, - context=context): - bank_type_names[bank_type.code] = bank_type.name - res = [] - for r in self.read(cr, uid, ids, ['name','state'], context): - res.append((r['id'], r['name']+' : '+bank_type_names[r['state']])) - return res - - _sql_constraints = [ - ('bvr_adherent_uniq', 'unique (bvr_adherent_num)', 'The BVR adherent number must be unique !') - ] - - + type_ids = bank_type_obj.search(cr, uid, []) + bank_type_names = {} + for bank_type in bank_type_obj.browse(cr, uid, type_ids, + context=context): + bank_type_names[bank_type.code] = bank_type.name + res = [] + for r in self.read(cr, uid, ids, ['name','state'], context): + res.append((r['id'], r['name']+' : '+bank_type_names[r['state']])) + return res + + _sql_constraints = [ + ('bvr_adherent_uniq', 'unique (bvr_adherent_num)', 'The BVR adherent number must be unique !') + ] res_partner_bank() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/payment.py b/addons/l10n_ch/payment.py index 56420e85046..6da5146f34b 100755 --- a/addons/l10n_ch/payment.py +++ b/addons/l10n_ch/payment.py @@ -34,11 +34,11 @@ from osv import fields from osv import osv class payment_order(osv.osv): - _inherit = 'payment.order' + _inherit = 'payment.order' - def get_wizard(self,mode): - if mode == 'dta': - return 'l10n_ch','wizard_account_dta_create' - return super(payment_order,self).get_wizard(mode) + def get_wizard(self,mode): + if mode == 'dta': + return 'l10n_ch','wizard_account_dta_create' + return super(payment_order,self).get_wizard(mode) payment_order() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/report/bvr.py b/addons/l10n_ch/report/bvr.py index 8804f6c876a..a268f2ac411 100755 --- a/addons/l10n_ch/report/bvr.py +++ b/addons/l10n_ch/report/bvr.py @@ -34,70 +34,92 @@ import time from report import report_sxw from tools import mod10r import re +import os +import sys +import shutil from mx.DateTime import * class account_invoice_bvr(report_sxw.rml_parse): - """Report class that Allows to print BVR payement vector""" - def __init__(self, cr, uid, name, context): - super(account_invoice_bvr, self).__init__(cr, uid, name, context=context) - self.localcontext.update({ - 'time': time, - 'user':self.pool.get("res.users").browse(cr,uid,uid), - 'mod10r': mod10r, - '_space': self._space, - '_get_ref': self._get_ref, - 'comma_me': self.comma_me, - 'format_date': self._get_and_change_date_format_for_swiss, - #'date_invoice': - }) - def _get_and_change_date_format_for_swiss (self,date_to_format): - date_formatted='' - print date_to_format - if date_to_format: - date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') - return date_formatted - - def comma_me(self,amount): - if type(amount) is float : - amount = str('%.2f'%amount) - else : - amount = str(amount) - orig = amount - new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) - if orig == new: - return new - else: - return self.comma_me(new) + """Report class that Allows to print BVR payement vector""" + def __init__(self, cr, uid, name, context): + super(account_invoice_bvr, self).__init__(cr, uid, name, context) + self.copyocrbfile('addons/l10n_ch/report/ocrbb.ttf') + self.localcontext.update({ + 'time': time, + 'user':self.pool.get("res.users").browse(cr,uid,uid), + 'mod10r': mod10r, + '_space': self._space, + '_get_ref': self._get_ref, + 'comma_me': self.comma_me, + 'format_date': self._get_and_change_date_format_for_swiss, + 'police_absolute_path' : self.police_absolute_path, + 'copyocrbfile': self.copyocrbfile + }) + def _get_and_change_date_format_for_swiss (self,date_to_format): + date_formatted='' + print date_to_format + if date_to_format: + date_formatted = strptime(date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y') + return date_formatted + + def police_absolute_path(self, inner_path) : + path = os.path.join(os.path.dirname(sys.argv[0]), inner_path) + return path + + def copyocrbfile(self,file): + src = self.police_absolute_path(file) + file = os.path.basename(src) + dest = os.path.join('/tmp/',file) + if not os.path.isfile(dest): + try: + shutil.copyfile(src,dest) + except: + """print ocrbfile was not copy in /tmp/ please + copy it manually from l10_ch/report""" + + - def _space(self,nbr, nbrspc=5): - res = '' - for i in range(len(nbr)): - res = res + nbr[i] - if not (i-1) % nbrspc: - res = res + ' ' - return res + def comma_me(self,amount): + if type(amount) is float : + amount = str('%.2f'%amount) + else : + amount = str(amount) + orig = amount + new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount) + if orig == new: + return new + else: + return self.comma_me(new) - def _get_ref(self, o): - res = '' - if o.partner_bank.bvr_adherent_num: - res = o.partner_bank.bvr_adherent_num - invoice_number = '' - if o.number: - invoice_number = re.sub('[^0-9]', '0', o.number) - return mod10r(res + invoice_number.rjust(26-len(res), '0')) + def _space(self,nbr, nbrspc=5): + res = '' + for i in range(len(nbr)): + res = res + nbr[i] + if not (i-1) % nbrspc: + res = res + ' ' + return res + + def _get_ref(self, o): + res = '' + if o.partner_bank.bvr_adherent_num: + res = o.partner_bank.bvr_adherent_num + invoice_number = '' + if o.number: + invoice_number = re.sub('[^0-9]', '0', o.number) + return mod10r(res + invoice_number.rjust(26-len(res), '0')) report_sxw.report_sxw( - 'report.l10n_ch.bvr', - 'account.invoice', - 'addons/l10n_ch/report/bvr.rml', - parser=account_invoice_bvr, - header=False) + 'report.l10n_ch.bvr', + 'account.invoice', + 'addons/l10n_ch/report/bvr.rml', + parser=account_invoice_bvr, + header=False) report_sxw.report_sxw( - 'report.l10n_ch.invoice.bvr', - 'account.invoice', - 'addons/l10n_ch/report/invoice.rml', - parser=account_invoice_bvr, - header=False) + 'report.l10n_ch.invoice.bvr', + 'account.invoice', + 'addons/l10n_ch/report/invoice.rml', + parser=account_invoice_bvr, + header=False) # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/report/bvr.rml b/addons/l10n_ch/report/bvr.rml index 72244304e4b..caaa585d835 100755 --- a/addons/l10n_ch/report/bvr.rml +++ b/addons/l10n_ch/report/bvr.rml @@ -1,40 +1,36 @@ - + @@ -116,6 +112,12 @@ --> + [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]] + [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']] + + [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]] + [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']] + [[ user.company_id.partner_id.name ]] [[ user.company_id.partner_id.address[0].street ]] [[ (user.company_id.partner_id.address[0].street2 or '')]] @@ -145,10 +147,11 @@ [[ _space(_get_ref(o)) ]] - + [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]] + [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]] [[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]] [[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]] - + [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]] [[ _space(('%.2f' % o.amount_total)[-2:], 1) + ' ' ]] [[ _space(('%.2f' % o.amount_total)[-2:], 1) + ' ' ]] diff --git a/addons/l10n_ch/report/invoice.rml b/addons/l10n_ch/report/invoice.rml index 4aba63b6986..ce5ef808f2a 100755 --- a/addons/l10n_ch/report/invoice.rml +++ b/addons/l10n_ch/report/invoice.rml @@ -1,41 +1,40 @@ - + + @@ -189,7 +188,7 @@ Invoice Date: - [[format_date(o.date_invoice)]] + [[ o.date_invoice and format_date(o.date_invoice) or '']] Remarque: @@ -248,19 +247,18 @@ - + - [[ repeatIn((l.note and l.note.splitlines()) or [], 'note') ]] + [[ note or removeParentNode('blockTable') ]] - [[ note or removeParentNode('table') ]] + [[ l.note ]] - @@ -328,6 +326,11 @@ --> + [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]] + [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']] + + [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.name or '' ]] + [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.zip or '']] [[ o.partner_bank and o.partner_bank.printBank and o.partner_bank.bank and o.partner_bank.bank.city or '']] [[user.company_id.name]] [[ user.company_id.partner_id.address[0].street ]] [[ (user.company_id.partner_id.address[0].street2 or '')]] @@ -354,10 +357,12 @@ + [[ _space(_get_ref(o)) ]] - + [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]] + [[ o.partner_bank and o.partner_bank.printAccount and o.partner_bank.bvr_number or '' ]] [[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]] [[ _space(('%.2f' % o.amount_total)[:-3], 1) + ' ' ]] @@ -375,4 +380,4 @@ - + \ No newline at end of file diff --git a/addons/l10n_ch/report/tiny_sxw2rml.py b/addons/l10n_ch/report/tiny_sxw2rml.py deleted file mode 100755 index e7a5422b6ec..00000000000 --- a/addons/l10n_ch/report/tiny_sxw2rml.py +++ /dev/null @@ -1,342 +0,0 @@ - - -#!/usr/bin/python -#coding: latin-1 - -############################################################################## -# -# Copyright (c): -# -# 2005 pyopenoffice.py Martin Simon (http://www.bezirksreiter.de) -# 2005 Fabien Pinckaers, TINY SPRL. (http://tiny.be) -# -# WARNING: This program as such is intended to be used by professional -# programmers who take the whole responsability of assessing all potential -# consequences resulting from its eventual inadequacies and bugs -# End users who are looking for a ready-to-use solution with commercial -# garantees and support are strongly adviced to contact a Free Software -# Service Company -# -# This program is Free Software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -############################################################################## - -""" -Tiny SXW2RML - The Tiny ERP's report engine - -Tiny SXW2RMLis part of the Tiny report project. -Tiny Report is a module that allows you to render high quality PDF document -from an OpenOffice template (.sxw) and any relationnal database. - -The whole source code is distributed under the terms of the -GNU Public Licence. - -(c) 2005 pyopenoffice.py Martin Simon (http://www.bezirksreiter.de) -(c) 2005-TODAY, Fabien Pinckaers - Tiny sprl -""" -__version__ = '0.9' - - -import re -import string -import os -import time -import zipfile -import xml.dom.minidom -from reportlab.lib.units import toLength -import optparse - -parser = optparse.OptionParser( - version="Tiny Report v%s" % __version__, - usage = 'tiny_sxw2rml.py [options] file.sxw') -parser.add_option("-v", "--verbose", default=False, dest="verbose", help="enable basic debugging") -parser.add_option("-o", "--output", dest="output", default='.', help="directory of image output") -(opt, args) = parser.parse_args() -if len(args) != 1: - parser.error("incorrect number of arguments") - -class DomApiGeneral: - """General DOM API utilities.""" - def __init__(self,content_string="",file=""): - self.content_string = content_string - self.re_digits = re.compile(r"(.*?\d)(pt|cm|mm|inch|in)") - - def _unitTuple(self,string): - """Split values and units to a tuple.""" - temp = self.re_digits.findall(string) - if not temp: - return (string,"") - else: - return (temp[0]) - - def stringPercentToFloat(self,string): - temp = string.replace("""%""","") - return float(temp)/100 - - def findChildrenByName(self,parent,name,attr_dict={}): - """Helper functions. Does not work recursively. - Optional: also test for certain attribute/value pairs.""" - children = [] - for c in parent.childNodes: - if c.nodeType == c.ELEMENT_NODE and c.nodeName == name: - children.append(c) - if attr_dict == {}: - return children - else: - return self._selectForAttributes(nodelist=children,attr_dict=attr_dict) - - def _selectForAttributes(self,nodelist,attr_dict): - "Helper function.""" - selected_nodes = [] - for n in nodelist: - check = 1 - for a in attr_dict.keys(): - if n.getAttribute(a) != attr_dict[a]: - # at least one incorrect attribute value? - check = 0 - if check: - selected_nodes.append(n) - return selected_nodes - - def _stringToTuple(self,s): - """Helper function.""" - try: - temp = string.split(s,",") - return int(temp[0]),int(temp[1]) - except: - return None - - def _tupleToString(self,t): - try: - return self.openOfficeStringUtf8("%s,%s" % (t[0],t[1])) - except: - return None - - def _lengthToFloat(self,value): - v = value - if not self.re_digits.search(v): - return v - try: - if v[-4:] == "inch": - # OO files use "inch" instead of "in" in Reportlab units - v = v[:-2] - except: - pass - try: - c = round(toLength(v)) - return c - except: - return v - - def openOfficeStringUtf8(self,string): - if type(string) == unicode: - return string.encode("utf-8") - tempstring = unicode(string,"cp1252").encode("utf-8") - return tempstring - -class DomApi(DomApiGeneral): - """This class provides a DOM-API for XML-Files from an SXW-Archive.""" - def __init__(self,xml_content,xml_styles): - DomApiGeneral.__init__(self) - self.content_dom = xml.dom.minidom.parseString(xml_content) - self.styles_dom = xml.dom.minidom.parseString(xml_styles) - body = self.content_dom.getElementsByTagName("office:body") - self.body = body and body[0] - - # TODO: - self.style_dict = {} - self.style_properties_dict = {} - - # ******** always use the following order: - self.buildStyleDict() - self.buildStylePropertiesDict() - - self.page_master = self.styles_dom.getElementsByTagName("style:page-master")[0] - self.document = self.content_dom.getElementsByTagName("office:document-content")[0] - - def buildStylePropertiesDict(self): - for s in self.style_dict.keys(): - self.style_properties_dict[s] = self.getStylePropertiesDict(s) - - def updateWithPercents(self,dict,updatedict): - """Sometimes you find values like "115%" in the style hierarchy.""" - if not updatedict: - # no style hierarchies for this style? => - return - new_updatedict = copy.copy(updatedict) - for u in new_updatedict.keys(): - try: - if new_updatedict[u].find("""%""") != -1 and dict.has_key(u): - number = float(self.re_digits.search(dict[u]).group(1)) - unit = self.re_digits.search(dict[u]).group(2) - new_number = self.stringPercentToFloat(new_updatedict[u]) * number - if unit == "pt": - new_number = int(new_number) - # no floats allowed for "pt" - # OOo just takes the int, does not round (try it out!) - new_updatedict[u] = "%s%s" % (new_number,unit) - else: - dict[u] = new_updatedict[u] - except: - dict[u] = new_updatedict[u] - dict.update(new_updatedict) - - def normalizeStyleProperties(self): - """Transfer all style:style-properties attributes from the - self.style_properties_hierarchical dict to the automatic-styles - from content.xml. Use this function to preprocess content.xml for - XSLT transformations etc.Do not try to implement this function - with XSlT - believe me, it's a terrible task...""" - styles_styles = self.styles_dom.getElementsByTagName("style:style") - automatic_styles = self.content_dom.getElementsByTagName("office:automatic-styles")[0] - for s in styles_styles: - automatic_styles.appendChild(s.cloneNode(deep=1)) - content_styles = self.content_dom.getElementsByTagName("style:style") - # these are the content_styles with styles_styles added!!! - for s in content_styles: - c = self.findChildrenByName(s,"style:properties") - if c == []: - # some derived automatic styles do not have "style:properties": - temp = self.content_dom.createElement("style:properties") - s.appendChild(temp) - c = self.findChildrenByName(s,"style:properties") - c = c[0] - dict = self.style_properties_dict[(s.getAttribute("style:name")).encode("latin-1")] or {} - for attribute in dict.keys(): - c.setAttribute(self.openOfficeStringUtf8(attribute),self.openOfficeStringUtf8(dict[attribute])) - - def transferStylesXml(self): - """Transfer certain sub-trees from styles.xml to the normalized content.xml - (see above). It is not necessary to do this - for example - with paragraph styles. - the "normalized" style properties contain all information needed for - further processing.""" - # TODO: What about table styles etc.? - page_master = self.page_master - outline_styles = self.styles_dom.getElementsByTagName("text:outline-style") - t = self.content_dom.createElement("transferredfromstylesxml") - self.document.insertBefore(t,self.body) - t_new = self.body.previousSibling - try: - t_new.appendChild(page_master.cloneNode(deep=1)) - t_new.appendChild(outline_styles[0].cloneNode(deep=1)) - except: - pass - - def normalizeLength(self): - """Normalize all lengthes to floats (i.e: 1 inch = 72). - Always use this after "normalizeContent" and "transferStyles"!""" - # TODO: The complex attributes of table cell styles are not transferred yet. - #all_styles = self.content_dom.getElementsByTagName("style:properties") - #all_styles += self.content_dom.getElementsByTagName("draw:image") - all_styles = self.content_dom.getElementsByTagName("*") - for s in all_styles: - for x in s._attrs.keys(): - v = s.getAttribute(x) - s.setAttribute(x,"%s" % self._lengthToFloat(v)) - # convert float to string first! - - def normalizeTableColumns(self): - """Handle this strange table:number-columns-repeated attribute.""" - columns = self.content_dom.getElementsByTagName("table:table-column") - for c in columns: - if c.hasAttribute("table:number-columns-repeated"): - number = int(c.getAttribute("table:number-columns-repeated")) - c.removeAttribute("table:number-columns-repeated") - for i in range(number-1): - (c.parentNode).insertBefore(c.cloneNode(deep=1),c) - - def buildStyleDict(self): - """Store all style:style-nodes from content.xml and styles.xml in self.style_dict. - Caution: in this dict the nodes from two dom apis are merged!""" - for st in (self.styles_dom,self.content_dom): - for s in st.getElementsByTagName("style:style"): - name = s.getAttribute("style:name").encode("latin-1") - self.style_dict[name] = s - return True - - def toxml(self): - return self.content_dom.toxml(encoding="utf-8") - - def getStylePropertiesDict(self,style_name): - res = {} - - if self.style_dict[style_name].hasAttribute("style:parent-style-name"): - parent = self.style_dict[style_name].getAttribute("style:parent-style-name").encode("latin-1") - res = self.getStylePropertiesDict(parent) - - childs = self.style_dict[style_name].childNodes - for c in childs: - if c.nodeType == c.ELEMENT_NODE and c.nodeName == "style:properties": - for attr in c._attrs.keys(): - res[attr] = c.getAttribute(attr).encode("latin-1") - return res - -class PyOpenOffice(object): - """This is the main class which provides all functionality.""" - def __init__(self, path='.'): - self.path = path - - def oo_read(self,fname): - z = zipfile.ZipFile(fname,"r") - content = z.read('content.xml') - style = z.read('styles.xml') - all = z.namelist() - for a in all: - if a[:9]=='Pictures/' and len(a)>10: - pic_content = z.read(a) - f=open(os.path.join(self.path, os.path.basename(a)),"wb") - f.write(pic_content) - f.close() - z.close() - return content,style - - def oo_replace(self,content): - regex = [ - (r"]*/>", ""), - #(r"(.*?)", "$1"), - #(r"(.*?)", "$1"), - (r"(.*?)]*/>", "$2"), - ] - for key,val in regex: - content = re.sub(key, val, content) - return content - - def unpackNormalize(self,sourcefile): - c,s = self.oo_read(sourcefile) - c = self.oo_replace(c) - dom = DomApi(c,s) - dom.normalizeStyleProperties() - dom.transferStylesXml() - dom.normalizeLength() - dom.normalizeTableColumns() - new_c = dom.toxml() - return new_c - - -if __name__ == "__main__": - import sys - import libxslt - import libxml2 - - f = sys.argv[1] - tool = PyOpenOffice(opt.output) - res = tool.unpackNormalize(f) - styledoc = libxml2.parseFile('normalized_oo2rml.xsl') - style = libxslt.parseStylesheetDoc(styledoc) - doc = libxml2.parseMemory(res,len(res)) - result = style.applyStylesheet(doc, None) - xml = style.saveResultToString(result) - print xml -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/wizard/bvr_import.py b/addons/l10n_ch/wizard/bvr_import.py index 585e996bbed..d52e5941c69 100755 --- a/addons/l10n_ch/wizard/bvr_import.py +++ b/addons/l10n_ch/wizard/bvr_import.py @@ -39,215 +39,215 @@ from tools.translate import _ ASK_FORM = """
- + """ ASK_FIELDS = { - 'file': { - 'string': 'BVR file', - 'type': 'binary', - 'required': True, - }, + 'file': { + 'string': 'BVR file', + 'type': 'binary', + 'required': True, + }, } def _reconstruct_invoice_ref(cursor, user, reference, context): - ### - id_invoice = False - # On fait d'abord une recherche sur toutes les factures - # we now searhc for company - user_obj=pooler.get_pool(cursor.dbname).get('res.users') - user_current=user_obj.browse(cursor, user, user) - - ## - - cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = " + str(user_current.company_id.id)) - result_invoice = cursor.fetchall() - - for inv_id,inv_name in result_invoice: - inv_name = re.sub('[^0-9]', '0', str(inv_name)) - if inv_name == reference: - id_invoice = inv_id - break - if id_invoice: - cursor.execute('SELECT l.id ' \ - 'FROM account_move_line l, account_invoice i ' \ - 'WHERE l.move_id = i.move_id AND l.reconcile_id is NULL ' \ - 'AND i.id in (' + ','.join([str(x) for x in [id_invoice]]) + ')') - inv_line = [] - for id_line in cursor.fetchall(): - inv_line.append(id_line[0]) - return inv_line - else: - return [] - return True + ### + id_invoice = False + # On fait d'abord une recherche sur toutes les factures + # we now searhc for company + user_obj=pooler.get_pool(cursor.dbname).get('res.users') + user_current=user_obj.browse(cursor, user, user) + + ## + + cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = " + str(user_current.company_id.id)) + result_invoice = cursor.fetchall() + + for inv_id,inv_name in result_invoice: + inv_name = re.sub('[^0-9]', '0', str(inv_name)) + if inv_name == reference: + id_invoice = inv_id + break + if id_invoice: + cursor.execute('SELECT l.id ' \ + 'FROM account_move_line l, account_invoice i ' \ + 'WHERE l.move_id = i.move_id AND l.reconcile_id is NULL ' \ + 'AND i.id in (' + ','.join([str(x) for x in [id_invoice]]) + ')') + inv_line = [] + for id_line in cursor.fetchall(): + inv_line.append(id_line[0]) + return inv_line + else: + return [] + return True def _import(obj, cursor, user, data, context): - pool = pooler.get_pool(cursor.dbname) - statement_line_obj = pool.get('account.bank.statement.line') - statement_reconcile_obj = pool.get('account.bank.statement.reconcile') - move_line_obj = pool.get('account.move.line') - property_obj = pool.get('ir.property') - model_fields_obj = pool.get('ir.model.fields') - attachment_obj = pool.get('ir.attachment') - file = data['form']['file'] - statement_id = data['id'] + pool = pooler.get_pool(cursor.dbname) + statement_line_obj = pool.get('account.bank.statement.line') + statement_reconcile_obj = pool.get('account.bank.statement.reconcile') + move_line_obj = pool.get('account.move.line') + property_obj = pool.get('ir.property') + model_fields_obj = pool.get('ir.model.fields') + attachment_obj = pool.get('ir.attachment') + file = data['form']['file'] + statement_id = data['id'] - records = [] - total_amount = 0 - total_cost = 0 - find_total = False + records = [] + total_amount = 0 + total_cost = 0 + find_total = False - for lines in base64.decodestring(file).split("\n"): - # Manage files without carriage return - while lines: - (line, lines) = (lines[:128], lines[128:]) - record = {} + for lines in base64.decodestring(file).split("\n"): + # Manage files without carriage return + while lines: + (line, lines) = (lines[:128], lines[128:]) + record = {} - if line[0:3] in ('999', '995'): - if find_total: - raise wizard.except_wizard(_('Error'), - _('Too much total record found!')) - find_total = True - if lines: - raise wizard.except_wizard(_('Error'), - _('Record found after total record!')) - amount = float(line[39:49]) + (float(line[49:51]) / 100) - cost = float(line[69:76]) + (float(line[76:78]) / 100) - if line[2] == '5': - amount *= -1 - cost *= -1 + if line[0:3] in ('999', '995'): + if find_total: + raise wizard.except_wizard(_('Error'), + _('Too much total record found!')) + find_total = True + if lines: + raise wizard.except_wizard(_('Error'), + _('Record found after total record!')) + amount = float(line[39:49]) + (float(line[49:51]) / 100) + cost = float(line[69:76]) + (float(line[76:78]) / 100) + if line[2] == '5': + amount *= -1 + cost *= -1 - if round(amount - total_amount, 2) >= 0.01 \ - or round(cost - total_cost, 2) >= 0.01: - raise wizard.except_wizard(_('Error'), - _('Total record different from the computed!')) - if int(line[51:63]) != len(records): - raise wizard.except_wizard(_('Error'), - _('Number record different from the computed!')) - else: - record = { - 'reference': line[12:39], - 'amount': float(line[39:47]) + (float(line[47:49]) / 100), - 'date': time.strftime('%Y-%m-%d', - time.strptime(line[65:71], '%y%m%d')), - 'cost': float(line[96:98]) + (float(line[98:100]) / 100), - } + if round(amount - total_amount, 2) >= 0.01 \ + or round(cost - total_cost, 2) >= 0.01: + raise wizard.except_wizard(_('Error'), + _('Total record different from the computed!')) + if int(line[51:63]) != len(records): + raise wizard.except_wizard(_('Error'), + _('Number record different from the computed!')) + else: + record = { + 'reference': line[12:39], + 'amount': float(line[39:47]) + (float(line[47:49]) / 100), + 'date': time.strftime('%Y-%m-%d', + time.strptime(line[65:71], '%y%m%d')), + 'cost': float(line[96:98]) + (float(line[98:100]) / 100), + } - if record['reference'] != mod10r(record['reference'][:-1]): - raise wizard.except_wizard(_('Error'), - _('Recursive mod10 is invalid for reference: %s') % \ - record['reference']) + if record['reference'] != mod10r(record['reference'][:-1]): + raise wizard.except_wizard(_('Error'), + _('Recursive mod10 is invalid for reference: %s') % \ + record['reference']) - if line[2] == '5': - record['amount'] *= -1 - record['cost'] *= -1 - total_amount += record['amount'] - total_cost += record['cost'] - records.append(record) + if line[2] == '5': + record['amount'] *= -1 + record['cost'] *= -1 + total_amount += record['amount'] + total_cost += record['cost'] + records.append(record) - model_fields_ids = model_fields_obj.search(cursor, user, [ - ('name', 'in', ['property_account_receivable', 'property_account_payable']), - ('model', '=', 'res.partner'), - ], context=context) - property_ids = property_obj.search(cursor, user, [ - ('fields_id', 'in', model_fields_ids), - ('res_id', '=', False), - ], context=context) + model_fields_ids = model_fields_obj.search(cursor, user, [ + ('name', 'in', ['property_account_receivable', 'property_account_payable']), + ('model', '=', 'res.partner'), + ], context=context) + property_ids = property_obj.search(cursor, user, [ + ('fields_id', 'in', model_fields_ids), + ('res_id', '=', False), + ], context=context) - account_receivable = False - account_payable = False - for property in property_obj.browse(cursor, user, property_ids, context=context): - if property.fields_id.name == 'property_account_receivable': - account_receivable = int(property.value.split(',')[1]) - elif property.fields_id.name == 'property_account_payable': - account_payable = int(property.value.split(',')[1]) + account_receivable = False + account_payable = False + for property in property_obj.browse(cursor, user, property_ids, context=context): + if property.fields_id.name == 'property_account_receivable': + account_receivable = int(property.value.split(',')[1]) + elif property.fields_id.name == 'property_account_payable': + account_payable = int(property.value.split(',')[1]) - for record in records: - # Remove the 11 first char because it can be adherent number - # TODO check if 11 is the right number - reference = record['reference'][11:-1].lstrip('0') - values = { - 'name': 'IN '+ reference, - 'date': record['date'], - 'amount': record['amount'], - 'ref': reference, - 'type': (record['amount'] >= 0 and 'customer') or 'supplier', - 'statement_id': statement_id, - } - line_ids = move_line_obj.search(cursor, user, [ - ('ref', 'like', reference), - ('reconcile_id', '=', False), - ('account_id.type', 'in', ['receivable', 'payable']), - ], order='date desc', context=context) - if not line_ids: - line_ids = _reconstruct_invoice_ref(cursor,user,reference,None) - - line2reconcile = False - partner_id = False - account_id = False - for line in move_line_obj.browse(cursor, user, line_ids, context=context): - if line.partner_id.id: - partner_id = line.partner_id.id - if record['amount'] >= 0: - if round(record['amount'] - line.debit, 2) < 0.01: - line2reconcile = line.id - account_id = line.account_id.id - break - else: - if round(line.credit + record['amount'], 2) < 0.01: - line2reconcile = line.id - account_id = line.account_id.id - break - if not account_id: - if record['amount'] >= 0: - account_id = account_receivable - else: - account_id = account_payable - if not account_id : - raise wizard.except_wizard(_('Error'), - _('The properties account payable account receivable')) - values['account_id'] = account_id - values['partner_id'] = partner_id + for record in records: + # Remove the 11 first char because it can be adherent number + # TODO check if 11 is the right number + reference = record['reference'][11:-1].lstrip('0') + values = { + 'name': 'IN '+ reference, + 'date': record['date'], + 'amount': record['amount'], + 'ref': reference, + 'type': (record['amount'] >= 0 and 'customer') or 'supplier', + 'statement_id': statement_id, + } + line_ids = move_line_obj.search(cursor, user, [ + ('ref', 'like', reference), + ('reconcile_id', '=', False), + ('account_id.type', 'in', ['receivable', 'payable']), + ], order='date desc', context=context) + if not line_ids: + line_ids = _reconstruct_invoice_ref(cursor,user,reference,None) + + line2reconcile = False + partner_id = False + account_id = False + for line in move_line_obj.browse(cursor, user, line_ids, context=context): + if line.partner_id.id: + partner_id = line.partner_id.id + if record['amount'] >= 0: + if round(record['amount'] - line.debit, 2) < 0.01: + line2reconcile = line.id + account_id = line.account_id.id + break + else: + if round(line.credit + record['amount'], 2) < 0.01: + line2reconcile = line.id + account_id = line.account_id.id + break + if not account_id: + if record['amount'] >= 0: + account_id = account_receivable + else: + account_id = account_payable + if not account_id : + raise wizard.except_wizard(_('Error'), + _('The properties account payable account receivable')) + values['account_id'] = account_id + values['partner_id'] = partner_id - if line2reconcile: - values['reconcile_id'] = statement_reconcile_obj.create(cursor, user, { - 'line_ids': [(6, 0, [line2reconcile])], - }, context=context) + if line2reconcile: + values['reconcile_id'] = statement_reconcile_obj.create(cursor, user, { + 'line_ids': [(6, 0, [line2reconcile])], + }, context=context) - statement_line_obj.create(cursor, user, values, context=context) - attachment_obj.create(cursor, user, { - 'name': 'BVR', - 'datas': file, - 'datas_fname': 'BVR.txt', - 'res_model': 'account.bank.statement', - 'res_id': statement_id, - }, context=context) - return {} + statement_line_obj.create(cursor, user, values, context=context) + attachment_obj.create(cursor, user, { + 'name': 'BVR', + 'datas': file, + 'datas_fname': 'BVR.txt', + 'res_model': 'account.bank.statement', + 'res_id': statement_id, + }, context=context) + return {} class BVRImport(wizard.interface): - states = { - 'init': { - 'actions': [], - 'result': { - 'type': 'form', - 'arch': ASK_FORM, - 'fields': ASK_FIELDS, - 'state': [ - ('end', 'Cancel', 'gtk-cancel'), - ('import', 'Import', 'gtk-ok', True), - ], - }, - }, - 'import': { - 'actions': [], - 'result': { - 'type': 'action', - 'action': _import, - 'state': 'end', - }, - }, - } + states = { + 'init': { + 'actions': [], + 'result': { + 'type': 'form', + 'arch': ASK_FORM, + 'fields': ASK_FIELDS, + 'state': [ + ('end', 'Cancel', 'gtk-cancel'), + ('import', 'Import', 'gtk-ok', True), + ], + }, + }, + 'import': { + 'actions': [], + 'result': { + 'type': 'action', + 'action': _import, + 'state': 'end', + }, + }, + } BVRImport('l10n_ch.bvr_import') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/wizard/dta_wizard.py b/addons/l10n_ch/wizard/dta_wizard.py index fe148c0810a..53bd0d94405 100755 --- a/addons/l10n_ch/wizard/dta_wizard.py +++ b/addons/l10n_ch/wizard/dta_wizard.py @@ -41,558 +41,568 @@ from tools.translate import _ FORM = """
- + """ FIELDS = { - 'dta': { - 'string': 'DTA File', - 'type': 'binary', - 'readonly': True, - }, + 'dta': { + 'string': 'DTA File', + 'type': 'binary', + 'readonly': True, + }, } TRANS=[ - (u'é','e'), - (u'è','e'), - (u'à','a'), - (u'ê','e'), - (u'î','i'), - (u'ï','i'), - (u'â','a'), - (u'ä','a'), + (u'é','e'), + (u'è','e'), + (u'à','a'), + (u'ê','e'), + (u'î','i'), + (u'ï','i'), + (u'â','a'), + (u'ä','a'), ] -def tr(s): - s= s.decode('utf-8') - for k in TRANS: - s = s.replace(k[0],k[1]) - try: - res= s.encode('ascii','replace') - except: - res = s - return res +def tr(string_in): + try: + string_in= string_in.decode('utf-8') + except: + # If exception => then just take the string as is + pass + for k in TRANS: + string_in = string_in.replace(k[0],k[1]) + try: + res= string_in.encode('ascii','replace') + except: + res = string_in + return res class record: - def __init__(self, global_context_dict): - for i in global_context_dict: - global_context_dict[i] = global_context_dict[i] \ - and tr(global_context_dict[i]) - self.fields = [] - self.global_values = global_context_dict - self.pre = { - 'padding': '', - 'seg_num1': '01', - 'seg_num2': '02', - 'seg_num3': '03', - 'seg_num4': '04', - 'seg_num5': '05', - 'flag': '0', - 'zero5': '00000' - } - self.post={'date_value_hdr': '000000', 'type_paiement': '0'} - self.init_local_context() + def __init__(self, global_context_dict): + for i in global_context_dict: + global_context_dict[i] = global_context_dict[i] \ + and tr(global_context_dict[i]) + self.fields = [] + self.global_values = global_context_dict + self.pre = { + 'padding': '', + 'seg_num1': '01', + 'seg_num2': '02', + 'seg_num3': '03', + 'seg_num4': '04', + 'seg_num5': '05', + 'flag': '0', + 'zero5': '00000' + } + self.post={'date_value_hdr': '000000', 'type_paiement': '0'} + self.init_local_context() - def init_local_context(self): - """ - Must instanciate a fields list, field = (name,size) - and update a local_values dict. - """ - raise _('not implemented') + def init_local_context(self): + """ + Must instanciate a fields list, field = (name,size) + and update a local_values dict. + """ + raise _('not implemented') - def generate(self): - res='' - for field in self.fields : - if self.pre.has_key(field[0]): - value = self.pre[field[0]] - elif self.global_values.has_key(field[0]): - value = self.global_values[field[0]] - elif self.post.has_key(field[0]): - value = self.post[field[0]] - else : - pass - #raise Exception(field[0]+' not found !') - try: - res = res + c_ljust(value, field[1]) - except : - pass - return res + def generate(self): + res='' + for field in self.fields : + if self.pre.has_key(field[0]): + value = self.pre[field[0]] + elif self.global_values.has_key(field[0]): + value = self.global_values[field[0]] + elif self.post.has_key(field[0]): + value = self.post[field[0]] + else : + pass + #raise Exception(field[0]+' not found !') + try: + res = res + c_ljust(value, field[1]) + except : + pass + return res class record_gt826(record): - """ - bvr - """ - def init_local_context(self): - self.fields=[ - ('seg_num1', 2), - #header - ('date_value_hdr', 6), - ('partner_bank_clearing', 12), - ('zero5', 5), - ('creation_date', 6), - ('comp_bank_clearing', 7), - ('uid', 5), - ('sequence', 5), - ('genre_trans', 3), - ('type_paiement', 1), - ('flag', 1), - #seg1 - ('comp_dta', 5), - ('number', 11), - ('comp_bank_iban', 24), - ('date_value', 6), - ('currency', 3), - ('amount_to_pay', 12), - ('padding', 14), - #seg2 - ('seg_num2', 2), - ('comp_name', 20), - ('comp_street', 20), - ('comp_zip', 10), - ('comp_city', 10), - ('comp_country', 20), - ('padding', 46), - #seg3 - ('seg_num3', 2), - ('partner_bvr', 12),#numero d'adherent bvr - ('partner_name', 20), - ('partner_street', 20), - ('partner_zip', 10), - ('partner_city', 10), - ('partner_country', 20), - ('reference', 27),#communication structuree - ('padding', 2),#cle de controle - ('padding', 5) - ] - self.pre.update({ - 'date_value_hdr': self.global_values['date_value'], - 'date_value': '', - 'partner_bank_clearing': '', - 'partner_cpt_benef': '', - 'genre_trans': '826', - 'conv_cours': '', - 'option_id_bank': 'D', - 'partner_bvr': '/C/'+ self.global_values['partner_bvr'], - 'ref2': '', - 'ref3': '', - 'format': '0', - }) + """ + bvr + """ + def init_local_context(self): + self.fields=[ + ('seg_num1', 2), + #header + ('date_value_hdr', 6), + ('partner_bank_clearing', 12), + ('zero5', 5), + ('creation_date', 6), + ('comp_bank_clearing', 7), + ('uid', 5), + ('sequence', 5), + ('genre_trans', 3), + ('type_paiement', 1), + ('flag', 1), + #seg1 + ('comp_dta', 5), + ('number', 11), + ('comp_bank_iban', 24), + ('date_value', 6), + ('currency', 3), + ('amount_to_pay', 12), + ('padding', 14), + #seg2 + ('seg_num2', 2), + ('comp_name', 20), + ('comp_street', 20), + ('comp_zip', 10), + ('comp_city', 10), + ('comp_country', 20), + ('padding', 46), + #seg3 + ('seg_num3', 2), + ('partner_bvr', 12),#numero d'adherent bvr + ('partner_name', 20), + ('partner_street', 20), + ('partner_zip', 10), + ('partner_city', 10), + ('partner_country', 20), + ('reference', 27),#communication structuree + ('padding', 2),#cle de controle + ('padding', 5) + ] + self.pre.update({ + 'date_value_hdr': self.global_values['date_value'], + 'date_value': '', + 'partner_bank_clearing': '', + 'partner_cpt_benef': '', + 'genre_trans': '826', + 'conv_cours': '', + 'option_id_bank': 'D', + 'partner_bvr': '/C/'+ self.global_values['partner_bvr'], + 'ref2': '', + 'ref3': '', + 'format': '0', + }) class record_gt827(record): - """ - interne suisse (bvpost et bvbank) - """ - def init_local_context(self): - self.fields = [ - ('seg_num1', 2), - #header - ('date_value_hdr', 6), - ('partner_bank_clearing', 12), - ('zero5', 5), - ('creation_date', 6), - ('comp_bank_clearing', 7), - ('uid', 5), - ('sequence', 5), - ('genre_trans', 3), - ('type_paiement', 1), - ('flag', 1), - #seg1 - ('comp_dta', 5), - ('number', 11), - ('comp_bank_iban', 24), - ('date_value', 6), - ('currency', 3), - ('amount_to_pay', 12), - ('padding', 14), - #seg2 - ('seg_num2', 2), - ('comp_name', 20), - ('comp_street', 20), - ('comp_zip', 10), - ('comp_city', 10), - ('comp_country', 20), - ('padding', 46), - #seg3 - ('seg_num3', 2), - ('partner_bank_number', 30), - ('partner_name', 24), - ('partner_street', 24), - ('partner_zip', 12), - ('partner_city', 12), - ('partner_country', 24), - #seg4 - ('seg_num4', 2), - ('reference', 112), - ('padding', 14), - #seg5 - #('padding',128) - ] + """ + interne suisse (bvpost et bvbank) + """ + def init_local_context(self): + self.fields = [ + ('seg_num1', 2), + #header + ('date_value_hdr', 6), + ('partner_bank_clearing', 12), + ('zero5', 5), + ('creation_date', 6), + ('comp_bank_clearing', 7), + ('uid', 5), + ('sequence', 5), + ('genre_trans', 3), + ('type_paiement', 1), + ('flag', 1), + #seg1 + ('comp_dta', 5), + ('number', 11), + ('comp_bank_iban', 24), + ('date_value', 6), + ('currency', 3), + ('amount_to_pay', 12), + ('padding', 14), + #seg2 + ('seg_num2', 2), + ('comp_name', 20), + ('comp_street', 20), + ('comp_zip', 10), + ('comp_city', 10), + ('comp_country', 20), + ('padding', 46), + #seg3 + ('seg_num3', 2), + ('partner_bank_number', 30), + ('partner_name', 24), + ('partner_street', 24), + ('partner_zip', 12), + ('partner_city', 12), + ('partner_country', 24), + #seg4 + ('seg_num4', 2), + ('reference', 112), + ('padding', 14), + #seg5 + #('padding',128) + ] - self.pre.update({ - 'date_value_hdr': self.global_values['date_value'], - 'date_value': '', - 'partner_cpt_benef': '', - 'type_paiement': '0', - 'genre_trans': '827', - 'conv_cours': '', - 'option_id_bank': 'D', - 'ref2': '', - 'ref3': '', - 'format': '0' - }) + self.pre.update({ + 'date_value_hdr': self.global_values['date_value'], + 'date_value': '', + 'partner_cpt_benef': '', + 'type_paiement': '0', + 'genre_trans': '827', + 'conv_cours': '', + 'option_id_bank': 'D', + 'ref2': '', + 'ref3': '', + 'format': '0' + }) class record_gt836(record): - """ - iban - """ - def init_local_context(self): - self.fields = [ - ('seg_num1', 2), - #header - ('date_value_hdr', 6), - ('partner_bank_clearing', 12), - ('zero5', 5), - ('creation_date', 6), - ('comp_bank_clearing', 7), - ('uid', 5), - ('sequence', 5), - ('genre_trans', 3), - ('type_paiement', 1), - ('flag', 1), - #seg1 - ('comp_dta', 5), - ('number', 11), - ('comp_bank_iban', 24), - ('date_value', 6), - ('currency', 3), - ('amount_to_pay', 15), - ('padding', 11), - #seg2 - ('seg_num2', 2), - ('conv_cours', 12), - ('comp_name', 35), - ('comp_street', 35), - ('comp_country', 3), - ('comp_zip', 10), - ('comp_city', 22), - ('padding', 9), - #seg3 - ('seg_num3', 2), - ('option_id_bank', 1), - ('partner_bank_ident', 70), - ('partner_bank_iban', 34), - ('padding', 21), - #seg4 - ('seg_num4', 2), - ('partner_name', 35), - ('partner_street', 35), - ('partner_country', 3), - ('partner_zip', 10), - ('partner_city', 22), - ('padding', 21), - #seg5 - ('seg_num5', 2), - ('option_motif', 1), - ('reference', 105), - ('format', 1), - ('padding', 19) - ] - self.pre.update( { - 'partner_bank_clearing': '', - 'partner_cpt_benef': '', - 'type_paiement': '0', - 'genre_trans': '836', - 'conv_cours': '', - 'reference': self.global_values['reference'], - 'ref2': '', - 'ref3': '', - 'format': '2' - }) - self.post.update({'option_motif': 'U'}) + """ + iban + """ + def init_local_context(self): + self.fields = [ + ('seg_num1', 2), + #header + ('date_value_hdr', 6), + ('partner_bank_clearing', 12), + ('zero5', 5), + ('creation_date', 6), + ('comp_bank_clearing', 7), + ('uid', 5), + ('sequence', 5), + ('genre_trans', 3), + ('type_paiement', 1), + ('flag', 1), + #seg1 + ('comp_dta', 5), + ('number', 11), + ('comp_bank_iban', 24), + ('date_value', 6), + ('currency', 3), + ('amount_to_pay', 15), + ('padding', 11), + #seg2 + ('seg_num2', 2), + ('conv_cours', 12), + ('comp_name', 35), + ('comp_street', 35), + ('comp_country', 3), + ('comp_zip', 10), + ('comp_city', 22), + ('padding', 9), + #seg3 + ('seg_num3', 2), + ('option_id_bank', 1), + ('partner_bank_ident', 70), + ('partner_bank_iban', 34), + ('padding', 21), + #seg4 + ('seg_num4', 2), + ('partner_name', 35), + ('partner_street', 35), + ('partner_country', 3), + ('partner_zip', 10), + ('partner_city', 22), + ('padding', 21), + #seg5 + ('seg_num5', 2), + ('option_motif', 1), + ('reference', 105), + ('format', 1), + ('padding', 19) + ] + self.pre.update( { + 'partner_bank_clearing': '', + 'partner_cpt_benef': '', + 'type_paiement': '0', + 'genre_trans': '836', + 'conv_cours': '', + 'reference': self.global_values['reference'], + 'ref2': '', + 'ref3': '', + 'format': '2' + }) + self.post.update({'option_motif': 'U'}) class record_gt890(record): - """ - Total - """ - def init_local_context(self): - self.fields = [ - ('seg_num1', 2), - #header - ('date_value_hdr', 6), - ('partner_bank_clearing', 12), - ('zero5', 5), - ('creation_date', 6), - ('comp_bank_clearing', 7), - ('uid', 5), - ('sequence', 5), - ('genre_trans', 3), - ('type_paiement', 1), - ('flag', 1), - #total - ('amount_total', 16), - ('padding', 59) - ] - self.pre.update({'partner_bank_clearing': '', 'partner_cpt_benef': '', - 'company_bank_clearing': '', 'genre_trans': '890'}) + """ + Total + """ + def init_local_context(self): + self.fields = [ + ('seg_num1', 2), + #header + ('date_value_hdr', 6), + ('partner_bank_clearing', 12), + ('zero5', 5), + ('creation_date', 6), + ('comp_bank_clearing', 7), + ('uid', 5), + ('sequence', 5), + ('genre_trans', 3), + ('type_paiement', 1), + ('flag', 1), + #total + ('amount_total', 16), + ('padding', 59) + ] + self.pre.update({'partner_bank_clearing': '', 'partner_cpt_benef': '', + 'company_bank_clearing': '', 'genre_trans': '890'}) def c_ljust(s, size): - """ - check before calling ljust - """ - s= s or '' - if len(s) > size: - s= s[:size] - s = s.decode('utf-8').encode('latin1','replace').ljust(size) - return s + """ + check before calling ljust + """ + s= s or '' + if len(s) > size: + s= s[:size] + s = s.decode('utf-8').encode('latin1','replace').ljust(size) + return s def _create_dta(obj, cr, uid, data, context): - v={} - v['uid'] = str(uid) - v['creation_date']= time.strftime('%y%m%d') - dta='' + v={} + v['uid'] = str(uid) + v['creation_date']= time.strftime('%y%m%d') + dta='' - pool = pooler.get_pool(cr.dbname) - payment_obj = pool.get('payment.order') - attachment_obj = pool.get('ir.attachment') + pool = pooler.get_pool(cr.dbname) + payment_obj = pool.get('payment.order') + attachment_obj = pool.get('ir.attachment') - payment = payment_obj.browse(cr, uid, data['id'], context=context) + payment = payment_obj.browse(cr, uid, data['id'], context=context) - if not payment.mode or payment.mode.type.code != 'dta': - raise wizard.except_wizard(_('Error'), - _('No payment mode or payment type code invalid.')) - bank = payment.mode.bank_id - if not bank: - raise wizard.except_wizard(_('Error'), _('No bank account for the company.')) + if not payment.mode or payment.mode.type.code != 'dta': + raise wizard.except_wizard(_('Error'), + _('No payment mode or payment type code invalid.')) + bank = payment.mode.bank_id + if not bank: + raise wizard.except_wizard(_('Error'), _('No bank account for the company.')) - v['comp_bank_name']= bank.bank and bank.bank.name or False - v['comp_bank_clearing'] = bank.bank.clearing + v['comp_bank_name']= bank.bank and bank.bank.name or False + v['comp_bank_clearing'] = bank.bank.clearing - if not v['comp_bank_clearing']: - raise wizard.except_wizard(_('Error'), - _('You must provide a Clearing Number for your bank account.')) + if not v['comp_bank_clearing']: + raise wizard.except_wizard(_('Error'), + _('You must provide a Clearing Number for your bank account.')) - user = pool.get('res.users').browse(cr,uid,[uid])[0] - company= user.company_id - #XXX dirty code use get_addr - co_addr= company.partner_id.address[0] - v['comp_country'] = co_addr.country_id and co_addr.country_id.name or '' - v['comp_street'] = co_addr.street or '' - v['comp_zip'] = co_addr.zip - v['comp_city'] = co_addr.city - v['comp_name'] = co_addr.name - v['comp_dta'] = bank.dta_code or '' #XXX not mandatory in pratice + user = pool.get('res.users').browse(cr,uid,[uid])[0] + company= user.company_id + #XXX dirty code use get_addr + co_addr= company.partner_id.address[0] + v['comp_country'] = co_addr.country_id and co_addr.country_id.name or '' + v['comp_street'] = co_addr.street or '' + v['comp_zip'] = co_addr.zip + v['comp_city'] = co_addr.city + v['comp_name'] = co_addr.name + v['comp_dta'] = bank.dta_code or '' #XXX not mandatory in pratice - v['comp_bank_number'] = bank.acc_number or '' - if bank.iban: - v['comp_bank_iban'] = bank.iban.replace(' ','') or '' - else: - v['comp_bank_iban'] = '' - if not v['comp_bank_iban']: - raise wizard.except_wizard(_('Error'), - _('No IBAN for the company bank account.')) + v['comp_bank_number'] = bank.acc_number or '' + if bank.iban: + v['comp_bank_iban'] = bank.iban.replace(' ','') or '' + else: + v['comp_bank_iban'] = '' + if not v['comp_bank_iban']: + raise wizard.except_wizard(_('Error'), + _('No IBAN for the company bank account.')) - dta_line_obj = pool.get('account.dta.line') - res_partner_bank_obj = pool.get('res.partner.bank') + dta_line_obj = pool.get('account.dta.line') + res_partner_bank_obj = pool.get('res.partner.bank') - seq= 1 - amount_tot = 0 - amount_currency_tot = 0 + seq= 1 + amount_tot = 0 + amount_currency_tot = 0 - for pline in payment.line_ids: - if not pline.bank_id: - raise wizard.except_wizard(_('Error'), _('No bank account defined\n' \ - 'on line: %s') % pline.name) - if not pline.bank_id.bank: - raise wizard.except_wizard(_('Error'), _('No bank defined\n' \ - 'for the bank account: %s\n' \ - 'on the partner: %s\n' \ - 'on line: %s') + (pline.bank_id.state, pline.partner_id.name, pline.name)) + for pline in payment.line_ids: + if not pline.bank_id: + raise wizard.except_wizard(_('Error'), _('No bank account defined\n' \ + 'on line: %s') % pline.name) + if not pline.bank_id.bank: + raise wizard.except_wizard(_('Error'), _('No bank defined\n' \ + 'for the bank account: %s\n' \ + 'on the partner: %s\n' \ + 'on line: %s') + (pline.bank_id.state, pline.partner_id.name, pline.name)) - v['sequence'] = str(seq).rjust(5).replace(' ', '0') - v['amount_to_pay']= str(pline.amount_currency).replace('.', ',') - v['number'] = pline.name - v['currency'] = pline.currency.code + v['sequence'] = str(seq).rjust(5).replace(' ', '0') + v['amount_to_pay']= str(pline.amount_currency).replace('.', ',') + v['number'] = pline.name + v['currency'] = pline.currency.code - v['partner_bank_name'] = pline.bank_id.bank.name or False - v['partner_bank_clearing'] = pline.bank_id.bank.clearing or False - if not v['partner_bank_name'] : - raise wizard.except_wizard(_('Error'), _('No bank name defined\n' \ - 'for the bank account: %s\n' \ - 'on the partner: %s\n' \ - 'on line: %s') % (pline.bank_id.state, pline.partner_id.name, pline.name)) + v['partner_bank_name'] = pline.bank_id.bank.name or False + v['partner_bank_clearing'] = pline.bank_id.bank.clearing or False + if not v['partner_bank_name'] : + raise wizard.except_wizard(_('Error'), _('No bank name defined\n' \ + 'for the bank account: %s\n' \ + 'on the partner: %s\n' \ + 'on line: %s') % (pline.bank_id.state, pline.partner_id.name, pline.name)) - v['partner_bank_iban']= pline.bank_id.iban or False - v['partner_bank_number']= pline.bank_id.acc_number \ - and pline.bank_id.acc_number.replace('.','').replace('-','') \ - or False - v['partner_post_number']= pline.bank_id.post_number \ - and pline.bank_id.post_number.replace('.', '').replace('-', '') \ - or False - v['partner_bvr'] = pline.bank_id.bvr_number or '' - if v['partner_bvr']: - v['partner_bvr'] = v['partner_bvr'].replace('-','') - if len(v['partner_bvr']) < 9: - v['partner_bvr'] = v['partner_bvr'][:2] + '0' * \ - (9 - len(v['partner_bvr'])) + v['partner_bvr'][2:] + v['partner_bank_iban']= pline.bank_id.iban or False + v['partner_bank_number']= pline.bank_id.acc_number \ + and pline.bank_id.acc_number.replace('.','').replace('-','') \ + or False + v['partner_post_number']= pline.bank_id.post_number \ + and pline.bank_id.post_number.replace('.', '').replace('-', '') \ + or False + v['partner_bvr'] = pline.bank_id.bvr_number or '' + if v['partner_bvr']: + v['partner_bvr'] = v['partner_bvr'].replace('-','') + if len(v['partner_bvr']) < 9: + v['partner_bvr'] = v['partner_bvr'][:2] + '0' * \ + (9 - len(v['partner_bvr'])) + v['partner_bvr'][2:] - if pline.bank_id.bank: - v['partner_bank_city'] = pline.bank_id.bank.city or False - v['partner_bank_street'] = pline.bank_id.bank.street or '' - v['partner_bank_zip'] = pline.bank_id.bank.zip or '' - v['partner_bank_country'] = pline.bank_id.bank.country and \ - pline.bank_id.bank.country.name or '' + if pline.bank_id.bank: + v['partner_bank_city'] = pline.bank_id.bank.city or False + v['partner_bank_street'] = pline.bank_id.bank.street or '' + v['partner_bank_zip'] = pline.bank_id.bank.zip or '' + v['partner_bank_country'] = pline.bank_id.bank.country and \ + pline.bank_id.bank.country.name or '' - v['partner_bank_code'] = pline.bank_id.bank.bic - v['reference'] = pline.move_line_id.ref - v['partner_name'] = pline.partner_id and pline.partner_id.name or '' - if pline.partner_id and pline.partner_id.address \ - and pline.partner_id.address[0]: - v['partner_street'] = pline.partner_id.address[0].street - v['partner_city']= pline.partner_id.address[0].city - v['partner_zip']= pline.partner_id.address[0].zip - # If iban => country=country code for space reason - elec_pay = pline.bank_id.state #Bank type - if elec_pay == 'iban': - v['partner_country']= pline.partner_id.address[0].country_id \ - and pline.partner_id.address[0].country_id.code+'-' \ - or '' - else: - v['partner_country']= pline.partner_id.address[0].country_id \ - and pline.partner_id.address[0].country_id.name \ - or '' - else: - v['partner_street'] ='' - v['partner_city']= '' - v['partner_zip']= '' - v['partner_country']= '' - raise wizard.except_wizard(_('Error'), _('No address defined \n' \ - 'for the partner: %s\n' \ - 'on line: %s') % (pline.partner_id.name, pline.name)) + v['partner_bank_code'] = pline.bank_id.bank.bic + v['reference'] = pline.move_line_id.ref + # Add support for owner of the account if exists.. + if pline.bank_id.owner_name: + v['partner_name'] = pline.bank_id.owner_name + else: + v['partner_name'] = pline.partner_id and pline.partner_id.name or '' + + if pline.partner_id and pline.partner_id.address \ + and pline.partner_id.address[0]: + v['partner_street'] = pline.partner_id.address[0].street + v['partner_city']= pline.partner_id.address[0].city + v['partner_zip']= pline.partner_id.address[0].zip + # If iban => country=country code for space reason + elec_pay = pline.bank_id.state #Bank type + if elec_pay == 'iban': + v['partner_country']= pline.partner_id.address[0].country_id \ + and pline.partner_id.address[0].country_id.code+'-' \ + or '' + else: + v['partner_country']= pline.partner_id.address[0].country_id \ + and pline.partner_id.address[0].country_id.name \ + or '' + else: + v['partner_street'] ='' + v['partner_city']= '' + v['partner_zip']= '' + v['partner_country']= '' + raise wizard.except_wizard('Error', 'No address defined \n' \ + 'for the partner: ' + pline.partner_id.name + '\n' \ + 'on line: ' + pline.name) - if pline.order_id.date_planned : - date_value = mx.DateTime.strptime(pline.order_id.date_planned, '%Y-%m-%d') - elif pline.date : - date_value = mx.DateTime.strptime(pline.date, '%Y-%m-%d') - else : - date_value = mx.DateTime.now() - v['date_value'] = date_value.strftime("%y%m%d") + if pline.order_id.date_planned : + date_value = mx.DateTime.strptime(pline.order_id.date_planned, '%Y-%m-%d') + elif pline.date : + date_value = mx.DateTime.strptime(pline.date, '%Y-%m-%d') + else : + date_value = mx.DateTime.now() + v['date_value'] = date_value.strftime("%y%m%d") - # si compte iban -> iban (836) - # si payment structure -> bvr (826) - # si non -> (827) + # si compte iban -> iban (836) + # si payment structure -> bvr (826) + # si non -> (827) - if elec_pay == 'dta_iban': - # If iban => country=country code for space reason - v['comp_country'] = co_addr.country_id and co_addr.country_id.code+'-' or '' - record_type = record_gt836 - if not v['partner_bank_iban']: - raise wizard.except_wizard(_('Error'), _('No IBAN defined \n' \ - 'for the bank account: %s\n' + \ - 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name)) + if elec_pay == 'dta_iban': + # If iban => country=country code for space reason + v['comp_country'] = co_addr.country_id and co_addr.country_id.code+'-' or '' + record_type = record_gt836 + if not v['partner_bank_iban']: + raise wizard.except_wizard(_('Error'), _('No IBAN defined \n' \ + 'for the bank account: %s\n' + \ + 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name)) - if v['partner_bank_code'] : # bank code is swift (BIC address) - v['option_id_bank']= 'A' - v['partner_bank_ident']= v['partner_bank_code'] - elif v['partner_bank_city']: + if v['partner_bank_code'] : # bank code is swift (BIC address) + v['option_id_bank']= 'A' + v['partner_bank_ident']= v['partner_bank_code'] + elif v['partner_bank_city']: - v['option_id_bank']= 'D' - v['partner_bank_ident']= v['partner_bank_name'] \ - + ' ' + v['partner_bank_street'] \ - + ' ' + v['partner_bank_zip'] \ - + ' ' + v['partner_bank_city'] \ - + ' ' + v['partner_bank_country'] - else: - raise wizard.except_wizard(_('Error'), _('You must provide the bank city ' - 'or the bic code for the partner bank: \n %d\n' + \ - 'on line: %s') %(res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1], pline.name)) + v['option_id_bank']= 'D' + v['partner_bank_ident']= v['partner_bank_name'] \ + + ' ' + v['partner_bank_street'] \ + + ' ' + v['partner_bank_zip'] \ + + ' ' + v['partner_bank_city'] \ + + ' ' + v['partner_bank_country'] + else: + raise wizard.except_wizard(_('Error'), _('You must provide the bank city ' + 'or the bic code for the partner bank: \n %d\n' + \ + 'on line: %s') %(res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1], pline.name)) - elif elec_pay == 'bvrbank' or elec_pay == 'bvrpost': - from tools import mod10r - if v['reference']: - v['reference'] = v['reference'].replace(' ', - '').rjust(27).replace(' ', '0') - if not v['reference'] \ - or mod10r(v['reference'][:-1]) != v['reference']: - raise wizard.except_wizard(_('Error'), _('You must provide ' \ - 'a valid BVR reference number \n' \ - 'for the line: %s') % pline.name) - if not v['partner_bvr']: - raise wizard.except_wizard(_('Error'), _('You must provide a BVR number\n' - 'for the bank account: %s' \ - 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id],context)[0][1] ,pline.name)) - record_type = record_gt826 + elif elec_pay == 'bvrbank' or elec_pay == 'bvrpost': + from tools import mod10r + if v['reference']: + v['reference'] = v['reference'].replace(' ', + '').rjust(27).replace(' ', '0') + if not v['reference'] \ + or (mod10r(v['reference'][:-1]) != v['reference'] and \ + not len(v['reference']) == 15): + raise wizard.except_wizard(_('Error'), _('You must provide ' \ + 'a valid BVR reference number \n' \ + 'for the line: %s') % pline.name) + if not v['partner_bvr']: + raise wizard.except_wizard(_('Error'), _('You must provide a BVR number\n' + 'for the bank account: %s' \ + 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id],context)[0][1] ,pline.name)) + record_type = record_gt826 - elif elec_pay == 'bvbank': - if not v['partner_bank_number'] : - if v['partner_bank_iban'] : - v['partner_bank_number']= v['partner_bank_iban'] - else: - raise wizard.except_wizard(_('Error'), _('You must provide ' \ - 'a bank number \n' \ - 'for the partner bank: %s\n' \ - 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name)) - if not v['partner_bank_clearing']: - raise wizard.except_wizard(_('Error'), _('You must provide ' \ - 'a Clearing Number\n' \ - 'for the partner bank: %s\n' \ - 'on line %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name)) - v['partner_bank_number'] = '/C/'+v['partner_bank_number'] - record_type = record_gt827 - elif elec_pay == 'bvpost': - if not v['partner_post_number']: - raise wizard.except_wizard(_('Error'), _('You must provide ' \ - 'a post number \n' \ - 'for the partner bank: %s\n' \ - 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] ,pline.name)) - v['partner_bank_clearing']= '' - v['partner_bank_number'] = '/C/'+v['partner_post_number'] - record_type = record_gt827 - else: - raise wizard.except_wizard(_('Error'), _('The Bank type %s of the bank account: %s is not supported') \ + elif elec_pay == 'bvbank': + if not v['partner_bank_number'] : + if v['partner_bank_iban'] : + v['partner_bank_number']= v['partner_bank_iban'] + else: + raise wizard.except_wizard(_('Error'), _('You must provide ' \ + 'a bank number \n' \ + 'for the partner bank: %s\n' \ + 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name)) + if not v['partner_bank_clearing']: + raise wizard.except_wizard(_('Error'), _('You must provide ' \ + 'a Clearing Number\n' \ + 'for the partner bank: %s\n' \ + 'on line %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name)) + v['partner_bank_number'] = '/C/'+v['partner_bank_number'] + record_type = record_gt827 + elif elec_pay == 'bvpost': + if not v['partner_post_number']: + raise wizard.except_wizard(_('Error'), _('You must provide ' \ + 'a post number \n' \ + 'for the partner bank: %s\n' \ + 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] ,pline.name)) + v['partner_bank_clearing']= '' + v['partner_bank_number'] = '/C/'+v['partner_post_number'] + record_type = record_gt827 + else: + raise wizard.except_wizard(_('Error'), _('The Bank type %s of the bank account: %s is not supported') \ % (elec_pay, res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1],)) - dta_line = record_type(v).generate() + dta_line = record_type(v).generate() - dta = dta + dta_line - amount_tot += pline.amount - amount_currency_tot += pline.amount_currency - seq += 1 + dta = dta + dta_line + amount_tot += pline.amount + amount_currency_tot += pline.amount_currency + seq += 1 - # segment total - v['amount_total'] = str(amount_currency_tot).replace('.',',') - v['sequence'] = str(seq).rjust(5).replace(' ','0') - if dta : - dta = dta + record_gt890(v).generate() + # segment total + v['amount_total'] = str(amount_currency_tot).replace('.',',') + v['sequence'] = str(seq).rjust(5).replace(' ','0') + if dta : + dta = dta + record_gt890(v).generate() - dta_data= base64.encodestring(dta) - payment_obj.set_done(cr, uid, data['id'], context) - attachment_obj.create(cr, uid, { - 'name': 'DTA', - 'datas': dta_data, - 'datas_fname': 'DTA.txt', - 'res_model': 'payment.order', - 'res_id': data['id'], - }, context=context) - return {'dta': dta_data} + dta_data= base64.encodestring(dta) + payment_obj.set_done(cr, uid, data['id'], context) + attachment_obj.create(cr, uid, { + 'name': 'DTA', + 'datas': dta_data, + 'datas_fname': 'DTA.txt', + 'res_model': 'payment.order', + 'res_id': data['id'], + }, context=context) + return {'dta': dta_data} class wizard_dta_create(wizard.interface): - states = { - 'init' : { - 'actions' : [_create_dta], - 'result' : {'type' : 'form', - 'arch' : FORM, - 'fields' : FIELDS, - 'state' : [('end', 'OK', 'gtk-ok', True)] - } - }, - } + states = { + 'init' : { + 'actions' : [_create_dta], + 'result' : {'type' : 'form', + 'arch' : FORM, + 'fields' : FIELDS, + 'state' : [('end', 'OK', 'gtk-ok', True)] + } + }, + } wizard_dta_create('account.dta_create') # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 122230e73c8e863a3b405741d2495198abb24d22 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 16 Oct 2009 17:16:43 +0200 Subject: [PATCH 043/200] [FIX] allow to call write without ids on osv_memory objects bzr revid: chs@tinyerp.com-20091016151643-uh7a9m0lfeqajfqf --- bin/osv/orm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 73015dffbde..652bcafab0a 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -1472,6 +1472,8 @@ class orm_memory(orm_template): return result def write(self, cr, user, ids, vals, context=None): + if not ids: + return True vals2 = {} upd_todo = [] for field in vals: From 3a3ea98257856975756a73efa7e9d4ea1edb8a8f Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 19 Oct 2009 20:16:33 +0200 Subject: [PATCH 044/200] [FIX] recursive child_of on one2many and many2many bzr revid: fp@tinyerp.com-20091019181633-8szl9k4nlp9mmr1p --- bin/osv/expression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/osv/expression.py b/bin/osv/expression.py index 3c330aaaa1a..72fde0be88b 100644 --- a/bin/osv/expression.py +++ b/bin/osv/expression.py @@ -52,8 +52,8 @@ class expression(object): ' FROM "%s"' \ ' WHERE "%s" in (%s)' % (s, f, w, ','.join(['%s']*len(subids))), subids) - res.extend([r[0] for r in cr.fetchall()]) - return res + res += [r[0] for r in cr.fetchall() if r[0]] + return res + (res and self.__execute_recursive_in(cr, s, f, w, res) or []) def __init__(self, exp): From a34163911b5675e01d5387a38e0aa2653bb0d764 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 20 Oct 2009 18:22:54 +0200 Subject: [PATCH 045/200] [FIX] purchase: Use the price_accuracy bzr revid: stephane@openerp.com-20091020162254-4tqmgq8d8toau15b --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 5661deedeee..521549cf472 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -442,7 +442,7 @@ class purchase_order_line(osv.osv): 'move_ids': fields.one2many('stock.move', 'purchase_line_id', 'Reservation', readonly=True, ondelete='set null'), 'move_dest_id': fields.many2one('stock.move', 'Reservation Destination', ondelete='set null'), 'price_unit': fields.float('Unit Price', required=True, digits=(16, int(config['price_accuracy']))), - 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'), + 'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal', digits=(16, int(config['price_accuracy']))), 'notes': fields.text('Notes'), 'order_id': fields.many2one('purchase.order', 'Order Ref', select=True, required=True, ondelete='cascade'), 'account_analytic_id':fields.many2one('account.analytic.account', 'Analytic Account',), From 636d392c646767e43dfe9e51b5cbc4da0e1ace84 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 20 Oct 2009 18:23:07 +0200 Subject: [PATCH 046/200] [FIX] Import OSV in the wizard bzr revid: stephane@openerp.com-20091020162307-zgrmea9e9gadmu30 --- addons/purchase_manual/wizard/wizard_purchase_line_invoice.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py b/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py index 89d7d188287..c65cefd97d0 100644 --- a/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py +++ b/addons/purchase_manual/wizard/wizard_purchase_line_invoice.py @@ -24,6 +24,7 @@ import wizard import netsvc import ir import pooler +import osv invoice_form = """
From f4f07382f5853849af46eeb3d6a8925bc0c2228b Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 21 Oct 2009 11:52:40 +0530 Subject: [PATCH 047/200] [FIX] Account : Restricting Payment term lines percentage insertion from 0 to 1 lp bug: https://launchpad.net/bugs/421636 fixed bzr revid: jvo@tinyerp.com-20091021062240-55hy0og5o7t87bkr --- addons/account/account.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/addons/account/account.py b/addons/account/account.py index 85dc85fd2d8..ff344b0256b 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -77,7 +77,10 @@ class account_payment_term_line(osv.osv): _columns = { 'name': fields.char('Line Name', size=32, required=True), 'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the payment term lines from the lowest sequences to the higher ones"), - 'value': fields.selection([('procent', 'Percent'), ('balance', 'Balance'), ('fixed', 'Fixed Amount')], 'Value',required=True), + 'value': fields.selection([('procent', 'Percent'), ('balance', 'Balance'), ('fixed', 'Fixed Amount')], 'Value', required=True, help="""Example: 14 days 2%, 30 days net +1. Line 1: percent 0.02 14 days +2. Line 2: balance 30 days"""), + 'value_amount': fields.float('Value Amount', help="For Value percent enter % ratio between 0-1."), 'days': fields.integer('Number of Days', required=True, help="Number of days to add before computation of the day of month." \ "If Date=15/01, Number of Days=22, Day of Month=-1, then the due date is 28/02."), @@ -90,6 +93,17 @@ class account_payment_term_line(osv.osv): 'days2': lambda *a: 0, } _order = "sequence" + + def _check_percent(self, cr, uid, ids, context={}): + obj = self.browse(cr, uid, ids[0]) + if obj.value == 'procent' and ( obj.value_amount < 0.0 or obj.value_amount > 1.0): + return False + return True + + _constraints = [ + (_check_percent, _('Percentages for Payment Term Line must be between 0 and 1, Example: 0.02 for 2% '), ['value_amount']), + ] + account_payment_term_line() From 8fd383c54afd7f653a6b7073c946ccc6563c6050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?VRA=28OpenERP=29=2C=20Claude=20Brul=C3=A9=28Syleam=29?= <> Date: Wed, 21 Oct 2009 15:43:24 +0530 Subject: [PATCH 048/200] [FIX] Project_timesheet : Analytic line creation/edition takes user based information lp bug: https://launchpad.net/bugs/395160 fixed bzr revid: jvo@tinyerp.com-20091021101324-37sddttk0hqlyt8k --- addons/project_timesheet/project_timesheet.py | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index f914faec86f..255f83e7021 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -30,18 +30,15 @@ from tools.translate import _ class project_work(osv.osv): _inherit = "project.task.work" _description = "Task Work" - def create(self, cr, uid, vals, *args, **kwargs): - - obj = self.pool.get('hr.analytic.timesheet') - vals_line = {} - obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id']) + def get_user_related_details(self, cr, uid, user_id): + res = {} emp_obj = self.pool.get('hr.employee') - emp_id = emp_obj.search(cr, uid, [('user_id', '=', vals.get('user_id', uid))]) - + emp_id = emp_obj.search(cr, uid, [('user_id', '=', user_id)]) if not emp_id: + user_name = self.pool.get('res.users').read(cr, uid, [user_id], ['name'])[0]['name'] raise osv.except_osv(_('Bad Configuration !'), - _('No employee defined for this user. You must create one.')) + _('No employee defined for user "%s". You must create one.')% (user_name,)) emp = self.pool.get('hr.employee').browse(cr, uid, emp_id[0]) if not emp.product_id: raise osv.except_osv(_('Bad Configuration !'), @@ -54,9 +51,22 @@ class project_work(osv.osv): a = emp.product_id.product_tmpl_id.property_account_expense.id if not a: a = emp.product_id.categ_id.property_account_expense_categ.id - + if not a: + raise osv.except_osv(_('Bad Configuration !'), + _('No product and product category property account defined on the related employee.\nFill in the timesheet tab of the employee form.')) + res['product_id'] = emp.product_id.id + res['journal_id'] = emp.journal_id.id + res['general_account_id'] = a + return res + + def create(self, cr, uid, vals, *args, **kwargs): + obj = self.pool.get('hr.analytic.timesheet') + vals_line = {} + obj_task = self.pool.get('project.task').browse(cr, uid, vals['task_id']) + result = self.get_user_related_details(cr, uid, vals.get('user_id', uid)) vals_line['name'] = '%s: %s' % (tools.ustr(obj_task.name), tools.ustr(vals['name']) or '/') vals_line['user_id'] = vals['user_id'] + vals_line['product_id'] = result['product_id'] vals_line['date'] = vals['date'][:10] vals_line['unit_amount'] = vals['hours'] acc_id = obj_task.project_id.category_id.id @@ -64,8 +74,8 @@ class project_work(osv.osv): res = obj.on_change_account_id(cr, uid, False, acc_id) if res.get('value'): vals_line.update(res['value']) - vals_line['general_account_id'] = a - vals_line['journal_id'] = emp.journal_id.id + vals_line['general_account_id'] = result['general_account_id'] + vals_line['journal_id'] = result['journal_id'] vals_line['amount'] = 00.0 timeline_id = obj.create(cr, uid, vals_line, {}) @@ -87,6 +97,10 @@ class project_work(osv.osv): vals_line['name'] = '%s: %s' % (tools.ustr(task.task_id.name), tools.ustr(vals['name']) or '/') if 'user_id' in vals: vals_line['user_id'] = vals['user_id'] + result = self.get_user_related_details(cr, uid, vals['user_id']) + vals_line['product_id'] = result['product_id'] + vals_line['general_account_id'] = result['general_account_id'] + vals_line['journal_id'] = result['journal_id'] if 'date' in vals: vals_line['date'] = vals['date'][:10] if 'hours' in vals: From 391807ea8fa0d7d794eb43f89f9fe6eb407f2143 Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Wed, 21 Oct 2009 18:13:26 +0530 Subject: [PATCH 049/200] [FIX]: #TODO: fix me sale module can not be used here, #as may be mrp can be installed without sale modul bzr revid: mga@tinyerp.com-20091021124326-0bcr4q9st2wy9yf0 --- addons/mrp/mrp.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index caef74d4540..5e7658b69eb 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -362,6 +362,8 @@ class mrp_production(osv.osv): parent_move_line=get_parent_move(production['move_prod_id'][0]) if parent_move_line: move = move_obj.browse(cr,uid,parent_move_line) + #TODO: fix me sale module can not be used here, + #as may be mrp can be installed without sale module if field_name=='name': res[production['id']]=move.sale_line_id and move.sale_line_id.order_id.name or False if field_name=='client_order_ref': From 4c63801b0da73cb9a3d6976b07a86c9163a0a201 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 21 Oct 2009 19:36:19 +0530 Subject: [PATCH 050/200] [FIX] AuditTrail : View Logs should only show logs of current object and resources bzr revid: jvo@tinyerp.com-20091021140619-st7tv6jaytp410kh --- addons/audittrail/audittrail.py | 40 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index ee23e790e7b..8467355addb 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -63,18 +63,18 @@ class audittrail_rule(osv.osv): _('WARNING:audittrail is not part of the pool'), _('Change audittrail depends -- Setting rule as DRAFT')) self.write(cr, uid, [thisrule.id], {"state": "draft"}) - val={ - "name":'View Log', - "res_model":'audittrail.log', - "src_model":thisrule.object_id.model, - "domain":"[('res_id', '=', active_id)]" - - } - id=self.pool.get('ir.actions.act_window').create(cr, uid, val) - self.write(cr, uid, ids, {"state": "subscribed","action_id":id}) - keyword = 'client_action_relate' - value = 'ir.actions.act_window,'+str(id) - res=self.pool.get('ir.model.data').ir_set(cr, uid, 'action', keyword,'View_log_'+thisrule.object_id.model, [thisrule.object_id.model], value, replace=True, isobject=True, xml_id=False) + val={ + "name":'View Log', + "res_model":'audittrail.log', + "src_model":thisrule.object_id.model, + "domain":"[('object_id','=',"+str(thisrule.object_id.id)+"),('res_id', '=', active_id)]" + + } + id=self.pool.get('ir.actions.act_window').create(cr, uid, val) + self.write(cr, uid, [thisrule.id], {"state": "subscribed","action_id":id}) + keyword = 'client_action_relate' + value = 'ir.actions.act_window,'+str(id) + res=self.pool.get('ir.model.data').ir_set(cr, uid, 'action', keyword,'View_log_'+thisrule.object_id.model, [thisrule.object_id.model], value, replace=True, isobject=True, xml_id=False) return True @@ -84,14 +84,14 @@ class audittrail_rule(osv.osv): if thisrule.id in self.__functions : for function in self.__functions[thisrule.id]: setattr(function[0], function[1], function[2]) - w_id=self.pool.get('ir.actions.act_window').search(cr, uid, [('name','=','View Log'),('res_model','=','audittrail.log'),('src_model','=',thisrule.object_id.model)]) - self.pool.get('ir.actions.act_window').unlink(cr, uid,w_id ) - val_obj=self.pool.get('ir.values') - value="ir.actions.act_window"+','+str(w_id[0]) - val_id=val_obj.search(cr, uid, [('model','=',thisrule.object_id.model),('value','=',value)]) - if val_id: - res = ir.ir_del(cr, uid, val_id[0]) - self.write(cr, uid, ids, {"state": "draft"}) + w_id=self.pool.get('ir.actions.act_window').search(cr, uid, [('name','=','View Log'),('res_model','=','audittrail.log'),('src_model','=',thisrule.object_id.model)]) + self.pool.get('ir.actions.act_window').unlink(cr, uid,w_id ) + val_obj=self.pool.get('ir.values') + value="ir.actions.act_window"+','+str(w_id[0]) + val_id=val_obj.search(cr, uid, [('model','=',thisrule.object_id.model),('value','=',value)]) + if val_id: + res = ir.ir_del(cr, uid, val_id[0]) + self.write(cr, uid, [thisrule.id], {"state": "draft"}) return True audittrail_rule() From 28bd548716b00c8d2b5debde76f665f26a0d7c55 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Thu, 22 Oct 2009 13:14:36 +0530 Subject: [PATCH 051/200] [FIX] Stock : Partial Picking wizard was making the back order reference jump to 2 numbers,notification given on packing done. lp bug: https://launchpad.net/bugs/379118 fixed bzr revid: jvo@tinyerp.com-20091022074436-20u01i4vye2jk7l8 --- addons/stock/stock.py | 3 ++- addons/stock/wizard/wizard_partial_picking.py | 19 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 1d7b69c6b3a..6410bb16d09 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -467,7 +467,8 @@ class stock_picking(osv.osv): if default is None: default = {} default = default.copy() - default['name'] = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking') + if not default.get('name',False): + default['name'] = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking') return super(stock_picking, self).copy(cr, uid, id, default, context) def onchange_partner_in(self, cr, uid, context, partner_id=None): diff --git a/addons/stock/wizard/wizard_partial_picking.py b/addons/stock/wizard/wizard_partial_picking.py index 2fe375c1b4f..89d34605dcd 100644 --- a/addons/stock/wizard/wizard_partial_picking.py +++ b/addons/stock/wizard/wizard_partial_picking.py @@ -27,6 +27,7 @@ import pooler import wizard from osv import osv +import tools _moves_arch = UpdateableStr() _moves_fields = UpdateableDict() @@ -34,8 +35,11 @@ _moves_fields = UpdateableDict() _moves_arch_end = '''