Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1289 Widoki

I have a use case where I have added a vehicle (from Fleet app) to Timesheets as a Many2One relationship. This allows me to track what vehicle was used on different time sheet entries and vice versa in that I can see the timesheets in which that specific vehicle was used. 


That said, sometimes a timesheet entry uses 2 different vehicles - think a Low Bed Truck AND a trailer. Using two many2one relationships does not work here. What would be the best way to go about solving this conundrum???


Any tips much appreciated.


Kind regards

Jamie

Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Modify the timesheet model to replace the existing Many2one relationship with a Many2many relationship to the vehicle model (fleet.vehicle). This can be done by changing the field type and adding the Many2many attribute.

In python:

vehicle_ids = fields.Many2many('fleet.vehicle', string='Vehicles')

In XML:

<field name="vehicle_ids" widget="many2many_tags"/>

Regards

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
kwi 23
2736
2
lut 25
40423
2
lis 22
2810
2
sie 22
4016
1
kwi 22
3104