Hello I am currently facing an issue. I have a many2many field that creates an intermediate table called: advance_procurement_process_product_product_rel. Is it possible to access this table from Odoo? It seems to not be a Odoo model, but only a table. I need to use the intermediate table to add a new column to store a value. Is this possible?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project
- MRP
This question has been flagged
Hi,
You actually don't need to access the table to write to many2many fields.
There are actually 0-6 numbers for representing each job for a many2many/ one2many field
(0, 0, { values }) -- link to a new record that needs to be created with the given values dictionary
(1, ID, { values }) -- update the linked record with id = ID (write values on it)
(2,
ID) -- remove and delete the linked record with id = ID (calls unlink
on ID, that will delete the object completely, and the link to it as
well)
(3, ID) -- cut the link to the linked record with id = ID
(delete the relationship between the two objects but does not delete the
target object itself)
(4, ID) -- link to existing record with id = ID (adds a relationship)
(5) -- unlink all (like using (3,ID) for all linked records)
(6, 0, [IDs]) -- replace the list of linked IDs (like using (5) then (4,ID) for each ID in the list of IDs)
Or you can use commands.
(0, 0, { values }) -- Command.create({...})
(1, ID, { values }) -- Command.update({...})
(2, ID) -- Command.delete(...)
(3, ID) -- Command.unlink(...)
(4, ID) -- Command.link(...)
(5) -- Command.clear()
(6, 0, [IDs]) -- Command.set([...])
You can give the code like:your_record.write({ 'many2many_field': [(0, 0, { values })]}) or any one of the above.
Hope it helps
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Prijavi
Hello Marco,
In case of reporting i think we can use but in case of other i'm not sure.