[6.0][project] template project shouldn't pollute the analytic chart of account

Bug #681463 reported by Raphaël Valyi - http://www.akretion.com
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 1

Bug Description

in addons #3958 with project installed, if I create some project and then set it in "template" mode, I'll then see it's corresponding analytic account in the analytic chart of account.
I think this is annoying if you have many templates and want to use analytic accounting.

The way it's done, template project will have an associated analytic account, I see no easy alternative here (because of the heritage). Now, a possible option would be to filter out those account related to template projects in the analytic chart of account. I tried a few things but were unable to find a patch, may be there is a limitation with OpenERP and filters in tree views.

Hope it helps

Changed in openobject-addons:
status: New → Triaged
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 1 (openerp-dev-addons1)
importance: Undecided → Wishlist
status: Triaged → Confirmed
ssi (Open ERP) (ssi)
Changed in openobject-addons:
status: Confirmed → In Progress
ssi (Open ERP) (ssi)
Changed in openobject-addons:
status: In Progress → Triaged
Changed in openobject-addons:
status: Triaged → Confirmed
Changed in openobject-addons:
importance: Wishlist → Low
milestone: none → 6.0
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Ujjvala Collins (uco-openerp) wrote :

Hello,

The fix has been committed to lp:~openerp-dev/openobject-addons/trunk-dev-addons1 with revision 4688.

It will merged into main addons soon.

Thanks.

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
status: Fix Committed → Fix Released
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Hello Ujjvala and Bhumika, I'm sorry to announce you that your fix is incorrect.

Instead of removing "template" account from the child_complete_ids list, it removes some "template" accounts but also some normal acounts and leave some other "template" accounts in the list.

Thie bug lies in analytic/analytic.py, in this method:

    def _child_compute(self, cr, uid, ids, name, arg, context=None):
        result = {}
        if context is None:
            context = {}

        for account in self.browse(cr, uid, ids, context=context):
            for child in account.child_ids:
                if child.state == 'template':
                    account.child_ids.pop(account.child_ids.index(child))
            result[account.id] = map(lambda x: x.id, account.child_ids)

That Python code looks rather cryptic to me, so I cannot give details here, but I guess the bug occurs because you are removing elements from the account.child_ids list while you are iterating it at the same time. I believe this doesn't work well in Python.

Changed in openobject-addons:
status: Fix Released → Confirmed
Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) wrote :

Here is a patch that works for me and even remove 3 lines of code.

Hope this helps

Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Ujjvala Collins (uco-openerp) wrote :

Hello Raphaël,

Thank you for your suggestions. We have applied your patch in our team branch. It will be merged into main trunk addons soon.

Thanks.

Changed in openobject-addons:
status: In Progress → Fix Committed
Changed in openobject-addons:
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.