Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
10752 Lượt xem

Hello All,

For example, the model account.invoice has a many2many field payment_ids.

If I have 3 payments for an invoice, where are stored these 3 lines in the database? in which table of the database?

I know that the field definition itself is stored in ir_model_relation. But I don't find each value lines....

Thanks to help

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Many2many fields always have an intermediary table where it's stored the foreign keys of the two tables, the actual were the field is m2m defined and the pointed table of the m2m field. Using that table the records of the other table can be retrieved. The following is a definition of a many2many field with the intermediary table in bold

invoice_line_tax_id = fields.Many2many('account.tax',    'account_invoice_line_tax', 'invoice_line_id', 'tax_id',    string='Taxes', domain=[('parent_id', '=', False)])

In the case of the payment_ids of the model account.invoice it's a computed field so the records of the other table are retrieved using a the function _compute_payments of the account.invoice. The computed m2m fields don't have an intermediary table

Ảnh đại diện
Huỷ bỏ
Tác giả

Axel, if you were in my town, be sure that I would do anything I can to be your friend. I send you 1000 x thanks!

Nice to hear that, we don't need to be in the same town to be friends :)

Bài viết liên quan Trả lời Lượt xem Hoạt động
Odoo Table Name Đã xử lý
1
thg 4 20
12726
5
thg 4 23
16264
1
thg 9 19
2885
1
thg 2 16
3705
0
thg 3 15
3981