diff --git a/event_track_speaker_travel/models/event_track_speaker.py b/event_track_speaker_travel/models/event_track_speaker.py index 8f64d226..25045548 100644 --- a/event_track_speaker_travel/models/event_track_speaker.py +++ b/event_track_speaker_travel/models/event_track_speaker.py @@ -20,12 +20,24 @@ class EventTrackSpeaker(models.Model): @api.depends("travel_booking_ids.cost", "travel_expense_ids.cost") def _compute_travel_cost(self): - self.travel_cost = 0 - for booking in self.travel_booking_ids: - self.travel_cost += booking.cost - for expense in self.travel_expense_ids: - self.travel_cost += expense.cost + for speaker in self: + speaker.travel_cost = 0 + for booking in speaker.travel_booking_ids: + if booking.status != "draft": + speaker.travel_cost += booking.cost + for expense in speaker.travel_expense_ids: + if expense.status != "draft": + speaker.travel_cost += expense.cost @api.depends("travel_booking_ids", "travel_expense_ids") def _compute_has_travel(self): - self.has_travel = self.travel_booking_ids or self.travel_expense_ids + for speaker in self: + booking_ok = not speaker.travel_booking_ids + for booking in speaker.travel_booking_ids: + booking_ok = booking.status == "payed" + + expense_ok = not speaker.travel_expense_ids + for expense in speaker.travel_expense_ids: + expense_ok = expense.status != "draft" + + speaker.has_travel = booking_ok and expense_ok diff --git a/event_track_speaker_travel/views/event_track_speaker.xml b/event_track_speaker_travel/views/event_track_speaker.xml index 2e55ee70..a7c33bd4 100644 --- a/event_track_speaker_travel/views/event_track_speaker.xml +++ b/event_track_speaker_travel/views/event_track_speaker.xml @@ -40,4 +40,20 @@ + + event.track.speaker.tree + event.track.speaker + + + + + + + + + + diff --git a/setup/event_speaker_travel/odoo/addons/event_speaker_travel b/setup/event_speaker_travel/odoo/addons/event_speaker_travel deleted file mode 120000 index ee7a0d75..00000000 --- a/setup/event_speaker_travel/odoo/addons/event_speaker_travel +++ /dev/null @@ -1 +0,0 @@ -../../../../event_speaker_travel \ No newline at end of file diff --git a/setup/event_track_speaker_travel/odoo/addons/event_track_speaker_travel b/setup/event_track_speaker_travel/odoo/addons/event_track_speaker_travel new file mode 120000 index 00000000..db0b9750 --- /dev/null +++ b/setup/event_track_speaker_travel/odoo/addons/event_track_speaker_travel @@ -0,0 +1 @@ +../../../../event_track_speaker_travel \ No newline at end of file diff --git a/setup/event_speaker_travel/setup.py b/setup/event_track_speaker_travel/setup.py similarity index 100% rename from setup/event_speaker_travel/setup.py rename to setup/event_track_speaker_travel/setup.py