Skip to content

Commit

Permalink
Fix calendar_event.py to check res model before setting "Vehicule ser…
Browse files Browse the repository at this point in the history
…vice"

This will avoid setting the value of the "vehicle service" field when creating a meeting from models other than "fleet.vehicle.log.services"
  • Loading branch information
Zodk2 authored and OCA-git-bot committed Sep 14, 2023
1 parent e70600e commit c9b65f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fleet_vehicle_service_calendar/models/calendar_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ def default_get(self, fields):
# sync res_model / res_id to service id
# (aka creating meeting from service chatter)
ctx = self.env.context
if "vehicle_service_id" not in defaults:
if "vehicle_service_id" not in defaults and \
defaults.get("res_model") == 'fleet.vehicle.log.services':
defaults["vehicle_service_id"] = defaults.get("res_id", False) or ctx.get(
"default_res_id", False
)
Expand Down

0 comments on commit c9b65f7

Please sign in to comment.