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!!!
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
|Asked: 8/21/16, 3:36 PM|
|Seen: 129 times|
|Last updated: 8/22/16, 3:02 AM|