2015-11-03 51 views
0

我自定義銷售模塊,因爲我隱藏了銷售訂單FORM VIEW中的一些字段。當我去打印發票時,會顯示一些空的字段,這些字段是我在表單視圖中已經隱藏的字段。如何隱藏openerp中某些模塊的qweb報告中的字段?

所以我想讓這些字段也隱藏在報告中。這樣做的方法是什麼,任何想法?

Reference: 
Sales/Quotations/ print : sale.report_saleorder.pdf 

因此,我想隱藏Taxes字段。

回答

1

您可以在報告中幾乎像在表單視圖中一樣隱藏所需的那些字段。在視圖文件夾中創建一個XML文件並將其添加到__openerp__.py。啓動文件是這樣的:

<?xml version="1.0" encoding="utf-8"?> 
<openerp> 
    <data> 
     <template id="report_saleorder_document_customized" inherit_id="sale.report_saleorder_document"> 
     ... 

從這裏開始,你必須使用xpath標記來定位你的項目,並(使用position="attributes"/"replace")使他們在你一個簡單的表格視圖做同樣的方式無形。

問候。

0

您可以使用下面的代碼隱藏qweb報告中的某個部分。

在這裏,我想隱藏稅表和更改的字符串值,並隱藏Inovice報表的付款期限。

<?xml version="1.0" encoding="utf-8"?> 
<odoo> 
    <data> 
     <template id="report_invoice_document_inherit" inherit_id="account.report_invoice_documnet"> 
      <!-- Changed 'Draft Invoice' to 'Tax Invoice' and 'Invoice' to 'Tax Invoice'--> 
      <xpath expr="//div[@class='page']/h2/span[1]" position="replace"> 
       <span t-if="o.type == 'out_invoice' and (o.state in ('draft', 'open', 'paid'))">Tax Invoice</span> 
      </xpath> 
      <!-- Hide span --> 
      <xpath expr="//div[@class='page']/h2/span[3]" position="replace"/> 
      <!--Hide Tax table --> 
      <xpath expr="//div[@class='page']/div[4]" position="attributes"> 
       <attribute name="class">hidden</attribute> 
      </xpath> 

      <!-- Hide payment term value from invoice report --> 
      <xpath expr="//div[@class='page']/p[2]" position="attributes"> 
       <attribute name="class">hidden</attribute> 
      </xpath> 
     </template> 
    </data> 
</odoo> 

希望以上代碼可以幫助您。

最好的感謝,

ANKIT^h甘地。

相關問題