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

my fields does not show up for some reason.  what im i missing

from openerp import models, fields, api
class ProductProduct(models.Model):
    _inherit = 'product.product'
    boatlenght = fields.Char(string="Lenght of the Boat", required=False, size=10 )    fuelcapacity = fields.Char(string="Fuel Capacity", required=False, size=10 )
<?xml version="1.0" encoding="utf-8"?> <openerp> <data> <!-- Inherit Form View to Modify it --> <record id="product_product_template_only_form_view" model="ir.ui.view"> <field name="name">new_view</field> <field name="model">product.product</field> <field name="inherit_id" ref="product.product_template_only_form_view"/> <field name="arch" type="xml"> <field name="list_price" position="after"> <field name="boatlenght"/> <field name="fuelcapacity"/> </field> </field> </record> </data></openerp>    
頭像
捨棄

Could you please edit your question and insert proper line breaks?

Your question should be precise and readable , other wise you may get down-votes !

最佳答案

I think you are overriding wrong view. So try like this,

#your_model.py
class ProductProduct(models.Model):
    _inherit = 'product.template'
    boatlenght = fields.Char(string="Lenght of the Boat", required=False, size=10 )
    fuelcapacity = fields.Char(string="Fuel Capacity", required=False, size=10 )     
<!-your_view.xml->
<record id="product_product_template_form_view" model="ir.ui.view">
     <field name="name">new_view</field>
     <field name="model">product.template</field>
     <field name="inherit_id" ref="product.product_template_form_view"/>
     <field name="arch" type="xml">
         <xpath expr="//field[@name='list_price']" position="after">
             <field name="boatlenght"/>
             <field name="fuelcapacity"/>
         </xpath>
     </field>
</record>

thanks.

頭像
捨棄
最佳答案

Please check it in "Product Variants", i think it will be there.

or if you need to show in product , Use "product.template" model. and inherit it

頭像
捨棄
作者 最佳答案

i trying but getting 403 – Forbidden! when hit save button ... 

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
11月 24
1307
1
6月 24
1341
1
5月 24
2651
1
3月 24
50
1
10月 21
5475