2017-04-10 112 views
0

我在這個小時內無法弄清楚。我正嘗試從我創建的模塊打印表單。當我點擊打印按鈕時,我不斷收到下面的錯誤。Odoo 9 ValueError:在系統中找不到外部ID:

raise ValueError('External ID not found in the system: %s' % (xmlid)) 
ValueError: External ID not found in the system: ch08.qweb_ds_repair_template 

我report.xml將文件

<?xml version="1.0" encoding= "utf-8"?> 

    <openerp> 
     <data> 

      <template id="qweb_ds_repair_template"> 
      <t t-call="report.html_container" > 
       <t t-foreach ="docs" t-as="o"> 
        <t t-call ="report.external_layout"> 
         <div class="page" > 
          <div class="oe_structure" /> 
          <h1>Repair Form</h1> 
          <h2>Test: <span t-field="o.password"/></h2> 
         </div> 
        </t> 
       </t> 
      </t> 
     </template> 

      <report id="report_ds_repair_template" 
        name="ch08.qweb_ds_repair_template" 
        model="ds.repair" 
        string="Repair Form" 
        report_type="qweb-pdf" 

        /> 

</data> 
    </openerp> 

我的模塊文件夾名爲ds_repair。不知道如果我的在我的OpenERP 的.py缺少依賴性,因此在這裏它是低於

{ 
    'name': 'Repairs', 
    'version': '1.0', 
    'sequence': 200, 
    'category': 'Manufacturing', 
    'summary': 'Repair', 
    'description': """, 
The aim is to have a complete module to manage all products repairs. 
==================================================================== 


""", 
    'depends': ['base'], 
    'website': '', 
    'data': ['report/report.xml', 
      'model_view.xml', 

      ], 
    'demo': [], 

    'installable': True, 
    'auto_install': False, 

} 

回答

1

你的模塊文件夾名稱爲 「ds_repair」 所以,你應該寫NAME = 「ds_repair.qweb_ds_repair_template」

<report id="report_ds_repair_template" 
        name="ds_repair.qweb_ds_repair_template" 
        model="ds.repair" 
        string="Repair Form" 
        report_type="qweb-pdf" 

        /> 
0

不知道,但我認爲,在地方ds_repair的CH08導致了問題。 我很確定文字前的文字是爲名稱空間或插件(插件文件夾)名稱保留的。

<?xml version="1.0" encoding= "utf-8"?> 

<openerp> 
    <data> 

     <report id="report_ds_repair_template" 
       name="ds_repair.qweb_ds_repair_template" 
       model="ds.repair" 
       string="Repair Form" 
       report_type="qweb-pdf"/> 

     <template id="qweb_ds_repair_template"> 
      <t t-call="report.html_container" > 
       <t t-foreach ="docs" t-as="o"> 
        <t t-call ="report.external_layout"> 
         <div class="page" > 
          <div class="oe_structure" /> 
          <h1>Repair Form</h1> 
          <h2>Test: <span t-field="o.password"/></h2> 
         </div> 
        </t> 
       </t> 
      </t> 
     </template> 

    </data> 
</openerp> 
0

您有2種可能性,當你想引用另一個xml_id。

你寫:

<template inherited="module_name.xml_id"> 

這種方法的通常使用時,要在另一個模塊

引用一個ID或者你可以

<template inherited="xml_id"> 

在這種情況下,你想在寫代碼的當前模塊中引用一個id。

您的錯誤的來源可以是:

  1. 你沒有一個模塊名爲CH08
  2. 你有一個模塊名爲CH08,但你已經不是模塊
  3. 在ID「qweb_ds_repair_template」

但我認爲在你目前的情況下,你只是想引用上面的id編寫。

你可以寫

<report id="report_ds_repair_template" 
     name="module_name.qweb_ds_repair_template" 
     model="ds.repair" 
     string="Repair Form" 
     report_type="qweb-pdf"/> 

PS:當我說MODULE_NAME,這是你的文件夾的名稱。