Hello, I am wondering if it is possible to add a text field within the product variant section. For example, I sell House Numbers which are customized with the buyers house or street number engraved on it. How can I add a field so they can enter the number? Odoo 16 user.
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ờ
Hi,
In your module, create a Python file (e.g., models/models.py) and define a new model to store the custom field.
from odoo import models, fields
class ProductTemplate(models.Model):
_inherit = 'product.template'
engraved_number = fields.Char(string='Engraved Number')
In the same Python file, extend the product variant form view to include the custom field.
from odoo import api, fields, models
class ProductTemplate(models.Model):
_inherit = 'product.template'
engraved_number = fields.Char(string='Engraved Number')
class ProductProduct(models.Model):
_inherit = 'product.product'
engraved_number = fields.Char(string='Engraved Number', related='product_tmpl_id.
Create an XML file (e.g., views/product_variant_view.
<odoo>
<record id="product_variant_form_
<field name="name">product.product_
<field name="model">product.template<
<field name="inherit_id" ref="product.product_template_
<field name="arch" type="xml">
<group>
<field name="engraved_number"/>
</group>
</field>
</record>
</odoo>
Hope it helps
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ýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 7 25
|
744 | ||
|
1
thg 3 15
|
4522 | ||
|
1
thg 9 25
|
369 | ||
|
3
thg 5 25
|
1977 | ||
|
3
thg 11 24
|
8851 |