From 3a3dc05f61b46fdc46837a1c14da25ed9dc30ed4 Mon Sep 17 00:00:00 2001
From: benjamin <benjamin@le-filament.com>
Date: Tue, 5 Apr 2022 12:51:22 +0200
Subject: [PATCH] [fix] change env.user.company_id to env.company

---
 models/hr_timesheet.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/models/hr_timesheet.py b/models/hr_timesheet.py
index ba8b2af..8feb341 100644
--- a/models/hr_timesheet.py
+++ b/models/hr_timesheet.py
@@ -165,8 +165,8 @@ class ScopHrTimesheet(models.Model):
             )
             total = sum(lines.mapped("unit_amount"))
             if (
-                not self.env.user.company_id.day_working
-                and total > self.env.user.company_id.day_duration
+                not self.env.company.day_working
+                and total > self.env.company.day_duration
             ):
                 raise ValidationError(
                     _(
@@ -174,7 +174,7 @@ class ScopHrTimesheet(models.Model):
                         "Journée du %s"
                     )
                     % (
-                        self.env.user.company_id.day_duration,
+                        self.env.company.day_duration,
                         record.date.strftime("%d/%m/%Y"),
                     )
                 )
@@ -187,7 +187,7 @@ class ScopHrTimesheet(models.Model):
                 [
                     "|",
                     ("company_id", "=", False),
-                    ("company_id", "=", self.env.user.company_id.id),
+                    ("company_id", "=", self.env.company.id),
                     ("date_from", "<=", dt),
                     ("date_to", ">=", dt),
                 ]
-- 
GitLab