python - How to add fields in existing class in odoo -
please want add fields in existing class in odoo 'product_template'. here code:
class product_template(models.model): #inhertis model product.template _inherit = 'product.template' _name = 'product.template' _columns = { 'costprice' : fields.float('buy price'), 'shippingcost' : fields.float('shipping cost'), 'fieldaftergroup' : fields.char(string='field after group'), 'fieldnewpage' : fields.char(string='field new page'), } and xml:
<record id="view_product_form_inherit" model="ir.ui.view"> <field name="name">product.template.common.form.inherit</field> <field name="model">product.template</field> <field name="inherit_id" ref="product.product_template_form_view"/> <xpath expr="//page[@string='information']" position="after"> <page name="sample" string="custom page"> <group> <field name="fieldnewpage"/> </group> </page> </xpath> <xpath expr="//page[@string='information']/group" position="after"> <group> <field name="fieldaftergroup"/> </group> </xpath> </record> <record model="ir.ui.view" id="view_product_form_inherit_tree"> <field name="name">product.template.common.form.inherit.tree</field> <field name="model">product.template</field> <field name="type">tree</field> <field name="arch" type="xml"> <tree string="services" > <field name="fieldnewpage"/> <field name="fieldaftergroup"/> </tree> </field> </record> <record model="ir.actions.act_window" id="action_product"> <field name="name">product.template</field> <field name="res_model">product.template</field> <field name="view_type">form</field> <field name="view_mode">tree,form</field> </record> but got error: 'module' object has no attribute 'integer'
can me please or explain me how modify existing fields in odoo please.
you can try code odoo 8
class product_template(models.model): #inhertis model product.template _inherit = 'product.template' _name = 'product.template' costprice = fields.float('buy price') shippingcost = fields.float('shipping cost') fieldaftergroup = fields.char(string='field after group') fieldnewpage = fields.char(string='field new page')
Comments
Post a Comment