Hello everyone who cares about improving OpenERP.
We faced the problem with context and I want to pay attention on it
because in my opinion it's not good to have some code that hard to
inherit (as all we know OpenERP it's framework with flexible
inheritance and it's one of most important things in the framework).
Why OpenERP developers only care that theirs code works but they don't
care how we will inherit it (in other words, why don't they care about
main purpose of OpenERP framework - comfortable flexibility)?
Here is explanation of the problem, for example in mrp module:
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
<http://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.
Also I added this as a bug on Launchpad:
https://bugs.launchpad.net/openobject-addons/+bug/1244544
If you also think that it is important issue, welcome to discussion!
--
????? ????????.
_______________________________________________
Mailing list: https://launchpad.net/~openerp-community
Post to : openerp-community@xxxxxxxxxxxxxxxxxxx
Unsubscribe : https://launchpad.net/~openerp-community
More help : https://help.launchpad.net/ListHelp