2015-10-30 37 views
2

我已經爲ODOO中的account.invoice模型創建了qweb報告。在ODOO中爲QWeb設置自定義名稱

問題:

雖然我們在網上下載報告PDF它在我的情況下,命名爲module_name.report_name喜歡它

「custom_reports_ept.report_export_invoice」

我想要做的就是下載的PDF名稱設置爲「導出 發票」「發票VDG290-15-16」(VDG290-15-16是發票號碼)」

我怎麼能這樣做呢?

這裏是我的XML代碼,

<report 
    string="Export Invoice" 
    id="account.invoice_export" 
    model="account.invoice" 
    report_type="qweb-pdf" 
    name="custom_reports_ept.report_export_invoice" 
    file="custom_reports_ept.report_export_invoice" 
/> 

這裏是qweb模板。

<template id="report_export_invoice"> 
     <t t-call="report.html_container"> 
      <t t-foreach="docs" t-as="o"> 
       <div class="page"> 
        <div class="oe_structure"/> 
        <!-- report body --> 
       </div> 
      </t> 
     </t> 
    </template> 

回答

0

我沒有在這一點上一些搜索,

  1. 在我們默認odoo我們有報告模塊,
  2. 得控制器 - > main.py
  3. 你可以找到這個對象def report_download(self, data, token)
  4. 在這個函數「docids」變量中,使用這個你可以得到查找發票記錄的id。
  5. reportname字段包含報告名稱
  6. 使用此條件:

    如果REPORTNAME == 'sale.report_saleorder': #browse發票對象這裏產生新名稱按您的要求

相關問題