Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to make minimal template in Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 254
    Comment on it

    In minimal template you can call the translatable document from your main template with the attribute t-lang set to a language code or to a record field.
    You also need to re-browse the related records with the proper context if you use fields that are translatable.
    For example see below code

    <!-- Main template -->
    <template id="report_saleorder">
        <t t-call="report.html_container">
            <t t-foreach="docs" t-as="doc">
                <t t-call="sale.report_saleorder_document" t-lang="doc.partner_id.lang">
            </t>
        </t>
    </t></template>
    
    <!-- Translatable template -->
    <template id="report_saleorder_document">
        <!-- Re-browse of the record with the partner lang -->
        <t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})">
        <t t-call="report.external_layout">
            <div class="page">
                <div class="oe_structure">
                <div class="row">
                    <div class="col-xs-6">
                        <strong t-if="doc.partner_shipping_id == doc.partner_invoice_id">Invoice and shipping address:</strong>
                        <strong t-if="doc.partner_shipping_id != doc.partner_invoice_id">Invoice address:</strong>
                        <div t-field="doc.partner_invoice_id" t-field-options="{&quot;no_marker&quot;: true}">
                    &lt;...&gt;
                <div class="oe_structure">
            </div>
    
    </div></div></div></div></div></t></t></template>
    

    Note-The main template calls the translatable template with doc.partner_id.lang as a t-lang parameter.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: