From 323d71fecb5a61c9bdd9be3faf0ed21a26f865f5 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Tue, 15 Sep 2009 12:43:23 +0530 Subject: [PATCH 1/7] [IMP] Rng : Accepting Groups under/after/replacing Buttons bzr revid: jvo@tinyerp.com-20090915071323-c4hcvh1uzg18p7si --- bin/addons/base/rng/view.rng | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/addons/base/rng/view.rng b/bin/addons/base/rng/view.rng index 78944519593..d69c09df72a 100644 --- a/bin/addons/base/rng/view.rng +++ b/bin/addons/base/rng/view.rng @@ -378,6 +378,7 @@ + From dbc2adadf22d414d3fa5881293d5ee8c7ac71f2f Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Tue, 15 Sep 2009 10:17:44 +0200 Subject: [PATCH 2/7] [FIX] regression in fields.function computation bzr revid: fp@tinyerp.com-20090915081744-0l9k2v8a86fl036l --- bin/osv/orm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 08086f5d49b..f5be539a6d6 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -2469,9 +2469,10 @@ class orm(orm_template): if c[0].startswith('default_'): del rel_context[c[0]] + result = [] for field in upd_todo: for id in ids: - self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) + result += self._columns[field].set(cr, self, id, field, vals[field], user, context=rel_context) or [] for table in self._inherits: col = self._inherits[table] @@ -2533,7 +2534,7 @@ class orm(orm_template): cr.execute('update '+self._table+' set parent_right=parent_right+%s where parent_right>=%s', (distance, position)) cr.execute('update '+self._table+' set parent_left=parent_left-%s, parent_right=parent_right-%s where parent_left>=%s and parent_left<%s', (pleft-position+distance,pleft-position+distance, pleft+distance, pright+distance)) - result = self._store_get_values(cr, user, ids, vals.keys(), context) + result += self._store_get_values(cr, user, ids, vals.keys(), context) for order, object, ids, fields in result: self.pool.get(object)._store_set_values(cr, user, ids, fields, context) From 8316098a65481a400d00d10320301b699be4d210 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Tue, 15 Sep 2009 16:00:41 +0530 Subject: [PATCH 3/7] [IMP]quality_integration_server: get message from base_quality_module if module can not success to reach minimun score bzr revid: hmo@tinyerp.com-20090915103041-ehna9rq1sm9q1xyt --- .../quality_integration_server/base_quality_interrogation.py | 3 ++- 1 file changed, 2 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 48c2ef29278..a5a69898752 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -114,6 +114,7 @@ def check_quality(uri, user, pwd, dbname, modules): for module in modules: quality_result = execute(conn,'execute', dbname, uid, pwd,'module.quality.check','check_quality',module) detail_html = '' + msg = detail.get('message','') html = '''''' html +="

Module : %s

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

Final score : %s

