Im stuck on a one2many inverse field to add new lines into my one2many fields. I will appreciate any help i can get.
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ờ
Code please ;)
What is the problem ?
class class_one()
_name = 'class.one'
_columns = {
'your_one2many_field': fields.one2many('class.two','field_m2o_from_class_two', string="Field name"),
}
class class_two()
_name = 'class.two'
_columns = {
'your_field_many2one': fields.many2one('class.one', 'Name'),
......
other fields you want in tree
}
view:
<group name="sold">
<field name="your_one2many_field">
<tree>
<field name="field 1 from class_two"/>
<field name="field 2 from class_two"/>
<field name="field 3 from class_two"/>
<field name="field 4 from class_two"/>
<field name="field 5 from class_two"/>
<field name="field 6 from class_two"/>
"/>
</tree>
</field>
should be ok ;)
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 | |
---|---|---|---|---|
|
0
thg 4 18
|
5366 | ||
|
1
thg 1 25
|
2138 | ||
|
1
thg 1 24
|
4167 | ||
|
2
thg 9 22
|
9815 | ||
|
2
thg 4 22
|
4844 |
The one2many is a computed field already, so i am trying to use inverse to add new lines into this field. Presently what it does is to just allow the already existing fields to be edited
@api.one def accumulate_files(self): documents = self.env['document.customer'] document_gotten = documents.search([('name','=', self.name)]) for docs in document_gotten: self.res_line_ids |= docs.customer_line_ids @api.one def edit_accumulate_files(self): documents = self.env['document.customer'] for lines in documents.customer_line_ids: lines.write(self.res_line_ids)