According to the patch 'ir_model_data_unique_constraint_error.diff'
you should edit the second duplicate record,
and add '_<id>' to 'name' field, with <id> = thisRow. 'res_id' field
ie in my case for "field_ir_actions_type":
id | module | res_id | name
238 | base | 90 | field_ir_actions_type
337 | base | 180 | field_ir_actions_type
You must modify the second one (id=337)
should become:
id | module | res_id | name
238 | base | 90 | field_ir_actions_type
337 | base | 180 | field_ir_actions_type_180
You could use this query to make it automatic:
update ir_model_data set name=name||'_'||res_id where id in (select max(id) from ir_model_data group by name,module having count(1)>1)
After that, the constraint could be apply.
ALTER table ir_model_data ADD CONSTRAINT ir_model_data_module_name_uniq unique(name, module)
To resolve the duplicate record problem:
According to the patch 'ir_model_ data_unique_ constraint_ error.diff'
you should edit the second duplicate record,
and add '_<id>' to 'name' field, with <id> = thisRow. 'res_id' field
ie in my case for "field_ ir_actions_ type": actions_ type actions_ type
id | module | res_id | name
238 | base | 90 | field_ir_
337 | base | 180 | field_ir_
You must modify the second one (id=337) actions_ type actions_ type_180
should become:
id | module | res_id | name
238 | base | 90 | field_ir_
337 | base | 180 | field_ir_
You could use this query to make it automatic:
update ir_model_data set name=name| |'_'||res_ id where id in (select max(id) from ir_model_data group by name,module having count(1)>1)
After that, the constraint could be apply.
ALTER table ir_model_data ADD CONSTRAINT ir_model_ data_module_ name_uniq unique(name, module)