Skip to Content
Menu
This question has been flagged

I have inherited the customer invoice report and would like to conditionally replace the field of the sales order number with a newly created field of a quotation number.  The conditional part is already in the original report as 

so it already replaces the words Order number with Quotation number depending on the doc state, but I also need to conditionally replace the "span t-field="doc.name" bit with "span t-field=doc.quotation_number" if the doc state is in quotation and I'm not sure how to correctly amend the code.  Thanks in advance.

Avatar
Discard
Best Answer

To inherit the sale order report as below:



<template id="report_saleorder_document_inherit_quotation_number" inherit_id="sale.report_saleorder_document">


    <xpath expr="//span[@t-field='doc.name']" position="replace">


        <span t-if="doc.state in ['draft','sent']" t-field="doc.quotation_number"/>


        <span t-else="" t-field="doc.name"/>


    </xpath>


</template>




The customer preview has a template which you can inherit and change it separately as below:



 <template id="portal_my_quotations_inhrit"  inherit_id="sale.portal_my_quotations">


    <xpath expr="//t[@t-out='quotation.name']" position="replace">


        <t t-out="quotation.quotation_number"/>


    </xpath>


 </template>



   


        


        


    


To inherit the sale order report as below:




```



   


        


        


    



```




The customer preview has a template which you can inherit and change it separately as below:




```


 

    


        


   


 


```



Avatar
Discard
Author

Works perfectly, thank you.

Related Posts Replies Views Activity
3
Nov 24
3702
2
Jul 23
2853
1
Mar 23
2862
2
Aug 24
3241
3
Mar 24
1793