Community mailing list archives

Re: Form view inheritance

by André P. <> - 09/17/2015 07:41:00
I believe you only need to add "<field name="mode">primary</field>" to the new view.

Your approach seems fine, and is consistent with Odoo's own approach to the Product Template / Product Product. The Form view of Product.Product inherits from the Form view of Product.Template, but it doesn't show when you open a Product.Template.

2015-09-17 12:23 GMT+01:00 Fabien MORIN <>:
Hi all,
I'm very new to odoo development, I'm still learning, so may be my 
question is obvious to you, but I didn't find the answer in the official 
doc and I like to start with good practices. May be its not the right 
place to post, please correct me if I'm wrong.

I wan't to have a form view which inherit from another one, adding one 
field to it, but keeping the first one without this new field.

The concrete case example is that I have a class CommercialProposal and 
a class Contract which inherit from CommercialProposal.
A Contract is more ore less the same than a CommercialProposal, a 
Contract just have more properties and methods. From a 
CommercialProposal it's possible to generate a Contract, and define 
properties that are not available in CommercialProposal.
Of course I could solve this issue by cloning the xml form one class to 
another (120 lines), but then it will be harder to maintain, modify, and 
more risk of mistakes.

Is it possible to reuse the CommercialProposal form view for Contract 
just adding some new fields, which make the maintenance more simple and 
consistency much better ?

Or maybe my approach is not good or not odoo way, what is the best 
approch to do it ?

Many thanks for the guidance

Fabien MORIN

Post to:

 André Paramés 
m  +351 939 158 257
 LISBOA | Avenida das Túlipas, nº 6, 13º A/B  1495-161 Algés