On 23 Apr 12:22, Sergi Almacellas Abellana wrote: > El 22/04/15 a les 16:34, Prakash Pandey ha escrit: > >Hello folks, > > > >I am working on a module which enables historization on tryton models > >dynamically, by dynamic I mean - you can define models in tryton > >configuration and history will be enabled for them. Module name is > >audit_trail[1]. I am doing a weird hack to make this work[2], working > >though!. I had a discussion with pokoli on IRC[3] and he suggested if > >tryton could have some mechanism to apply inheritance in all classes in > >the pool. So when the pool is loading you can play with the classes to > >register, in my case inject _history = True to some classes? > > > >I am not sure how useful this feature would be and the areas where we > >can use this. Thoughts please? > > For me this is a good improvement in order to add functionalities to all the > models in the database. One example: > > - Allow to add tags to all the models in the database. > > So we can add a TaggableMixin, and override all the classes in the pool. > > For impelmenting this we can add a list of hooks that will be called after > registering all the classes of the pool. Of course a method for the modules > to register the hooks is also required.
I don't like the idea of hooks. I think the needs is more about extending the basis models (Model, ModelStorage, ModelView, ModelSQL, Wizard, Report). This could be done by having a 4th register in the Pool that will be first applied on those basis models. -- Cédric Krier - B2CK SPRL Email/Jabber: [email protected] Tel: +32 472 54 46 59 Website: http://www.b2ck.com/
