Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Where are stored each line of a many2many field in the database?

By
Pascal Tremblay
on 2/8/16, 8:19 PM 817 views

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

1

Axel Mendoza

--Axel Mendoza--
10203
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 2/8/16, 9:05 PM

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

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!

Pascal Tremblay
on 2/8/16, 9:13 PM

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

Axel Mendoza
on 2/8/16, 9:16 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 2/8/16, 8:19 PM
Seen: 817 times
Last updated: 2/8/16, 9:14 PM