[Trunk/6.1]Code error: schedulers.py order kwarg in read method

Bug #956234 reported by Guewen Baconnier @ Camptocamp
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Medium
OpenERP R&D Addons Team 2

Bug Description

Hello,

At line 270 of schedulers.py in procurement addons:
http://bazaar.launchpad.net/~openerp/openobject-addons/6.1/view/head:/procurement/schedulers.py#270

you'll see that the read method is called with an extra keyword argument "order" which is not in the read signature.

This stops the schedulers and it also seems that the cursor doesn't close properly when this happens.

Thanks
best regards
Guewen

Related branches

Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

I just checked for the cursor not closed, a "finally" is missing.

Revision history for this message
Ravish(OpenERP) (rmu-openerp) wrote :

Hello Guewen,

I have checked your issue. Would you please elaborate more on this important issue, specially on your comment#1. SO we can solved out it.

Thanks!!

Changed in openobject-addons:
status: New → Incomplete
Revision history for this message
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote :

Hello,

I don't have any procedure to reproduce the steps which lead to the portion of code impacted.

But one thing I'm sure is that the method read doesn't accept the argument "order" as it is actually at line 270:
procure_datas = procurement_obj.read(cr, uid, pro_ids, ['id', 'product_qty'], context=context, order='product_qty desc')

This leads to the error :
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: read() got an unexpected keyword argument 'order'

I've attached a branch with the fix. The sort here is not necessary, this is a very very small optimization in order to reduce the number of loops.

I know you prefer to have steps to reproduce the issue, but thats a coding error, it's easy to check the signature of the method read and check that there is no "order" nor **kwargs arguments.

Thanks
Guewen

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Guewen,

Thanks for your reply.

I strongly agree with you that, We can not pass a _order as **kwargs on read method (I have also checked the server's read method at, We didn't pass the _order params at there btw we can pass this params on search method ).

So as a coding problem I am confirming this issue.
I didn't reproduce it but If scheduler.py 's line#270 executed then described comment#1 's error will be generated.

btw Guewen nice catch ;-).

Thank you!

Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Medium
status: Incomplete → Confirmed
Amit Parik (amit-parik)
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Don,

Thanks for your contribution.

It has been fixed in lp:~openerp-dev/openobject-addons/trunk-bug-956234-amp With
Revision ID: <email address hidden>
Revision num: 6680.

It will be available in trunk soon.

Cheers!

Changed in openobject-addons:
status: In Progress → Fix Committed
summary: - Code error: schedulers.py order kwarg in read method
+ [Trunk/6.1]Code error: schedulers.py order kwarg in read method
Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Guewen,

Sorry for the naming inconvenience..!

Thanks !

Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

The proposed patch from Guewen was merged in 6.1 at rev 6690 rev-id: <email address hidden>.

Thanks for reporting and providing a fix!

Changed in openobject-addons:
milestone: none → 6.1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.