changeset 3abeda294665 in modules/production_work_timesheet:default
details: 
https://hg.tryton.org/modules/production_work_timesheet?cmd=changeset&node=3abeda294665
description:
        Use proper variable name for works in _set_timesheet_work
diffstat:

 work.py |  26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diffs (52 lines):

diff -r 9c9324259edc -r 3abeda294665 work.py
--- a/work.py   Sun Oct 16 14:14:11 2022 +0200
+++ b/work.py   Sun Oct 23 11:26:50 2022 +0200
@@ -82,7 +82,7 @@
             TimesheetWork.delete(timesheet_works)
 
     @classmethod
-    def _set_timesheet_work(cls, productions):
+    def _set_timesheet_work(cls, works):
         pool = Pool()
         Timesheet = pool.get('timesheet.work')
         Date = pool.get('ir.date')
@@ -90,27 +90,27 @@
         to_create = []
         to_delete = []
         to_write = defaultdict(list)
-        for production in productions:
-            with Transaction().set_context(company=production.company.id):
+        for work in works:
+            with Transaction().set_context(company=work.company.id):
                 today = Date.today()
-            if production.timesheet_available:
-                ended = production.state in {'done', 'cancelled'}
-                if not production.timesheet_works:
+            if work.timesheet_available:
+                ended = work.state in {'done', 'cancelled'}
+                if not work.timesheet_works:
                     to_create.append({
-                            'origin': str(production),
-                            'company': production.company.id,
+                            'origin': str(work),
+                            'company': work.company.id,
                             'timesheet_end_date': today if ended else None,
                             })
                 elif ended:
-                    for timesheet in production.timesheet_works:
+                    for timesheet in work.timesheet_works:
                         date = max([today]
                             + [l.date for l in timesheet.timesheet_lines])
                         to_write[date].append(timesheet)
-            if (not production.timesheet_available
-                    and production.timesheet_works):
+            if (not work.timesheet_available
+                    and work.timesheet_works):
                 if all(not w.timesheet_lines
-                        for w in production.timesheet_works):
-                    to_delete.extend(production.timesheet_works)
+                        for w in work.timesheet_works):
+                    to_delete.extend(work.timesheet_works)
         if to_create:
             Timesheet.create(to_create)
         if to_delete:

Reply via email to