From 6c2adb4ae741ef785912c2f066d66ba819c1531f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt?= Date: Mon, 18 Nov 2024 16:55:09 +0100 Subject: [PATCH] fix env --- account_invoice_subcontractor/models/subcontractor_work.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/account_invoice_subcontractor/models/subcontractor_work.py b/account_invoice_subcontractor/models/subcontractor_work.py index b4ebcc8..7ed0746 100644 --- a/account_invoice_subcontractor/models/subcontractor_work.py +++ b/account_invoice_subcontractor/models/subcontractor_work.py @@ -433,11 +433,11 @@ def _scheduler_action_subcontractor_invoice_create(self, days=7): if subcontractor.subcontractor_type == "internal": dest_company = subcontractor.subcontractor_company_id user = subcontractor.user_id - self = self.with_user(user).with_company(dest_company) + new_self = self.with_user(user).with_company(dest_company) else: # Used to group by invoice also for external in case of the cron - self = self.with_context(invoice_create_cron=True) - subcontractor_works = self.search( + new_self = self.with_context(invoice_create_cron=True) + subcontractor_works = new_self.search( [ ("id", "in", all_works.ids), ("employee_id", "=", subcontractor.id),