2015-04-24 6:22 GMT+02:00 Jesús Martín Jiménez <[email protected]>:

>
>
> 2015-04-23 13:03 GMT+02:00 Jesús Martín Jiménez <[email protected]>:
>
>>
>>
>> 2015-04-23 12:35 GMT+02:00 Cédric Krier <[email protected]>:
>>
>>> 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.
>>>
>>
>> A kind of __post_register__ I think is a good option.
>>
>
> I would like to explain a little bit my telegraphic post. I've found
> myself in the need of having a kind of ModelDynamic model when I developed
> the default_value module [1]. This hypothetic model would extend
> ModelStorage with the next features:
> __setup__ method: Read all records of models inherited from it and
> __setup__ them as usual ModelSQL does in the pool.
> __post_setup__ method: Same than previous one.
> __register__ method: Do nothing.
> __post_register__ method: Read all records of models inherited from it and
> __register__ them as usual ModelSQL (and ModelView if required/configured
> for it).
> This way, all models are already registered when dynamic models start
> their registration.
>
> [1] https://bitbucket.org/zikzakmedia/trytond-default_value
>

Here [1] you can see an aproximation what I want say.

[1]
https://bitbucket.org/zikzakmedia/trytond-survey/src/b5dff60a14a1cf623ba3d4eac4393e884c4ddcb6/survey.py?at=default#cl-39


>
>
>>
>>
>>>
>>> --
>>> Cédric Krier - B2CK SPRL
>>> Email/Jabber: [email protected]
>>> Tel: +32 472 54 46 59
>>> Website: http://www.b2ck.com/
>>>
>>
>>
>>
>> --
>>
>> Jesús Martín
>>
>> Zikzakmedia SL
>> C/ de Sant Jaume, 9, baixos, 2ª
>> 08720 Vilafranca del Penedès
>> ☏ 93 890 21 08
>>
>
>
>
> --
>
> Jesús Martín
>
> Zikzakmedia SL
> C/ de Sant Jaume, 9, baixos, 2ª
> 08720 Vilafranca del Penedès
> ☏ 93 890 21 08
>



-- 

Jesús Martín

Zikzakmedia SL
C/ de Sant Jaume, 9, baixos, 2ª
08720 Vilafranca del Penedès
☏ 93 890 21 08

Reply via email to