Community mailing list archives

Re: Form view inheritance

Camptocamp SA, Guewen Baconnier - Software Developer, Camptocamp
- 09/17/2015 08:30:40
On Thu, Sep 17, 2015 at 2:13 PM, Quentin THEURET
<> wrote:
> On 17/09/2015 13:43, André P. wrote:
>> I believe you only need to add "primary" 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.
> André,
> I didn't know the 'mode' attribute for a view. But in the Fabien's case,
> the 'model' attribute of the view will be different.
> Can Odoo inherit views of a parent model for a children model ?
> In the case of product.product/product.template, product.product
> inherits from product.template (_inherits), so for Odoo, if you call
> product.product, it takes the fields/methods of product.product and
> product.template models. In the Fabien's case, maybe the Contract
> doesn't have an _inherits attribute to CommercialProposal. In this case,
> I think the 'mode' attribute on the view will not work.
> Regards,
> --
> Quentin THEURET

If the model is different, you don't even need to use the 'primary' mode.

We can find an example of this on the reporting wizards of the account module.
A base view on the model '':
A view which extends the base view for the general journal wizard:
A view which extends the base view for the general ledger wizard:

The base view is never altered here because it is on another model.

If the model was the same and you wanted to diverge a view, you'd have
to change the 'mode' of the view to 'primary'

Guewen Baconnier
Business Solutions Software Developer

Camptocamp SA
PSE A, CH-1015 Lausanne
Phone: +41 21 619 10 39
Office: +41 21 619 10 10