跳至內容
選單
此問題已被標幟
1 回覆
2552 瀏覽次數

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.

頭像
捨棄
最佳答案

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:




```


 

    


        


   


 


```



頭像
捨棄
作者

Works perfectly, thank you.

相關帖文 回覆 瀏覽次數 活動
3
11月 24
3703
2
7月 23
2855
1
3月 23
2863
2
8月 24
3242
3
3月 24
1793