true
true

Reputation: 41

Odoo Qweb template development workflow and best practices

Senior dev learning Odoo 15 for the first time. I've been frustrated by my lack of productivity with Qweb and what should be very basic tasks of overriding the default layouts and html in my own custom theme module. I feel I would be much more efficient if I could answer the following questions:

Upvotes: 1

Views: 1104

Answers (1)

Scott
Scott

Reputation: 142

  1. Have you looked at "Settings > Technical > User Interface > Views" (debug mode)? You can view all the views Odoo uses.
  2. After finding the view you need to inherit, you can search for the view's external id through your server or github for the related xml file in the source code (ie 'grep -R "invoice_form" *).
  3. You can inherit any view in a custom module and modify it as needed.

Qweb:

 <template id="products_custom" inherit_id="website_sale.products" name="Products">
        <xpath expr="//h3[@class='css_editable_display']" position="replace">
           ...
        </xpath>
  </template>

Form view:

<record id="account_invoice_form_custom" model="ir.ui.view">
    <field name="name">account.invoice.form.custom</field>
    <field name="model">account.invoice</field>
    <field name="inherit_id" ref="account.invoice_form" />
    <field name="arch" type="xml">
        <field name="partner_id" position="after">
             <field name="custom_field"/>  
        </field>
    </field>
</record>
  1. Check out these links for more info about inheriting xml views. https://doc.odoo.com/6.0/developer/2_6_views_events/views/view_inheritence/ https://www.odoo.com/forum/help-1/how-to-inherit-view-in-existing-module-94801

Upvotes: 1

Related Questions