diff --git a/models/training_training.py b/models/training_training.py
index ef46c22dbe5b818cafc9d874ae99e4bb5799b354..dca823f7aa804ff82eec9946abab23e2b5c5610c 100644
--- a/models/training_training.py
+++ b/models/training_training.py
@@ -109,8 +109,10 @@ class Training(models.Model):
 
     @api.depends('student_ids', 'cost')
     def _compute_costs(self):
-        self.student_cost = self.cost / self.students_count
-        self.rate = self.cost / self.hours_total
+        if self.students_count > 0:
+            self.student_cost = self.cost / self.students_count
+        if self.hours_total > 0:
+            self.rate = self.cost / self.hours_total
 
     @api.depends('session_ids')
     def _compute_sessions(self):