[6.0rc2] csv import data mangled (with solution)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Released
|
Low
|
OpenERP's Framework R&D |
Bug Description
Many2one fields with name are getting related to the wrong objects with hilarious/
e.g. my res.users.csv specified menu_id of 'Menu' but got 'Board Create Menu' resulting in complete lockout :-(
The problem is name_search() is building this query:
SELECT "ir_actions".id FROM "ir_actions" WHERE (ir_actions.name ilike E'%Menu%') ORDER BY name limit 100
The use of 'ilike' means that if there is more than one action with 'Menu' in the name then it is pot-luck which one you get and more than likely chaos will ensue.
The match must be exact, so the operator must be specified as '=', thus:
=== modified file 'bin/osv/orm.py'
--- bin/osv/orm.py 2010-12-29 18:25:09 +0000
+++ bin/osv/orm.py 2011-01-06 22:00:15 +0000
@@ -726,7 +726,7 @@
id = ir_model_
else:
- ids = obj_model.
+ ids = obj_model.
if not ids:
id = ids[0][0]
Related branches
Changed in openobject-server: | |
assignee: | nobody → OpenERP's Framework R&D (openerp-dev-framework) |
importance: | Undecided → Low |
status: | New → Confirmed |
Changed in openobject-server: | |
status: | Confirmed → In Progress |
On Friday 07 January 2011, you wrote:
> The use of 'ilike' means that if there is more than one action with 'Menu'
> in the name then it is pot-luck which one you get and more than likely
> chaos will ensue. The match must be exact, so the operator must be
> specified as '=', thus:
Seems right. Well done.