Community mailing list archives

Form view inheritance

Fabien MORIN
- 09/17/2015 07:19:01
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