Loosing context in some methods

Bug #1244544 reported by Denis Karataev
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Low
OpenERP R&D Addons Team 2

Bug Description

Hello,

In mrp module we have some methods which don't pass the context. For example force_production:

def force_production(self, cr, uid, ids, *args):
        """ Assigns products.
        @param *args: Arguments
        @return: True
        """
        pick_obj = self.pool.get('stock.picking')

        ##### !!! FIXME: here context isn't passed, but force_assign method in stock.picking has the attribute 'context'!!! #####
        pick_obj.force_assign(cr, uid, [prod.picking_id.id for prod in self.browse(cr, uid, ids)])
        return True

That way, if we need to inherit force_assign method of stock.picking, we also must inherit all the methods which don't pass the context to force_assign and I think this is very bad practice, because if context would be passed everywhere, we wouldn't have these problems and it would be clear, perfect way to inherit only one method that we really need to inherit.

description: updated
description: updated
Amit Parik (amit-parik)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Low
status: New → Confirmed
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.