2014-12-29 20 views
0

我嘗試在產品中實現新選項卡,但是當我插入我的附加組件時,它會更改用戶界面視圖中的所有繼承視圖。Odoo產品模板實施新選項卡

product.template.product.form成爲product.template.clicshopping !!

我是Odoo的新手,我會很感激的。 我不覺得在我的錯誤

謝謝

我__openerp__.py

'data': [ 
     'security/ir.model.access.csv', 
     'product_clicshopping_view.xml', 
], 

我ir.model.access.csv

id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink 

access_product_template_clicshopping,product.template clicshopping,product.model_product_template,base.group_sale_manager,1,1,1,1 

我的clicshopping.py

from openerp import models, api, fields 

class product_clicshopping(models.Model): 
    _name = 'product_template' 
# _inherit = 'product_template' 
    _columns = { 
#  'clicshopping_products_id': fields.integer('Product Id', size=5, help="Id product table of ClicShopping "), 
    } 

我product_clicshopping_view.xml

<?xml version="1.0" encoding="utf-8" ?> 
<openerp> 
    <data> 
     <record model="ir.ui.view" id="product.product_template_form_view"> 
      <field name="name">product.template.clicshopping.form</field> 
<!-- 
      <field name="model">product.template</field> 
      <field name="arch" type="xml"> 
       <notebook> 
        <page string="ClicShopping"> 
         <group colspan="4"> 
          <field name="clicshopping_product_id"/> 
         </group> 
        </page> 
       </notebook> 
      </field> 
--> 
     </record> 
    </data> 
</openerp> 

回答

1

1 /其實這裏你已經覆蓋的「product.product_template_form_view」,這是造成問題的原因,而不是你應該繼承查看原始視圖。嘗試查找展示如何繼承視圖的示例。您可以在xml文件中搜索「inherit_id」,這將幫助您找到這些示例。

2.同樣在'.py'文件中你已經評論了'_inherit'這一行,你應該保持這種打開狀態,否則你會定義一個新的'product.template'模型。取消註釋該行並保留該行。

+0

謝謝Hardik,2 /。如果我分解這行_inherit ='product_template',我有一個內部服務器錯誤(500)。我不明白爲什麼。我會嘗試解決方案1./ – Kurama

+0

取消註釋該行並寫入'product.template'而不是'product_template'。也在變量'_name'下,它應該是'product.template'。 –

+0

Does'nt工作,我不明白爲什麼。問題是當我重新啓動odoo時。是否有可能看我的發展,並告訴我是否在良好的方向。 http://goo.gl/IqbYLl(我包含一個叫做clicshopping的zip)。謝謝 – Kurama