Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I've created a many2many field in the sale.order model that it's related with fleet.vehicle model (id).
How it's showed in the follow image:
IMAGE 1: http://es.zimagez.com/zimage/defm2m.php
Well, the 'x_vehiculo' field is a multi-selection field, How it's showed in the follow image:
IMAGE 2: http://es.zimagez.com/zimage/m2mmulti.php
The idea is that for each sale order i can to store more that 1 vehicle.
The trouble is that i can't see the value for of x_vehiculo' field for each sale order when i make a query in the SGB Postgresql (PgAdmin III).
IMAGE 3: http://es.zimagez.com/zimage/salida2.php
There is any way to can retrieve values of 'x_vehicle' multi-selection field for each sale.order?
Please if somebody could help me. I'd be very gratefull.
Thanks you so much
In your case the values of the records will be stored in the : x_fleet_vehicle_sale_order_rel. so you can query this table to get the result or make a JOIN to this table to get the data you want.
Also if you have a recordset [browse record] you can access these records directly as:
sale_object.x_vehiculo; this will return a recordset of the vehicles in the relation ...
Hope this could helps
James, many2many records are stored in a seperate table..
While creating many2many field, if u remember the structure,
x_vehiculo = fields.many2many('fleet.vehicle', '<NEW_TABLE>', 'sale_id', 'vehicle_id', '<STRING>')
your structure must be something like this.....
here, <New Table> is the table on which u can query to get records and sale_id is id for sale.order and vehicle_id is for fleet.vehicle, like:
"select vehicle_id from <NEW_TABLE> where sale_id = <ID>";
hope it help!!!
About This Community
This platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 8/21/16, 3:36 PM|
|Seen: 381 times|
|Last updated: 8/22/16, 3:02 AM|