← Back to team overview

openerp-expert-framework team mailing list archive

Re: Multiple inheritance problem with MRO

 

Le 23/04/2012 09:38, Olivier Dony a écrit :
> You should never touch the MRO to alter OpenERP models inheritance, or at all.
> This is a Python implementation detail and the ORM takes care of managing it
> properly when you use OpenERP inheritance. If you need to mess with it your
> design is probably bad and certainly too complicated.
+1
Fortunately, the __mro__ class attribute is readonly (at least in
CPython, the general doc does not mention that unless I missed it), and
even __bases__ assignation has restrictions.

That being said, it can be useful to know what happens behind the scenes
with OpenERP model classes, at least for psychological reasons when
things go wrong.
If it may help, I wrote for that reason a bit about that a few weeks
ago:
http://www.racinet.fr/index.php?post/2012/04/07/Inside-OpenERP-inheritance
(can certainly be improved, comments welcome).

Regards,

-- 
Georges Racinet
Anybox SAS, http://anybox.fr
Bureau: 09 53 53 72 97
(Nouveau) Portable pro: 06 51 32 07 27



Follow ups

References