← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 817003] [NEW] [trunk] F2 causes crash on many2one fields if a domain is also applied

 

Public bug reported:

Hi everyone!

Here is the thing: let us assume I define a module "module", and 3
objects "b", "c" and "d".   (I skip the "a" I don't like it)

"b" has a many2one field to "c"  called "c_id"
"c" has a many2one field to "d"  called "d_id"

I define a tree view for "b". It is an editable tree view (editable="top" in my case).
(the error occurs as well in a form view)

There is a domain on "c_id" which is [("d_id","=",9)]
                      -> remark : there is a "d" record with id 9, and there is at least one "c" record with "d_id=9"

In this "b" view, I edit a record and type "ttt" in the "c_id" field.
Then I type F2.

EXPECTED RESULT: a pop-up list opens, with a "create" button if a record
containing "ttt" (and in which "d_id=9") does not exist yet.

ACTUAL RESULT: Crash. Here is the error I get (I modified the names to
be consistent with the example here above):

TypeError: not all arguments converted during string formatting

-> res = self._obj.execute(query, params)

(Pdb) params
[9, '%ttt%']
(Pdb) query
'SELECT "module_c".id FROM "module_c" WHERE module_c.d_id = %s) AND (module_c.name ilike \'ttt\') ORDER BY d_id desc  limit 10'

The query is badly built of course, since the "ttt" has already been
introduced while it should still be "%s".

Final remark: I think the example is minimal.

See you guys!

François

** Affects: openobject-client-web
     Importance: Undecided
         Status: New

** Summary changed:

- [trunk] In a "one2many" field in editable mode, F2 causes crash on many2one fields
+ [trunk] F2 causes crash on many2one fields if a domain is also applied

** Description changed:

  Hi everyone!
  
  Here is the thing: let us assume I define a module "module", and 3
  objects "b", "c" and "d".   (I skip the "a" I don't like it)
  
  "b" has a many2one field to "c"  called "c_id"
  "c" has a many2one field to "d"  called "d_id"
  
  I define a tree view for "b". It is an editable tree view (editable="top" in my case).
  (the error occurs as well in a form view)
  
- There is a domain on "c_id" which is [("d_id","=",9)] 
-                       -> remark : there is a "d" record with id 9, and there is at least one "c" record with "d_id=9"
+ There is a domain on "c_id" which is [("d_id","=",9)]
+                       -> remark : there is a "d" record with id 9, and there is at least one "c" record with "d_id=9"
  
  In this "b" view, I edit a record and type "ttt" in the "c_id" field.
  Then I type F2.
  
  EXPECTED RESULT: a pop-up list opens, with a "create" button if a record
  containing "ttt" (and in which "d_id=9") does not exist yet.
  
  ACTUAL RESULT: Crash. Here is the error I get (I modified the names to
  be consistent with the example here above):
  
  TypeError: not all arguments converted during string formatting
  
  -> res = self._obj.execute(query, params)
  
  (Pdb) params
  [9, '%ttt%']
  (Pdb) query
- 'SELECT "module_c".id FROM "module_c" WHERE module_c.d_id = %s) AND (university_edu_course_organization.name ilike \'ttt\') ORDER BY d_id desc  limit 10'
+ 'SELECT "module_c".id FROM "module_c" WHERE module_c.d_id = %s) AND (module_c.name ilike \'ttt\') ORDER BY d_id desc  limit 10'
  
- 
- The query is badly built of course, since the "ttt" has already been introduced while it should still be "%s".
- 
+ The query is badly built of course, since the "ttt" has already been
+ introduced while it should still be "%s".
  
  Final remark: I think the example is minimal.
  
  See you guys!
  
  François

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/817003

Title:
  [trunk] F2 causes crash on many2one fields if a domain is also applied

Status in OpenERP Web Client:
  New

Bug description:
  Hi everyone!

  Here is the thing: let us assume I define a module "module", and 3
  objects "b", "c" and "d".   (I skip the "a" I don't like it)

  "b" has a many2one field to "c"  called "c_id"
  "c" has a many2one field to "d"  called "d_id"

  I define a tree view for "b". It is an editable tree view (editable="top" in my case).
  (the error occurs as well in a form view)

  There is a domain on "c_id" which is [("d_id","=",9)]
                        -> remark : there is a "d" record with id 9, and there is at least one "c" record with "d_id=9"

  In this "b" view, I edit a record and type "ttt" in the "c_id" field.
  Then I type F2.

  EXPECTED RESULT: a pop-up list opens, with a "create" button if a
  record containing "ttt" (and in which "d_id=9") does not exist yet.

  ACTUAL RESULT: Crash. Here is the error I get (I modified the names to
  be consistent with the example here above):

  TypeError: not all arguments converted during string formatting

  -> res = self._obj.execute(query, params)

  (Pdb) params
  [9, '%ttt%']
  (Pdb) query
  'SELECT "module_c".id FROM "module_c" WHERE module_c.d_id = %s) AND (module_c.name ilike \'ttt\') ORDER BY d_id desc  limit 10'

  The query is badly built of course, since the "ttt" has already been
  introduced while it should still be "%s".

  Final remark: I think the example is minimal.

  See you guys!

  François

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-client-web/+bug/817003/+subscriptions


Follow ups

References