Delegation inheritance in tryton

37 views
Skip to first unread message

Manuel Alejandro Márquez Ortiz

unread,
Nov 18, 2016, 3:25:10 PM11/18/16
to tryton-dev
Hello, I'm new in tryton and I come from Odoo. I am developing a new module and I need inherit from model product.template but I dont want extend the table product_template in the database, I want that tryton creates a new table for my model and still inherit features and fields from the model product.template. This in Odoo is done with the inherits attribute in the class of model. Is that posible in Tryton ?

Cédric Krier

unread,
Nov 18, 2016, 4:10:04 PM11/18/16
to tryton-dev
It has been removed since 2.8
http://hg.tryton.org/trytond/rev/94629ee54c66

There was many issues with this "feature" like the access rights,
default values, order resolution of _inherits, modularity against super
calls etc. But also it was quite difficult to understand for the user
(explicit is better then implicit).

There are three options.

Do you really need to have a new model? Could it not be stored in
product.template?

You can simply use a Many2One on your new model and so have an explicit
link. This is the solution the most often used in Tryton like Carrier,
Bank, Agent, etc.

Or you can do like for Product use an explicit Many2One but create
Function field which shows the value of the template.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Manuel Marquez

unread,
Nov 18, 2016, 5:50:05 PM11/18/16
to tryto...@googlegroups.com

> It has been removed since 2.8
> http://hg.tryton.org/trytond/rev/94629ee54c66
>
> There was many issues with this "feature" like the access rights,
> default values, order resolution of _inherits, modularity against super
> calls etc. But also it was quite difficult to understand for the user
> (explicit is better then implicit).
>
> There are three options.
>
> Do you really need to have a new model? Could it not be stored in
> product.template?
>
> You can simply use a Many2One on your new model and so have an explicit
> link. This is the solution the most often used in Tryton like Carrier,
> Bank, Agent, etc.
>
> Or you can do like for Product use an explicit Many2One but create
> Function field which shows the value of the template.
>

Thanks for the quick answer, I will try the last option, as is done in
product module.

Reply all
Reply to author
Forward
0 new messages