Community mailing list archives

community@mail.odoo.com

Re: Form view inheritance

by
Fabien MORIN
- 09/18/2015 03:26:49
Thank you guys, I'm able to code what I want about forms now.
To bring my piece of information, to clarify the use of the primary mode, in the documentation, I found :

View matching

  * if a view is requested by |(model, type)|, the view with the right model and type, |mode=primary| and the lowest priority is matched
  * when a view is requested by |id|, if its mode is not |primary| its /closest/ parent with mode |primary| is matched


Le 17/09/2015 14:35, Guewen Baconnier a écrit :
> On Thu, Sep 17, 2015 at 2:13 PM, Quentin THEURET > <odoo@quentin-theuret.net> 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 'account.common.report': > https://github.com/odoo/odoo/blob/8.0/addons/account/wizard/account_report_common_view.xml#L5-L42 > >
A view which extends the base view for the general journal wizard:
> https://github.com/odoo/odoo/blob/8.0/addons/account/wizard/account_report_general_journal_view.xml#L5-L17 > >
A view which extends the base view for the general ledger wizard:
> https://github.com/odoo/odoo/blob/8.0/addons/account/wizard/account_report_general_ledger_view.xml#L5-L23 > > >
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 http://www.camptocamp.com/ > > _______________________________________________ Mailing-List: > https://www.odoo.com/groups/community-59 Post to: > mailto:community@mail.odoo.com Unsubscribe: > https://www.odoo.com/groups?unsubscribe >

--
Fabien MORIN
TeMPO Consulting
20, avenue de la Paix
67000 Strasbourg
France

http://www.tempo-consulting.fr
Tel   : +33 3 88 56 82 17
Fax   : +33 9 70 63 35 46