Miscalculation of parent_store data when moving multiple records under same parent

Bug #708603 reported by Amit Parik
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Released
High
OpenERP's Framework R&D
5.0
Fix Released
High
Jay Vora (Serpent Consulting Services)

Bug Description

When i duplicate a account to ctrl+shift+d i found this traceback on server side.

[2011-01-27 17:40:25,970][db_trunk_inv] ERROR:web-services:Uncaught exception
Traceback (most recent call last):
  File "/home/tiny/workspace/openobject-server/bin/osv/osv.py", line 122, in wrapper
    return f(self, dbname, *args, **kwargs)
  File "/home/tiny/workspace/openobject-server/bin/osv/osv.py", line 176, in execute
    res = self.execute_cr(cr, uid, obj, method, *args, **kw)
  File "/home/tiny/workspace/openobject-server/bin/osv/osv.py", line 167, in execute_cr
    return getattr(object, method)(cr, uid, *args, **kw)
  File "/home/tiny/workspace/openobject-addons/account/account.py", line 495, in copy
    child_ids = self.copy(cr, uid, child.id, default, context=context, done_list=done_list, local=True)
  File "/home/tiny/workspace/openobject-addons/account/account.py", line 495, in copy
    child_ids = self.copy(cr, uid, child.id, default, context=context, done_list=done_list, local=True)
  File "/home/tiny/workspace/openobject-addons/account/account.py", line 501, in copy
    return super(account_account, self).copy(cr, uid, id, default, context=context)
  File "/home/tiny/workspace/openobject-server/bin/osv/orm.py", line 4145, in copy
    data = self.copy_data(cr, uid, id, default, context)
  File "/home/tiny/workspace/openobject-server/bin/osv/orm.py", line 4031, in copy_data
    data = self.read(cr, uid, [id,], context=context_wo_lang)
  File "/home/tiny/workspace/openobject-server/bin/osv/orm.py", line 2921, in read
    result = self._read_flat(cr, user, select, fields, context, load)
  File "/home/tiny/workspace/openobject-server/bin/osv/orm.py", line 3032, in _read_flat
    res2 = self._columns[val[0]].get(cr, self, ids, val, user, context=context, values=res)
  File "/home/tiny/workspace/openobject-server/bin/osv/fields.py", line 793, in get
    res = self._fnct(obj, cr, user, ids, name, self._arg, context)
  File "/home/tiny/workspace/openobject-addons/account/account.py", line 305, in __compute
    sums[current.id][fn] += sums[child.id][fn]

It took more number of digits then actual in account code.

Thanks

Related branches

Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
status: New → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Meera Trambadia (OpenERP) (mtr-openerp) wrote :

Hello Amit,

Its fixed in https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-mtr1 branch.
Revision ID: mtr@mtr-20110128114450-998ho3olsdfno7yw
Revision no: 4715

Thanks
mtr

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

@Meera: I have checked your commit, you can try like " if sums.get(child.id, False) ".

Changed in openobject-addons:
status: Fix Committed → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Meera Trambadia (OpenERP) (mtr-openerp) wrote :

Hello Mustufa Rangwala,

I have improved my changes as per your suggestion i.e.sums.get(child.id, False).

Its fixed in https://code.launchpad.net/~openerp-commiter/openobject-addons/trunk-dev-addons3-mtr1 branch.
Revision ID: mtr@mtr-20110131063645-pjwyyj3uv1jp40i1
Revision no: 4718

Thanks
mtr

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Meera Trambadia (OpenERP) (mtr-openerp) wrote :

Hello,

I have improved my code committed in the revision no 4718 (comment #3)
So the new Revision no: 4721
Revision ID: mtr@mtr-20110131080207-hmsbxkmonkvdh3to

Thanks
mtr

Changed in openobject-addons:
status: Fix Committed → Fix Released
Changed in openobject-addons:
milestone: none → 6.0.2
affects: openobject-addons → openobject-server
Changed in openobject-server:
assignee: OpenERP R&D Addons Team 3 (openerp-dev-addons3) → OpenERP's Framework R&D (openerp-dev-framework)
importance: Low → Medium
milestone: 6.0.2 → none
status: Fix Released → Confirmed
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

Thanks to Jay's careful review, we noticed that the fix suggested in previous comments and already merged, is on fact only hiding an underlying bug in the framework, which causes an invalid update of the parent_left/right column values after the duplication.
This can have much dire consequences, so it is better to prevent duplication until the server issue is fixed.
As a result, the patch in addons-trunk was reverted by revision 4404 <email address hidden>.

summary: - Traceback occurs at the time of "Account" duplication.
+ Miscalculation of parent_store data when moving multiple records under
+ same parent
Revision history for this message
Olivier Dony (Odoo) (odo-openerp) wrote :

The fix has landed in 6.0 and was ported to trunk as well:
- 6.0: rev 3334 <email address hidden>
- trunk: rev 3342 <email address hidden>

I'm adding a bug task for 5.0 as well, in order for maintenance team to evaluate whether this should be backported to 5.0. I think it's very low-risk and quite important... and that code has not changed much since 5.0...

Changed in openobject-server:
importance: Medium → High
milestone: none → 6.0.2
status: Confirmed → Fix Released
tags: added: maintenance
tags: added: 5.0 6.0
Revision history for this message
Anup(SerpentCS) (anup-serpent) wrote :

Hello Guys,

      It has been fixed in version 5.0 by revision 2171 <email address hidden>

@Olivier
    Thank you very much for pointing towards such a crucial issue in stable. Excellent fix as always.

Thanks.

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

On a related note, YAML tests were added in trunk to validate the behavior of the parent_store update system, in the different cases: see rev 3343 <email address hidden>.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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