"%(quality_result['final_score']) @@ -124,7 +125,7 @@ def check_quality(uri, user, pwd, dbname, modules): score = round(float(detail.get('score',0)),2) html += "
  • %s
  • "%(test.replace(' ','-'),test) detail_html +="

    %s (Score : %s)

    %s
    "%(test.replace(' ','-'),test,score,detail.get('detail')) - test_detail[test] = (score,detail.get('detail','')) + test_detail[test] = (score,msg,detail.get('detail','')) html += "%s"%(detail_html) html += "" final[quality_result['name']] = (quality_result['final_score'],html,test_detail) From a5c907c11a712e976144bb03f1908f64eb0b9d47 Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Tue, 15 Sep 2009 17:17:48 +0530 Subject: [PATCH 4/7] [FIX]quality_integration_server: get message from base_quality_module if module can not success to reach minimun score bzr revid: hmo@tinyerp.com-20090915114748-qk1mwa5s98j1x0wu --- .../quality_integration_server/base_quality_interrogation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index a5a69898752..65bb7f5f849 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -113,8 +113,7 @@ def check_quality(uri, user, pwd, dbname, modules): test_detail = {} for module in modules: quality_result = execute(conn,'execute', dbname, uid, pwd,'module.quality.check','check_quality',module) - detail_html = '' - msg = detail.get('message','') + detail_html = '' html = '''''' html +="

    Module : %s

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

    Final score : %s

    "%(quality_result['final_score']) @@ -122,6 +121,7 @@ def check_quality(uri, user, pwd, dbname, modules): html += "
      " 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) detail_html +="

      %s (Score : %s)

      %s
      "%(test.replace(' ','-'),test,score,detail.get('detail')) From bc39c5a14b65902348b5a5ddc15b1e6a93e39ba5 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 16 Sep 2009 12:47:08 +0530 Subject: [PATCH 5/7] [FIX] Print screen : Correction when text for report is already encoded lp bug: https://launchpad.net/bugs/379645 fixed bzr revid: jvo@tinyerp.com-20090916071708-xc93saplay5apvjn --- bin/report/printscreen/ps_list.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/report/printscreen/ps_list.py b/bin/report/printscreen/ps_list.py index 8534fd5c887..d2f946e6715 100644 --- a/bin/report/printscreen/ps_list.py +++ b/bin/report/printscreen/ps_list.py @@ -51,7 +51,10 @@ class report_printscreen_list(report_int): return result def _parse_string(self, view): - dom = etree.XML(view) + try: + dom = etree.XML(view.encode('utf-8')) + except: + dom = etree.XML(view) return self._parse_node(dom) def create(self, cr, uid, ids, datas, context=None): From 81b8e008d3a99f0bd7e4ca2b54d38faf87100eaa Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Wed, 16 Sep 2009 13:10:51 +0530 Subject: [PATCH 6/7] [IMP]quality_integration_server: make link of extra-addons module in addons module automatic on install-module command bzr revid: hmo@tinyerp.com-20090916074051-hyoq3atsctz8jdhd --- Makefile | 3 +- .../base_quality_interrogation.py | 37 +++++++++++++++++-- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 39ab146c13a..7b410d19dee 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,7 @@ # -*- makefile -*- addons-path := bin/addons/ +extra-addons:= '' root-path := bin/ port := 8069 net_port := 8070 @@ -22,7 +23,7 @@ drop-db: python $(interrogation_file) drop-db --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) install-module: - python $(interrogation_file) install-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --login=$(login) --password=$(password) + python $(interrogation_file) install-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --extra-addons=$(extra-addons) --port=$(port) --login=$(login) --password=$(password) upgrade-module: python $(interrogation_file) upgrade-module --modules=$(module) --database=$(database) --root-path=$(root-path) --addons-path=$(addons-path) --port=$(port) --login=$(login) --password=$(password) diff --git a/bin/addons/quality_integration_server/base_quality_interrogation.py b/bin/addons/quality_integration_server/base_quality_interrogation.py index 65bb7f5f849..b07c2baef40 100755 --- a/bin/addons/quality_integration_server/base_quality_interrogation.py +++ b/bin/addons/quality_integration_server/base_quality_interrogation.py @@ -180,7 +180,7 @@ def create_db(uri, dbname, user='admin', pwd='admin', lang='en_US'): elif res['type']=='state': state = res['state'] res = execute(wiz_conn, 'execute', dbname, uid, pwd, wiz_id, datas, state, {}) - install_module(uri, dbname, ['base_module_quality'],user,pwd) + install_module(uri, dbname, ['base_module_quality'],user=user,pwd=pwd) return True def drop_db(uri, dbname): @@ -190,12 +190,37 @@ def drop_db(uri, dbname): execute(conn, 'drop', admin_passwd, dbname) return True -def install_module(uri, dbname, modules, user='admin', pwd='admin'): +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): + 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): + 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: + make_links(uri, uid, dbname, source, destination, dep_data['name'], user, pwd) + 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 addons and extra_addons: + 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)]) + 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) wiz_id = execute(wizard_conn, 'create', dbname, uid, pwd, 'module.upgrade.simple') state = 'init' @@ -255,6 +280,9 @@ 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", + help="specify extra_addons and trunkCommunity modules path ") + (opt, args) = parser.parse_args() if len(args) != 1: parser.error("incorrect number of arguments") @@ -282,6 +310,7 @@ options = { 'modules' : opt.modules or [], 'login' : opt.login or 'admin', 'pwd' : opt.pwd or '', + 'extra-addons':opt.extra_addons or [] } options['modules'] = opt.modules and map(lambda m: m.strip(), opt.modules.split(',')) or [] @@ -297,7 +326,7 @@ try: if command == 'drop-db': drop_db(uri, options['database']) if command == 'install-module': - install_module(uri, options['database'], options['modules'], options['login'], options['pwd']) + install_module(uri, options['database'], options['modules'],options['addons-path'],options['extra-addons'],options['login'], options['pwd']) if command == 'upgrade-module': upgrade_module(uri, options['database'], options['modules'], options['login'], options['pwd']) if command == 'check-quality': From c415a9d72f4e32c265058b94f256631e99f5f17d Mon Sep 17 00:00:00 2001 From: "Harry (Open ERP)" Date: Wed, 16 Sep 2009 14:50:36 +0530 Subject: [PATCH 7/7] [FIX]base : ir_cron : take minimun next_call from database for job waiting. if database does not has any job, it will take 1 day for job waiting bzr revid: hmo@tinyerp.com-20090916092036-pevdiwq24d42zanl --- bin/addons/base/ir/ir_cron.py | 38 ++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/bin/addons/base/ir/ir_cron.py b/bin/addons/base/ir/ir_cron.py index 7da956c36af..166a5781d44 100644 --- a/bin/addons/base/ir/ir_cron.py +++ b/bin/addons/base/ir/ir_cron.py @@ -27,8 +27,6 @@ import tools import pooler from osv import fields,osv -next_wait = 60 - _intervalTypes = { 'work_days': lambda interval: DateTime.RelativeDateTime(days=interval), 'days': lambda interval: DateTime.RelativeDateTime(days=interval), @@ -74,20 +72,18 @@ class ir_cron(osv.osv, netsvc.Agent): f = getattr(m, func) f(cr, uid, *args) - def _poolJobs(self, db_name, check=False): + def _poolJobs(self, db_name, check=False): try: db, pool = pooler.get_db_and_pool(db_name) except: - return False - + return False if pool._init: # retry in a few minutes - next_call = 600 + next_call = 600 else: - next_call = next_wait - cr = db.cursor() now = DateTime.now() try: + cr = db.cursor() 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') @@ -115,8 +111,32 @@ class ir_cron(osv.osv, netsvc.Agent): # 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, int(time.time()) + next_call, db_name, db_name) + self.setAlarm(self._poolJobs, next_call, db_name, db_name) + + def create(self, cr, uid, vals, context=None): + res = super(ir_cron, self).create(cr, uid, vals, context=context) + cr.commit() + self._poolJobs(cr.dbname) + return res + def write(self, cr, user, ids, vals, context=None): + res = super(ir_cron, self).write(cr, user, ids, vals, context=context) + cr.commit() + self._poolJobs(cr.dbname) + return res + def unlink(self, cr, uid, ids, context=None): + res = super(ir_cron, self).unlink(cr, uid, ids, context=context) + cr.commit() + self._poolJobs(cr.dbname) + return res ir_cron() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: