From 85c8b304bfbaa715c92b878c0e51d8924f012db9 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 15 Dec 2008 16:08:35 +0100 Subject: [PATCH 1/9] [FIX] fix a stupid bug in database closing method lp bug: https://launchpad.net/bugs/308084 fixed bzr revid: christophe@cobalt-20081215150835-d4rkvaf35m1gbyj6 --- bin/sql_db.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/sql_db.py b/bin/sql_db.py index 335a0950c13..03828a1ee87 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -221,7 +221,7 @@ class PoolManager(object): get = staticmethod(get) def close(db_name): - if db_name is PoolManager._pools: + if db_name in PoolManager._pools: logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Closing all connections to %s' % (db_name,)) PoolManager._pools[db_name].closeall() del PoolManager._pools[db_name] From 9f9f2ff78e08cd826f09f3f7dab0a80723112bbf Mon Sep 17 00:00:00 2001 From: Olivier Laurent Date: Mon, 15 Dec 2008 16:10:36 +0100 Subject: [PATCH 2/9] bugfix: search: ('id', 'in', 'ids') instead of ('id', '=', 'ids') bzr revid: olt@tinyerp.com-20081215151036-brk5sgbq5o7ci9jk --- bin/report/report_sxw.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/report/report_sxw.py b/bin/report/report_sxw.py index ddf0393e910..501dd285f27 100644 --- a/bin/report/report_sxw.py +++ b/bin/report/report_sxw.py @@ -613,7 +613,7 @@ class report_sxw(report_rml): else: ir_menu_report_obj = pool.get('ir.ui.menu') report_menu_ids = ir_menu_report_obj.search(cr, uid, - [('id', '=', ids)], context=context) + [('id', 'in', ids)], context=context) if report_menu_ids: report_name = ir_menu_report_obj.browse(cr, uid, report_menu_ids[0], context=context) From be2a0a76bbd95ce83cc68a10ce25e5b60279a0e6 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Mon, 15 Dec 2008 16:36:16 +0100 Subject: [PATCH 3/9] [FIX] the database connectin pool generate at least one connection to ensure earliest that the database is reachable bzr revid: christophe@cobalt-20081215153616-dyb7xj771tzj5de1 --- bin/sql_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/sql_db.py b/bin/sql_db.py index 03828a1ee87..3f4e23cc392 100644 --- a/bin/sql_db.py +++ b/bin/sql_db.py @@ -213,9 +213,9 @@ class PoolManager(object): logger = netsvc.Logger() try: logger.notifyChannel('dbpool', netsvc.LOG_INFO, 'Connecting to %s' % (db_name,)) - PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(0, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name) + PoolManager._pools[db_name] = ConnectionPool(ThreadedConnectionPool(1, PoolManager.maxconn, PoolManager.dsn(db_name)), db_name) except Exception, e: - logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %r' % (db_name, e)) + logger.notifyChannel('dbpool', netsvc.LOG_CRITICAL, 'Unable to connect to %s: %s' % (db_name, e.message)) raise return PoolManager._pools[db_name] get = staticmethod(get) From adc8e511ba7492a8013c8c99dbc957eb14be5844 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Mon, 15 Dec 2008 21:22:41 +0100 Subject: [PATCH 4/9] [REF] Rewrite the domain field bzr revid: stephane@tinyerp.com-20081215202241-xvhn363iuzj1022c --- bin/addons/base/base_data.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/base_data.xml b/bin/addons/base/base_data.xml index e41fccfe682..4777b7ea4f0 100644 --- a/bin/addons/base/base_data.xml +++ b/bin/addons/base/base_data.xml @@ -19,7 +19,7 @@ ir.ui.menu tree - + [('parent_id', '=', False)] From 2cc3ac1ef7968a471a72c0d1f79cecd3c03d60be Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Mon, 15 Dec 2008 22:06:59 +0100 Subject: [PATCH 5/9] improved_view bzr revid: fp@tinyerp.com-20081215210659-qm7pll67ylf9rv36 --- bin/addons/base/ir/ir.xml | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/bin/addons/base/ir/ir.xml b/bin/addons/base/ir/ir.xml index c649b12cf99..53c9fb7e580 100644 --- a/bin/addons/base/ir/ir.xml +++ b/bin/addons/base/ir/ir.xml @@ -324,12 +324,25 @@ - + + ir.actions.wizard.tree + ir.actions.wizard + tree + + + + + + + + + + ir.actions.wizard ir.actions.wizard form -
+ @@ -340,7 +353,7 @@ - Wizard + Wizards ir.actions.act_window ir.actions.wizard form From ce70e60592b621c0b10ea531b1435b968beb04ac Mon Sep 17 00:00:00 2001 From: Husen Daudi Date: Tue, 16 Dec 2008 14:25:33 +0530 Subject: [PATCH 6/9] Fixed bug on function field if type is binary (ref:hmo) bzr revid: hda@tinyerp.com-20081216085533-4jjo15livmuh9mbp --- bin/osv/fields.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bin/osv/fields.py b/bin/osv/fields.py index 544bd9b3fee..e0da8d38945 100644 --- a/bin/osv/fields.py +++ b/bin/osv/fields.py @@ -602,6 +602,9 @@ class function(_column): if store: self._classic_read = True self._classic_write = True + if type=='binary': + self._symbol_get=lambda x:x and str(x) + if type == 'float': self._symbol_c = float._symbol_c self._symbol_f = float._symbol_f From 9dec41a7b15e841c7332edae17d34cd3dfea5bb8 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Tue, 16 Dec 2008 10:45:49 +0100 Subject: [PATCH 7/9] [FIX] Add the dot in the object name lp bug: https://launchpad.net/bugs/300646 fixed bzr revid: stephane@tinyerp.com-20081216094549-e5493sdtjwm4k99y --- bin/addons/base/ir/ir_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 40ce882e280..66cbd98e52d 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -55,7 +55,7 @@ class ir_model(osv.osv): if model.state=='manual': if not model.model.startswith('x_'): return False - if not re.match('^[a-z_A-Z0-9]+$',model.model): + if not re.match('^[a-z_A-Z0-9.]+$',model.model): return False return True From ffc916aaa39d8cca186c10c5d506fc5a472f0e62 Mon Sep 17 00:00:00 2001 From: Olivier Laurent Date: Tue, 16 Dec 2008 11:14:22 +0100 Subject: [PATCH 8/9] wrong identifier: uid -> user bzr revid: olt@tinyerp.com-20081216101422-bk80ena85vj4y4kw --- bin/addons/base/ir/ir_model.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/bin/addons/base/ir/ir_model.py b/bin/addons/base/ir/ir_model.py index 40ce882e280..4d0cc16f21e 100644 --- a/bin/addons/base/ir/ir_model.py +++ b/bin/addons/base/ir/ir_model.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2008 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -233,7 +233,7 @@ class ir_model_fields(osv.osv): # MAY BE ADD A ALTER TABLE DROP ? # return super(ir_model_fields, self).unlink(cr, user, ids, context) - + def write(self, cr, uid, ids, vals, context=None): res = False if 'relation_id' in vals: @@ -242,29 +242,29 @@ class ir_model_fields(osv.osv): if 'relation_field_id' in vals: field_data = self.pool.get('ir.model.fields').browse(cr, uid, vals['relation_field_id']) vals['relation'] = field_data.name - + res = super(ir_model_fields, self).write(cr, uid, ids, vals, context) return res - + def create(self, cr, user, vals, context=None): if 'relation_id' in vals: - model_data = self.pool.get('ir.model').browse(cr,user,vals['relation_id']) + model_data = self.pool.get('ir.model').browse(cr, user, vals['relation_id']) vals['relation']=model_data.model if 'relation_field_id' in vals: - field_data = self.pool.get('ir.model.fields').browse(cr, uid, vals['relation_field_id']) + field_data = self.pool.get('ir.model.fields').browse(cr, user, vals['relation_field_id']) vals['relation_field'] = field_data.name if 'model_id' in vals: - model_data=self.pool.get('ir.model').browse(cr,user,vals['model_id']) - vals['model']=model_data.model + model_data = self.pool.get('ir.model').browse(cr, user, vals['model_id']) + vals['model'] = model_data.model if context and context.get('manual',False): - vals['state']='manual' + vals['state'] = 'manual' res = super(ir_model_fields,self).create(cr, user, vals, context) - if vals.get('state','base')=='manual': + if vals.get('state','base') == 'manual': if not vals['name'].startswith('x_'): raise except_orm(_('Error'), _("Custom fields must have a name that starts with 'x_' !")) if self.pool.get(vals['model']): self.pool.get(vals['model']).__init__(self.pool, cr) - self.pool.get(vals['model'])._auto_init(cr,{}) + self.pool.get(vals['model'])._auto_init(cr, {}) return res ir_model_fields() @@ -298,7 +298,7 @@ class ir_model_access(osv.osv): model_name = model.name else: model_name = model - + if isinstance(group_ids, (int, long)): group_ids = [group_ids] for group_id in group_ids: @@ -324,7 +324,7 @@ class ir_model_access(osv.osv): def check(self, cr, uid, model, mode='read', raise_exception=True): if uid==1: - # User root have all accesses + # User root have all accesses # TODO: exclude xml-rpc requests return True @@ -335,7 +335,7 @@ class ir_model_access(osv.osv): model_name = model.name else: model_name = model - + # We check if a specific rule exists cr.execute('SELECT MAX(CASE WHEN perm_' + mode + ' THEN 1 ELSE 0 END) ' ' FROM ir_model_access a ' @@ -394,7 +394,7 @@ class ir_model_access(osv.osv): res = super(ir_model_access, self).write(cr, uid, *args, **argv) self.check() # clear the cache of check function return res - + def create(self, cr, uid, *args, **argv): res = super(ir_model_access, self).create(cr, uid, *args, **argv) self.check() From 2b5169c00af8b7c2aa14218a4836722a4e2d4ab1 Mon Sep 17 00:00:00 2001 From: Olivier Laurent Date: Tue, 16 Dec 2008 11:18:25 +0100 Subject: [PATCH 9/9] 'e' is not an exception class bzr revid: olt@tinyerp.com-20081216101825-xxu1fg5jba7nrk30 --- bin/addons/base/res/partner/partner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/addons/base/res/partner/partner.py b/bin/addons/base/res/partner/partner.py index d17c696677f..56c01015287 100644 --- a/bin/addons/base/res/partner/partner.py +++ b/bin/addons/base/res/partner/partner.py @@ -255,7 +255,7 @@ class res_partner(osv.osv): ref = res and res[0]['ref'] or '0' try: nextref = int(ref)+1 - except e: + except: raise osv.except_osv(_('Warning'), _("Couldn't generate the next id because some partners have an alphabetic id !")) # update the current partner