From b2ff94078652379ef3e1ef614ad66e7f5738cd93 Mon Sep 17 00:00:00 2001 From: "ACH(OpenERP)" <> Date: Fri, 31 Jul 2009 19:41:15 +0530 Subject: [PATCH] [FIX] ir_model_data : SQL_Constraint failure covered lp bug: https://launchpad.net/bugs/393858 fixed bzr revid: jvo@tinyerp.com-20090731141115-wz5jg07ow5cdqj0z --- bin/osv/orm.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 642ccaf600f..6f168bd316f 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -381,8 +381,12 @@ class orm_template(object): vals['select_level'] )) if 'module' in context: + name1 = 'field_' + self._table + '_' + k + cr.execute("select name from ir_model_data where name='%s'"%(name1)) + if cr.fetchone(): + name1 = name1 + "_" + str(id) cr.execute("INSERT INTO ir_model_data (name,date_init,date_update,module,model,res_id) VALUES (%s, now(), now(), %s, %s, %s)", \ - (('field_'+self._table+'_'+k)[:64], context['module'], 'ir.model.fields', id) + (name1[:64], context['module'], 'ir.model.fields', id) ) else: for key, val in vals.items():