how to inherit product.product in my costume module in model,py file in
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hello Jignasha,
In py :-
class ProductProduct(models.Model):
_inherit = 'product.product'
custom_field = fields.Char('Your Field Name',size=50,select=True)
In Xml:-
<record model="ir.ui.view" id="view_product_product_form">
<field name="name">product.product.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="custom_field"/>
</field>
</field>
</record>
demo.xml :-
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="0">
<record id="hr_department_department_name" model="hr.department">
<field name="name">Department Name</field>
</record>
</data>
</odoo>
From this, In Department Name record is created in the department menu.
Hope it works for you.
Thanks,
Thanks
this demo.xml is for product.product ?
nope. this is for department. but you can create demo file same as above code. In code, model="product.product" and field which you want for product.
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký
See my updated code. Thanks,