[tryton-debian-vcs] tryton-modules-timesheet branch debian updated. debian/2.8.0-3-7-gc2b0262

git repository hosting tryton-debian-vcs at m9s.biz
Mon Nov 25 19:38:51 UTC 2013


The following commit has been merged in the debian branch:
http://debian.tryton.org/gitweb/?p=packages/tryton-modules-timesheet.git;a=commitdiff;h=debian/2.8.0-3-7-gc2b0262

commit c2b02621b8fd016fdc0b1535e4325259209257c6
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Nov 25 20:30:42 2013 +0100

    Releasing debian version 3.0.0-1.

diff --git a/debian/changelog b/debian/changelog
index 9c78dfd..cb5a779 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+tryton-modules-timesheet (3.0.0-1) unstable; urgency=low
+
+  * Merging upstream version 3.0.0.
+  * Adding NEWS for refactored module tryton-modules-timesheet.
+  * Updating to standards version 3.9.5, no changes needed.
+  * Changing to buildsystem pybuild.
+  * Correcting format of NEWS file.
+  * Adding python-sql to Depends.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Mon, 25 Nov 2013 17:55:52 +0100
+
 tryton-modules-timesheet (2.8.0-3) unstable; urgency=low
 
   * Adapting the rules file to work also with git-buildpackage.
commit e629074523d391fdbfd73a2d85853c14cc1e6c97
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Nov 25 17:50:24 2013 +0100

    Adding python-sql to Depends.

diff --git a/debian/control b/debian/control
index 432f010..62831bf 100644
--- a/debian/control
+++ b/debian/control
@@ -16,7 +16,8 @@ Architecture: all
 Depends:
  ${misc:Depends}, ${python:Depends}, tryton-server (>= ${version:major}),
  tryton-modules-company (>= ${version:major}),
- tryton-modules-company-work-time (>= ${version:major}), python-pkg-resources
+ tryton-modules-company-work-time (>= ${version:major}),
+ python-sql, python-pkg-resources
 Description: Tryton Application Platform (Timesheet Module)
  Tryton is a high-level general purpose application platform written in Python
  and using PostgreSQL as database engine. It is the core base of a complete
commit a6bb24ed352af2cd30f9e287570d5013234372bc
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Nov 25 17:13:58 2013 +0100

    Correcting format of NEWS file.

diff --git a/debian/NEWS b/debian/NEWS
index 1626122..e3aa0b1 100644
--- a/debian/NEWS
+++ b/debian/NEWS
@@ -1,16 +1,13 @@
 tryton-modules-timesheet (3.0.0-1) unstable; urgency=low
 
- * The cost functionality for employees on timesheets was refactored
- into the new  package tryton-modules-timesheet-cost. Any module using
- those methods must now depend on the new module.
-
- If the new module tryton-modules-timesheet-cost was pulled in as dependency
- you must register it in existing databases with
-
- # trytond -i tryton-modules-timesheet-cost -d <database>
-
- before being able to do the ususal upgrade with 
-
- # trytond -u all -d <database>
+    The cost functionality for employees on timesheets was refactored
+    into the new package tryton-modules-timesheet-cost. Any module using
+    these methods must now depend on the new module.
+
+    If the new module tryton-modules-timesheet-cost was pulled in as dependency
+    you must register it in existing databases with
+      # trytond -i tryton-modules-timesheet-cost -d <database>
+    before being able to do the ususal upgrade with
+      # trytond -u all -d <database>
 
  -- Mathias Behrle <mathiasb at m9s.biz>  Sun, 24 Nov 2013 17:48:10 +0100
commit 3f60a16074506c052ba5e957a5a851536646a158
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 19:51:52 2013 +0100

    Changing to buildsystem pybuild.

diff --git a/debian/control b/debian/control
index 94d1865..432f010 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,8 @@ Section: python
 Priority: optional
 Maintainer: Debian Tryton Maintainers <maintainers at debian.tryton.org>
 Uploaders: Mathias Behrle <mathiasb at m9s.biz>
-Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools
+Build-Depends:
+ debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools, dh-python
 Standards-Version: 3.9.5
 Homepage: http://www.tryton.org/
 Vcs-Browser: http://debian.tryton.org/gitweb/?p=packages/tryton-modules-timesheet.git
diff --git a/debian/rules b/debian/rules
index 30074ad..5b8c326 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,24 +1,17 @@
 #!/usr/bin/make -f
 
-MAJOR := $(shell python setup.py --version | awk -F "." '{print $$1 "." $$2}')
-PACKAGE_NAME := $(shell python setup.py --name)
-
-%:
-	dh ${@} --with python2
+# needed for pbuilder
+export LC_ALL=C.UTF-8
 
-override_dh_auto_clean:
-	dh_auto_clean
+MAJOR := $(shell python setup.py --version | awk -F "." '{print $$1 "." $$2}')
+PACKAGE_NAME := tryton-modules-$(shell python setup.py --name | sed s/^trytond_// | sed s/_/-/g)
+export PYBUILD_DESTDIR_python2=debian/${PACKAGE_NAME}
 
-override_dh_auto_build:
-	mv $(PACKAGE_NAME).egg-info $(PACKAGE_NAME).hen-info
-	mv PKG-INFO PKG-INFO.hen
-	dh_auto_build
+# Don't run tests for Tryton modules, they try to download dependencies from pypi
+export PYBUILD_DISABLE_python2.7=test
 
-override_dh_auto_install:
-	dh_auto_install
-	rm -rf *.egg-info
-	mv $(PACKAGE_NAME).hen-info $(PACKAGE_NAME).egg-info
-	mv PKG-INFO.hen PKG-INFO
+%:
+	dh ${@} --with python2 --buildsystem=pybuild
 
 override_dh_gencontrol:
 	dh_gencontrol -- -Vversion:major="$(MAJOR)"
commit 511885326df982bdc2242b920e78694b9182f853
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 19:14:21 2013 +0100

    Updating to standards version 3.9.5, no changes needed.

diff --git a/debian/control b/debian/control
index f284743..94d1865 100644
--- a/debian/control
+++ b/debian/control
@@ -4,7 +4,7 @@ Priority: optional
 Maintainer: Debian Tryton Maintainers <maintainers at debian.tryton.org>
 Uploaders: Mathias Behrle <mathiasb at m9s.biz>
 Build-Depends: debhelper (>= 9), python (>= 2.6.6-3~), python-setuptools
-Standards-Version: 3.9.4
+Standards-Version: 3.9.5
 Homepage: http://www.tryton.org/
 Vcs-Browser: http://debian.tryton.org/gitweb/?p=packages/tryton-modules-timesheet.git
 Vcs-Git: git://debian.tryton.org/packages/tryton-modules-timesheet.git
commit d03d0df1c83b6bab57c7b9be80486d32b8b8e7f3
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 17:59:10 2013 +0100

    Adding NEWS for refactored module tryton-modules-timesheet.

diff --git a/debian/NEWS b/debian/NEWS
new file mode 100644
index 0000000..1626122
--- /dev/null
+++ b/debian/NEWS
@@ -0,0 +1,16 @@
+tryton-modules-timesheet (3.0.0-1) unstable; urgency=low
+
+ * The cost functionality for employees on timesheets was refactored
+ into the new  package tryton-modules-timesheet-cost. Any module using
+ those methods must now depend on the new module.
+
+ If the new module tryton-modules-timesheet-cost was pulled in as dependency
+ you must register it in existing databases with
+
+ # trytond -i tryton-modules-timesheet-cost -d <database>
+
+ before being able to do the ususal upgrade with 
+
+ # trytond -u all -d <database>
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Sun, 24 Nov 2013 17:48:10 +0100
commit 64742e0b8de8dd8d62709e15e561b5cf5f14613b
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 17:28:47 2013 +0100

    Merging upstream version 3.0.0.

diff --git a/CHANGELOG b/CHANGELOG
index 8a6f641..9dc6baf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.0.0 - 2013-10-21
+* Bug fixes (see mercurial logs for details)
+
 Version 2.8.0 - 2013-04-22
 * Bug fixes (see mercurial logs for details)
 * Add start/end date to work for timesheet
diff --git a/INSTALL b/INSTALL
index e8cb52c..0b5f2eb 100644
--- a/INSTALL
+++ b/INSTALL
@@ -5,6 +5,7 @@ Prerequisites
 -------------
 
  * Python 2.6 or later (http://www.python.org/)
+ * python-sql (http://code.google.com/p/python-sql/)
  * trytond (http://www.tryton.org/)
  * trytond_company (http://www.tryton.org/)
  * trytond_company_work_time (http://www.tryton.org/)
diff --git a/PKG-INFO b/PKG-INFO
index 2b7b9b8..c597dcd 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_timesheet
-Version: 2.8.0
+Version: 3.0.0
 Summary: Tryton module with timesheets
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.8/
+Download-URL: http://downloads.tryton.org/3.0/
 Description: trytond_timesheet
         =================
         
@@ -60,6 +60,7 @@ Classifier: Natural Language :: English
 Classifier: Natural Language :: French
 Classifier: Natural Language :: German
 Classifier: Natural Language :: Russian
+Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.6
diff --git a/line.py b/line.py
index 541b016..f310df6 100644
--- a/line.py
+++ b/line.py
@@ -1,8 +1,12 @@
 #This file is part of Tryton.  The COPYRIGHT file at the top level of
 #this repository contains the full copyright notices and license terms.
+from sql import Literal
+from sql.aggregate import Max, Sum
+from sql.conditionals import Coalesce
+from sql.functions import Extract
+
 from trytond.model import ModelView, ModelSQL, fields
 from trytond.wizard import Wizard, StateView, StateAction, Button
-from trytond.backend import FIELDS
 from trytond.pyson import Eval, PYSONEncoder, Date, Get
 from trytond.transaction import Transaction
 from trytond.pool import Pool
@@ -18,7 +22,7 @@ class Line(ModelSQL, ModelView):
     __name__ = 'timesheet.line'
     employee = fields.Many2One('company.employee', 'Employee', required=True,
         select=True, domain=[
-            ('company', '=', Get(Eval('context', {}), 'company')),
+            ('company', '=', Eval('context', {}).get('company', -1)),
             ])
     date = fields.Date('Date', required=True, select=True)
     hours = fields.Float('Hours', digits=(16, 2), required=True)
@@ -76,7 +80,7 @@ class EnterLinesStart(ModelView):
     'Enter Lines'
     __name__ = 'timesheet.line.enter.start'
     employee = fields.Many2One('company.employee', 'Employee', required=True,
-            domain=[('company', '=', Get(Eval('context', {}), 'company'))])
+            domain=[('company', '=', Eval('context', {}).get('company', -1))])
     date = fields.Date('Date', required=True)
 
     @staticmethod
@@ -126,25 +130,24 @@ class HoursEmployee(ModelSQL, ModelView):
 
     @staticmethod
     def table_query():
-        clause = ' '
-        args = [True]
+        pool = Pool()
+        Line = pool.get('timesheet.line')
+        line = Line.__table__()
+        where = Literal(True)
         if Transaction().context.get('start_date'):
-            clause += 'AND date >= %s '
-            args.append(Transaction().context['start_date'])
+            where &= line.date >= Transaction().context['start_date']
         if Transaction().context.get('end_date'):
-            clause += 'AND date <= %s '
-            args.append(Transaction().context['end_date'])
-        return ('SELECT DISTINCT(employee) AS id, '
-                'MAX(create_uid) AS create_uid, '
-                'MAX(create_date) AS create_date, '
-                'MAX(write_uid) AS write_uid, '
-                'MAX(write_date) AS write_date, '
-                'employee, '
-                'SUM(COALESCE(hours, 0)) AS hours '
-            'FROM timesheet_line '
-            'WHERE %s '
-            + clause +
-            'GROUP BY employee', args)
+            where &= line.date <= Transaction().context['end_date']
+        return line.select(
+            line.employee.as_('id'),
+            Max(line.create_uid).as_('create_uid'),
+            Max(line.create_date).as_('create_date'),
+            Max(line.write_uid).as_('write_uid'),
+            Max(line.write_date).as_('write_date'),
+            line.employee,
+            Sum(Coalesce(line.hours, 0)).as_('hours'),
+            where=where,
+            group_by=line.employee)
 
 
 class OpenHoursEmployeeStart(ModelView):
@@ -192,23 +195,25 @@ class HoursEmployeeWeekly(ModelSQL, ModelView):
 
     @classmethod
     def table_query(cls):
-        type_name = FIELDS[cls.year._type].sql_type(cls.year)[0]
-        return ('SELECT id, create_uid, create_date, write_uid, write_date, '
-                'CAST(year AS ' + type_name + ') AS year, week, '
-                'employee, hours '
-            'FROM ('
-                'SELECT EXTRACT(WEEK FROM date) + '
-                    'EXTRACT(YEAR FROM date) * 100 + '
-                    'employee * 1000000 AS id, '
-                'MAX(create_uid) AS create_uid, '
-                'MAX(create_date) AS create_date, '
-                'MAX(write_uid) AS write_uid, '
-                'MAX(write_date) AS write_date, '
-                'EXTRACT(YEAR FROM date) AS year, '
-                'EXTRACT(WEEK FROM date) AS week, employee, '
-                'SUM(COALESCE(hours, 0)) AS hours '
-            'FROM timesheet_line '
-            'GROUP BY year, week, employee) AS ' + cls._table, [])
+        pool = Pool()
+        Line = pool.get('timesheet.line')
+        line = Line.__table__()
+        type_name = cls.year.sql_type().base
+        year_column = Extract('YEAR', line.date).cast(type_name).as_('year')
+        week_column = Extract('WEEK', line.date).as_('week')
+        return line.select(
+            Max(Extract('WEEK', line.date)
+                + Extract('YEAR', line.date) * 100
+                + line.employee * 1000000).as_('id'),
+            Max(line.create_uid).as_('create_uid'),
+            Max(line.create_date).as_('create_date'),
+            Max(line.write_uid).as_('write_uid'),
+            Max(line.write_date).as_('write_date'),
+            year_column,
+            week_column,
+            line.employee,
+            Sum(Coalesce(line.hours, 0)).as_('hours'),
+            group_by=(year_column, week_column, line.employee))
 
 
 class HoursEmployeeMonthly(ModelSQL, ModelView):
@@ -228,20 +233,22 @@ class HoursEmployeeMonthly(ModelSQL, ModelView):
 
     @classmethod
     def table_query(cls):
-        type_name = FIELDS[cls.year._type].sql_type(cls.year)[0]
-        return ('SELECT id, create_uid, create_date, write_uid, write_date, '
-                'CAST(year AS ' + type_name + ') AS year, month, '
-                'employee, hours '
-            'FROM ('
-                'SELECT EXTRACT(MONTH FROM date) + '
-                    'EXTRACT(YEAR FROM date) * 100 + '
-                    'employee * 1000000 AS id, '
-                'MAX(create_uid) AS create_uid, '
-                'MAX(create_date) AS create_date, '
-                'MAX(write_uid) AS write_uid, '
-                'MAX(write_date) AS write_date, '
-                'EXTRACT(YEAR FROM date) AS year, '
-                'EXTRACT(MONTH FROM date) AS month, employee, '
-                'SUM(COALESCE(hours, 0)) AS hours '
-            'FROM timesheet_line '
-            'GROUP BY year, month, employee) AS ' + cls._table, [])
+        pool = Pool()
+        Line = pool.get('timesheet.line')
+        line = Line.__table__()
+        type_name = cls.year.sql_type().base
+        year_column = Extract('YEAR', line.date).cast(type_name).as_('year')
+        month_column = Extract('MONTH', line.date).as_('month')
+        return line.select(
+            Max(Extract('MONTH', line.date)
+                + Extract('YEAR', line.date) * 100
+                + line.employee * 1000000).as_('id'),
+            Max(line.create_uid).as_('create_uid'),
+            Max(line.create_date).as_('create_date'),
+            Max(line.write_uid).as_('write_uid'),
+            Max(line.write_date).as_('write_date'),
+            year_column,
+            month_column,
+            line.employee,
+            Sum(Coalesce(line.hours, 0)).as_('hours'),
+            group_by=(year_column, month_column, line.employee))
diff --git a/locale/bg_BG.po b/locale/bg_BG.po
index ea6b806..18f4123 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -12,6 +12,12 @@ msgid ""
 " and \"%(parent)s\" are in different companies."
 msgstr ""
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr "Създадено на"
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index 5923ff2..dbc9343 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -14,6 +14,14 @@ msgstr ""
 "Tot treball ha d'estar a la mateixa empresa que el seu pare, però "
 "\"%(child)s\" i \"%(parent)s\" estan a empreses diferents."
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+"No podeu desactivar \"Disponible en fulls de treball\" pel treball \"%s\" "
+"perquè ja té fulls de treball."
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr "Data creació"
@@ -250,6 +258,7 @@ msgctxt "field:timesheet.work,timesheet_end_date:"
 msgid "Timesheet End"
 msgstr "Final de full de treball"
 
+#, fuzzy
 msgctxt "field:timesheet.work,timesheet_lines:"
 msgid ""
 msgstr ""
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index fcb4794..eadd0af 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -12,6 +12,12 @@ msgid ""
 " and \"%(parent)s\" are in different companies."
 msgstr ""
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index 642bd9c..9249bd1 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -15,6 +15,14 @@ msgstr ""
 "Aufgabe sein, aber \"%(child)s\" und \"%(parent)s\" sind unterschiedlichen "
 "Unternehmen zugeordnet."
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+"\"Verfügbar für Zeiterfassung\" kann für Arbeit \"%s\" nicht abgewählt "
+"werden, da sie bereits in Zeitpositionen verwendet wurde."
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr "Erstellungsdatum"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 6d0bb4f..20a4d52 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -14,6 +14,14 @@ msgstr ""
 "Todo trabajo debe estar en la misma empresa que su padre, pero «%(child)s» y"
 " «%(parent)s» están en empresas diferentes."
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+"No puede deshabilitar «Disponible en partes de trabajo» «%s» porque ya tiene"
+" partes de trabajo."
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr "Fecha creación"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 144fc7c..d0a70dc 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -14,6 +14,14 @@ msgstr ""
 "Cada trabajo debe estar en la misma compañía que su trabajo padre pero "
 "\"%(child)s\" y \"%(parent)s\" están en diferentes compañias."
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+"No puede cambiar \"Registros Disponibles\" para los trabajos \"%s\" porque "
+"hay registros activos."
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr "Fecha de Creación"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index ad0d604..aabd8b2 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -14,6 +14,14 @@ msgstr ""
 "Todo trabajo debe estar en la misma empresa que su padre, pero \"%(child)s\""
 " y \"%(parent)s\" están en empresas diferentes."
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+"No puede deshabilitar \"Disponible en hojas de trabajo\" \"%s\" porque ya "
+"tiene hojas de trabajo."
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr "Fecha creación"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index 2ed9279..d05dbb9 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -6,10 +6,6 @@ msgctxt "error:timesheet.line:"
 msgid "Hours field must be positive"
 msgstr "Le champ Heures doit être positif"
 
-msgctxt "error:timesheet.line:"
-msgid "Hours field must be positive"
-msgstr "Le champ Heures doit être positif"
-
 msgctxt "error:timesheet.work:"
 msgid ""
 "Every work must be in the same company as it's parent work but \"%(child)s\""
@@ -18,6 +14,14 @@ msgstr ""
 "Chaque travail doit être dans la même société que son parent mais "
 "\"%(child)s\" et \"%(parent)s\" ont des sociétés différentes."
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+"Vous ne pouvez pas enlever \"Disponible sur les feuilles de présence\" pour "
+"le travail \"%s\" parce qu'il a déjà des feuilles de présences."
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr "Date de création"
@@ -220,7 +224,7 @@ msgstr "Créé par"
 
 msgctxt "field:timesheet.work,hours:"
 msgid "Timesheet Hours"
-msgstr "Heures"
+msgstr "Heures de présence"
 
 msgctxt "field:timesheet.work,id:"
 msgid "ID"
@@ -252,7 +256,7 @@ msgstr "Disponible sur les feuilles de présence"
 
 msgctxt "field:timesheet.work,timesheet_end_date:"
 msgid "Timesheet End"
-msgstr "Fin feuille de présence"
+msgstr "Fin de feuille de présence"
 
 msgctxt "field:timesheet.work,timesheet_lines:"
 msgid ""
@@ -260,7 +264,7 @@ msgstr ""
 
 msgctxt "field:timesheet.work,timesheet_start_date:"
 msgid "Timesheet Start"
-msgstr "Début feuille de présence"
+msgstr "Début de feuille de présence"
 
 msgctxt "field:timesheet.work,write_date:"
 msgid "Write Date"
@@ -284,11 +288,11 @@ msgstr "Date de fin"
 
 msgctxt "help:timesheet.work,hours:"
 msgid "Total time spent on this work"
-msgstr "Temps total passé sur cette activité"
+msgstr "Temps total passé sur ce travail"
 
 msgctxt "help:timesheet.work,timesheet_available:"
 msgid "Allow to fill in timesheets with this work"
-msgstr "Autoriser cette activité sur les feuilles de présence"
+msgstr "Autoriser ce travail sur les feuilles de présence"
 
 msgctxt "model:ir.action,name:act_hours_employee_form"
 msgid "Hours per Employee"
@@ -308,7 +312,7 @@ msgstr "Nombre d'heures par employé par semaine"
 
 msgctxt "model:ir.action,name:act_line_enter"
 msgid "Enter Timesheet"
-msgstr "Entrer la feuille de présence"
+msgstr "Entrer feuille de présence"
 
 msgctxt "model:ir.action,name:act_line_form"
 msgid "Timesheet Lines"
@@ -320,23 +324,23 @@ msgstr "Lignes de feuille de présence"
 
 msgctxt "model:ir.action,name:act_open_work"
 msgid "Hours per Work"
-msgstr "Heures par activité"
+msgstr "Heures par travail"
 
 msgctxt "model:ir.action,name:act_open_work_graph"
 msgid "Hours per Work"
-msgstr "Heures par activité"
+msgstr "Heures par travail"
 
 msgctxt "model:ir.action,name:act_work_form2"
 msgid "Hours per Work"
-msgstr "Heures par activité"
+msgstr "Heures par travail"
 
 msgctxt "model:ir.action,name:act_work_form3"
 msgid "Hours per Work"
-msgstr "Heures par activité"
+msgstr "Heures par travail"
 
 msgctxt "model:ir.action,name:act_work_hours_board"
 msgid "Hours per Work"
-msgstr "Heures par activité"
+msgstr "Heures par travail"
 
 msgctxt "model:ir.action,name:act_work_list"
 msgid "Works"
@@ -368,7 +372,7 @@ msgstr "Heures par employé par semaine"
 
 msgctxt "model:ir.ui.menu,name:menu_line_enter"
 msgid "Enter Timesheet"
-msgstr "Entrer la feuille de présence"
+msgstr "Entrer feuille de présence"
 
 msgctxt "model:ir.ui.menu,name:menu_line_form"
 msgid "Timesheet Lines"
@@ -392,7 +396,7 @@ msgstr "Travaux"
 
 msgctxt "model:ir.ui.menu,name:menu_work_tree2"
 msgid "Hours per Work"
-msgstr "Heures par activité"
+msgstr "Heures par travail"
 
 msgctxt "model:res.group,name:group_timesheet_admin"
 msgid "Timesheet Administration"
@@ -428,7 +432,7 @@ msgstr "Travail"
 
 msgctxt "model:timesheet.work.open.start,name:"
 msgid "Open Work"
-msgstr "Ouvrir la tâche"
+msgstr "Ouvrir le travail"
 
 msgctxt "view:timesheet.hours_employee.open.start:"
 msgid "Hours per Employee"
@@ -439,14 +443,6 @@ msgid "Hours"
 msgstr "Heures"
 
 msgctxt "view:timesheet.hours_employee:"
-msgid "Hours"
-msgstr "Heures"
-
-msgctxt "view:timesheet.hours_employee:"
-msgid "Hours per Employee"
-msgstr "Heures par employé"
-
-msgctxt "view:timesheet.hours_employee:"
 msgid "Hours per Employee"
 msgstr "Heures par employé"
 
@@ -454,25 +450,13 @@ msgctxt "view:timesheet.hours_employee_monthly:"
 msgid "Hours per Employee per Month"
 msgstr "Nombre d'heures par employé par mois"
 
-msgctxt "view:timesheet.hours_employee_monthly:"
-msgid "Hours per Employee per Month"
-msgstr "Nombre d'heures par employé par mois"
-
-msgctxt "view:timesheet.hours_employee_weekly:"
-msgid "Hours per Employee per Week"
-msgstr "Nombre d'heures par employé par semaine"
-
 msgctxt "view:timesheet.hours_employee_weekly:"
 msgid "Hours per Employee per Week"
 msgstr "Nombre d'heures par employé par semaine"
 
 msgctxt "view:timesheet.line.enter.start:"
 msgid "Enter Timesheet"
-msgstr "Entrer la feuille de présence"
-
-msgctxt "view:timesheet.line:"
-msgid "Hours"
-msgstr "Heures"
+msgstr "Entrer feuille de présence"
 
 msgctxt "view:timesheet.line:"
 msgid "Hours"
@@ -483,32 +467,16 @@ msgid "Timesheet Line"
 msgstr "Ligne de feuille de présence"
 
 msgctxt "view:timesheet.line:"
-msgid "Timesheet Line"
-msgstr "Ligne de feuille de présence"
-
-msgctxt "view:timesheet.line:"
-msgid "Timesheet Lines"
-msgstr "Lignes de feuille de présence"
-
-msgctxt "view:timesheet.line:"
 msgid "Timesheet Lines"
 msgstr "Lignes de feuille de présence"
 
 msgctxt "view:timesheet.work.open.start:"
 msgid "Hours per Work"
-msgstr "Heures par activité"
-
-msgctxt "view:timesheet.work:"
-msgid "Hours per Work"
-msgstr "Heures par activité"
+msgstr "Heures par travail"
 
 msgctxt "view:timesheet.work:"
 msgid "Hours per Work"
-msgstr "Heures par activité"
-
-msgctxt "view:timesheet.work:"
-msgid "Work"
-msgstr "Travail"
+msgstr "Heures par travail"
 
 msgctxt "view:timesheet.work:"
 msgid "Work"
@@ -518,10 +486,6 @@ msgctxt "view:timesheet.work:"
 msgid "Works"
 msgstr "Travaux"
 
-msgctxt "view:timesheet.work:"
-msgid "Works"
-msgstr "Travaux"
-
 msgctxt "wizard_button:timesheet.hours_employee.open,start,end:"
 msgid "Cancel"
 msgstr "Annuler"
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index d4e074e..a233f65 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -12,6 +12,12 @@ msgid ""
 " and \"%(parent)s\" are in different companies."
 msgstr ""
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr ""
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index 724500f..b58a027 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -14,6 +14,12 @@ msgstr ""
 "Каждая работа должна быть в той же организации, что и её предок, но "
 "\"%(child)s\" и \"%(parent)s\" принадлежат разным организациям."
 
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
 msgstr "Дата создания"
diff --git a/locale/ca_ES.po b/locale/sl_SI.po
similarity index 75%
copy from locale/ca_ES.po
copy to locale/sl_SI.po
index 5923ff2..588e1c5 100644
--- a/locale/ca_ES.po
+++ b/locale/sl_SI.po
@@ -4,31 +4,39 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "error:timesheet.line:"
 msgid "Hours field must be positive"
-msgstr "El camp d'hores ha de ser positiu"
+msgstr "Vrednost polja \"Ure\" mora biti pozitivna"
 
 msgctxt "error:timesheet.work:"
 msgid ""
 "Every work must be in the same company as it's parent work but \"%(child)s\""
 " and \"%(parent)s\" are in different companies."
 msgstr ""
-"Tot treball ha d'estar a la mateixa empresa que el seu pare, però "
-"\"%(child)s\" i \"%(parent)s\" estan a empreses diferents."
+"Vsaka dejavnost mora biti v istem podjetju kot njena matična dejavnost, "
+"vendar sta \"%(child)s\" in \"%(parent)s\" v različnih podjetjih."
+
+msgctxt "error:timesheet.work:"
+msgid ""
+"You can not unset \"Available on timesheets\" for work \"%s\" because it "
+"already has  timesheets."
+msgstr ""
+"Za dejavnost \"%s\" ni možno izključiti \"Na evidenci\", ker je bilo zanjo "
+"že evidentirano delo."
 
 msgctxt "field:timesheet.hours_employee,create_date:"
 msgid "Create Date"
-msgstr "Data creació"
+msgstr "Ustvarjeno"
 
 msgctxt "field:timesheet.hours_employee,create_uid:"
 msgid "Create User"
-msgstr "Usuari creació"
+msgstr "Ustvaril"
 
 msgctxt "field:timesheet.hours_employee,employee:"
 msgid "Employee"
-msgstr "Empleat"
+msgstr "Zaposlenec"
 
 msgctxt "field:timesheet.hours_employee,hours:"
 msgid "Hours"
-msgstr "Hores"
+msgstr "Ure"
 
 msgctxt "field:timesheet.hours_employee,id:"
 msgid "ID"
@@ -36,19 +44,19 @@ msgstr "ID"
 
 msgctxt "field:timesheet.hours_employee,rec_name:"
 msgid "Name"
-msgstr "Nom"
+msgstr "Ime"
 
 msgctxt "field:timesheet.hours_employee,write_date:"
 msgid "Write Date"
-msgstr "Data modificació"
+msgstr "Zapisano"
 
 msgctxt "field:timesheet.hours_employee,write_uid:"
 msgid "Write User"
-msgstr "Usuari modificació"
+msgstr "Zapisal"
 
 msgctxt "field:timesheet.hours_employee.open.start,end_date:"
 msgid "End Date"
-msgstr "Data final"
+msgstr "Končni datum"
 
 msgctxt "field:timesheet.hours_employee.open.start,id:"
 msgid "ID"
@@ -56,23 +64,23 @@ msgstr "ID"
 
 msgctxt "field:timesheet.hours_employee.open.start,start_date:"
 msgid "Start Date"
-msgstr "Data inici"
+msgstr "Začetni datum"
 
 msgctxt "field:timesheet.hours_employee_monthly,create_date:"
 msgid "Create Date"
-msgstr "Data creació"
+msgstr "Ustvarjeno"
 
 msgctxt "field:timesheet.hours_employee_monthly,create_uid:"
 msgid "Create User"
-msgstr "Usuari creació"
+msgstr "Ustvaril"
 
 msgctxt "field:timesheet.hours_employee_monthly,employee:"
 msgid "Employee"
-msgstr "Empleat"
+msgstr "Zaposlenec"
 
 msgctxt "field:timesheet.hours_employee_monthly,hours:"
 msgid "Hours"
-msgstr "Hores"
+msgstr "Ure"
 
 msgctxt "field:timesheet.hours_employee_monthly,id:"
 msgid "ID"
@@ -80,39 +88,39 @@ msgstr "ID"
 
 msgctxt "field:timesheet.hours_employee_monthly,month:"
 msgid "Month"
-msgstr "Mes"
+msgstr "Mesec"
 
 msgctxt "field:timesheet.hours_employee_monthly,rec_name:"
 msgid "Name"
-msgstr "Nom"
+msgstr "Ime"
 
 msgctxt "field:timesheet.hours_employee_monthly,write_date:"
 msgid "Write Date"
-msgstr "Data modificació"
+msgstr "Zapisano"
 
 msgctxt "field:timesheet.hours_employee_monthly,write_uid:"
 msgid "Write User"
-msgstr "Usuari modificació"
+msgstr "Zapisal"
 
 msgctxt "field:timesheet.hours_employee_monthly,year:"
 msgid "Year"
-msgstr "Any"
+msgstr "Leto"
 
 msgctxt "field:timesheet.hours_employee_weekly,create_date:"
 msgid "Create Date"
-msgstr "Data creació"
+msgstr "Ustvarjeno"
 
 msgctxt "field:timesheet.hours_employee_weekly,create_uid:"
 msgid "Create User"
-msgstr "Usuari creació"
+msgstr "Ustvaril"
 
 msgctxt "field:timesheet.hours_employee_weekly,employee:"
 msgid "Employee"
-msgstr "Empleat"
+msgstr "Zaposlenec"
 
 msgctxt "field:timesheet.hours_employee_weekly,hours:"
 msgid "Hours"
-msgstr "Hores"
+msgstr "Ure"
 
 msgctxt "field:timesheet.hours_employee_weekly,id:"
 msgid "ID"
@@ -120,47 +128,47 @@ msgstr "ID"
 
 msgctxt "field:timesheet.hours_employee_weekly,rec_name:"
 msgid "Name"
-msgstr "Nom"
+msgstr "Ime"
 
 msgctxt "field:timesheet.hours_employee_weekly,week:"
 msgid "Week"
-msgstr "Setmana"
+msgstr "Teden"
 
 msgctxt "field:timesheet.hours_employee_weekly,write_date:"
 msgid "Write Date"
-msgstr "Data modificació"
+msgstr "Zapisano"
 
 msgctxt "field:timesheet.hours_employee_weekly,write_uid:"
 msgid "Write User"
-msgstr "Usuari modificació"
+msgstr "Zapisal"
 
 msgctxt "field:timesheet.hours_employee_weekly,year:"
 msgid "Year"
-msgstr "Any"
+msgstr "Leto"
 
 msgctxt "field:timesheet.line,create_date:"
 msgid "Create Date"
-msgstr "Data creació"
+msgstr "Ustvarjeno"
 
 msgctxt "field:timesheet.line,create_uid:"
 msgid "Create User"
-msgstr "Usuari creació"
+msgstr "Ustvaril"
 
 msgctxt "field:timesheet.line,date:"
 msgid "Date"
-msgstr "Data"
+msgstr "Datum"
 
 msgctxt "field:timesheet.line,description:"
 msgid "Description"
-msgstr "Descripció"
+msgstr "Opis"
 
 msgctxt "field:timesheet.line,employee:"
 msgid "Employee"
-msgstr "Empleat"
+msgstr "Zaposlenec"
 
 msgctxt "field:timesheet.line,hours:"
 msgid "Hours"
-msgstr "Hores"
+msgstr "Ure"
 
 msgctxt "field:timesheet.line,id:"
 msgid "ID"
@@ -168,27 +176,27 @@ msgstr "ID"
 
 msgctxt "field:timesheet.line,rec_name:"
 msgid "Name"
-msgstr "Nom"
+msgstr "Ime"
 
 msgctxt "field:timesheet.line,work:"
 msgid "Work"
-msgstr "Treball"
+msgstr "Dejavnost"
 
 msgctxt "field:timesheet.line,write_date:"
 msgid "Write Date"
-msgstr "Data modificació"
+msgstr "Zapisano"
 
 msgctxt "field:timesheet.line,write_uid:"
 msgid "Write User"
-msgstr "Usuari modificació"
+msgstr "Zapisal"
 
 msgctxt "field:timesheet.line.enter.start,date:"
 msgid "Date"
-msgstr "Data"
+msgstr "Datum"
 
 msgctxt "field:timesheet.line.enter.start,employee:"
 msgid "Employee"
-msgstr "Empleat"
+msgstr "Zaposlenec"
 
 msgctxt "field:timesheet.line.enter.start,id:"
 msgid "ID"
@@ -196,27 +204,27 @@ msgstr "ID"
 
 msgctxt "field:timesheet.work,active:"
 msgid "Active"
-msgstr "Actiu"
+msgstr "Aktivno"
 
 msgctxt "field:timesheet.work,children:"
 msgid "Children"
-msgstr "Fills"
+msgstr "Poddejavnosti"
 
 msgctxt "field:timesheet.work,company:"
 msgid "Company"
-msgstr "Empresa"
+msgstr "Podjetje"
 
 msgctxt "field:timesheet.work,create_date:"
 msgid "Create Date"
-msgstr "Data creació"
+msgstr "Ustvarjeno"
 
 msgctxt "field:timesheet.work,create_uid:"
 msgid "Create User"
-msgstr "Usuari creació"
+msgstr "Ustvaril"
 
 msgctxt "field:timesheet.work,hours:"
 msgid "Timesheet Hours"
-msgstr "Hores del full de treball"
+msgstr "Ure prisotnosti"
 
 msgctxt "field:timesheet.work,id:"
 msgid "ID"
@@ -224,51 +232,51 @@ msgstr "ID"
 
 msgctxt "field:timesheet.work,left:"
 msgid "Left"
-msgstr "Esquerra"
+msgstr "Levo"
 
 msgctxt "field:timesheet.work,name:"
 msgid "Name"
-msgstr "Nom"
+msgstr "Naziv"
 
 msgctxt "field:timesheet.work,parent:"
 msgid "Parent"
-msgstr "Pare"
+msgstr "Matična dejavnost"
 
 msgctxt "field:timesheet.work,rec_name:"
 msgid "Name"
-msgstr "Nom"
+msgstr "Ime"
 
 msgctxt "field:timesheet.work,right:"
 msgid "Right"
-msgstr "Dreta"
+msgstr "Desno"
 
 msgctxt "field:timesheet.work,timesheet_available:"
 msgid "Available on timesheets"
-msgstr "Disponible en fulls de treball"
+msgstr "Na evidenci"
 
 msgctxt "field:timesheet.work,timesheet_end_date:"
 msgid "Timesheet End"
-msgstr "Final de full de treball"
+msgstr "Prisotnost do"
 
 msgctxt "field:timesheet.work,timesheet_lines:"
-msgid ""
-msgstr ""
+msgid "Timesheet Lines"
+msgstr "Evidenca prisotnosti"
 
 msgctxt "field:timesheet.work,timesheet_start_date:"
 msgid "Timesheet Start"
-msgstr "Començament de full de treball"
+msgstr "Prisotnost od"
 
 msgctxt "field:timesheet.work,write_date:"
 msgid "Write Date"
-msgstr "Data modificació"
+msgstr "Zapisano"
 
 msgctxt "field:timesheet.work,write_uid:"
 msgid "Write User"
-msgstr "Usuari modificació"
+msgstr "Zapisal"
 
 msgctxt "field:timesheet.work.open.start,from_date:"
 msgid "From Date"
-msgstr "Des de la data"
+msgstr "Od"
 
 msgctxt "field:timesheet.work.open.start,id:"
 msgid "ID"
@@ -276,236 +284,236 @@ msgstr "ID"
 
 msgctxt "field:timesheet.work.open.start,to_date:"
 msgid "To Date"
-msgstr "Fins a la data"
+msgstr "Do"
 
 msgctxt "help:timesheet.work,hours:"
 msgid "Total time spent on this work"
-msgstr "Temps total empleat en aquest treball"
+msgstr "Skupni porabljen čas na dejavnosti"
 
 msgctxt "help:timesheet.work,timesheet_available:"
 msgid "Allow to fill in timesheets with this work"
-msgstr "Permet completar fulls de treball amb aquest treball."
+msgstr "Omogoča vnos v evidenco"
 
 msgctxt "model:ir.action,name:act_hours_employee_form"
 msgid "Hours per Employee"
-msgstr "Hores per empleat"
+msgstr "Ure po zaposlencu"
 
 msgctxt "model:ir.action,name:act_hours_employee_monthly_form"
 msgid "Hours per Employee per Month"
-msgstr "Hores per empleat i mes"
+msgstr "Mesečne ure po zaposlencu"
 
 msgctxt "model:ir.action,name:act_hours_employee_open"
 msgid "Hours per Employee"
-msgstr "Hores per empleat"
+msgstr "Ure po zaposlencu"
 
 msgctxt "model:ir.action,name:act_hours_employee_weekly_form"
 msgid "Hours per Employee per Week"
-msgstr "Hores per empleat i setmana"
+msgstr "Tedenske ure po zaposlencu"
 
 msgctxt "model:ir.action,name:act_line_enter"
 msgid "Enter Timesheet"
-msgstr "Afegeix full de treball"
+msgstr "Vnos prisotnosti"
 
 msgctxt "model:ir.action,name:act_line_form"
 msgid "Timesheet Lines"
-msgstr "Línies del full de treball"
+msgstr "Evidenca prisotnosti"
 
 msgctxt "model:ir.action,name:act_line_form_work"
 msgid "Timesheet Lines"
-msgstr "Línies del full de treball"
+msgstr "Evidenca prisotnosti"
 
 msgctxt "model:ir.action,name:act_open_work"
 msgid "Hours per Work"
-msgstr "Hores per treball"
+msgstr "Ure po dejavnosti"
 
 msgctxt "model:ir.action,name:act_open_work_graph"
 msgid "Hours per Work"
-msgstr "Hores per treball"
+msgstr "Ure po dejavnosti"
 
 msgctxt "model:ir.action,name:act_work_form2"
 msgid "Hours per Work"
-msgstr "Hores per treball"
+msgstr "Ure po dejavnosti"
 
 msgctxt "model:ir.action,name:act_work_form3"
 msgid "Hours per Work"
-msgstr "Hores per treball"
+msgstr "Ure po dejavnosti"
 
 msgctxt "model:ir.action,name:act_work_hours_board"
 msgid "Hours per Work"
-msgstr "Hores per treball"
+msgstr "Ure po dejavnosti"
 
 msgctxt "model:ir.action,name:act_work_list"
 msgid "Works"
-msgstr "Treballs"
+msgstr "Dejavnosti"
 
 msgctxt "model:ir.action,name:act_work_tree"
 msgid "Works"
-msgstr "Treballs"
+msgstr "Dejavnosti"
 
 msgctxt "model:ir.action,name:act_work_tree2"
 msgid "Works"
-msgstr "Treballs"
+msgstr "Dejavnosti"
 
 msgctxt "model:ir.ui.menu,name:menu_configuration"
 msgid "Configuration"
-msgstr "Configuració"
+msgstr "Nastavitve"
 
 msgctxt "model:ir.ui.menu,name:menu_hours_employee_open"
 msgid "Hours per Employee"
-msgstr "Hores per empleat"
+msgstr "Ure po zaposlencu"
 
 msgctxt "model:ir.ui.menu,name:menu_hours_employee_open_monthly"
 msgid "Hours per Employee per Month"
-msgstr "Hores per empleat i mes"
+msgstr "Mesečne ure po zaposlencu"
 
 msgctxt "model:ir.ui.menu,name:menu_hours_employee_open_weekly"
 msgid "Hours per Employee per Week"
-msgstr "Hores per empleat i setmana"
+msgstr "Tedenske ure po zaposlencu"
 
 msgctxt "model:ir.ui.menu,name:menu_line_enter"
 msgid "Enter Timesheet"
-msgstr "Afegeix full de treball"
+msgstr "Vnos prisotnosti"
 
 msgctxt "model:ir.ui.menu,name:menu_line_form"
 msgid "Timesheet Lines"
-msgstr "Línies del full de treball"
+msgstr "Evidenca prisotnosti"
 
 msgctxt "model:ir.ui.menu,name:menu_reporting"
 msgid "Reporting"
-msgstr "Informes"
+msgstr "Poročila"
 
 msgctxt "model:ir.ui.menu,name:menu_timesheet"
 msgid "Timesheet"
-msgstr "Full de treball"
+msgstr "Evidenca prisotnosti"
 
 msgctxt "model:ir.ui.menu,name:menu_work_list"
 msgid "Works"
-msgstr "Treballs"
+msgstr "Dejavnosti"
 
 msgctxt "model:ir.ui.menu,name:menu_work_tree"
 msgid "Works"
-msgstr "Treballs"
+msgstr "Dejavnosti"
 
 msgctxt "model:ir.ui.menu,name:menu_work_tree2"
 msgid "Hours per Work"
-msgstr "Hores per treball"
+msgstr "Ure po dejavnosti"
 
 msgctxt "model:res.group,name:group_timesheet_admin"
 msgid "Timesheet Administration"
-msgstr "Administració de fulls de treball"
+msgstr "Evidenca prisotnosti - vodenje"
 
 msgctxt "model:timesheet.hours_employee,name:"
 msgid "Hours per Employee"
-msgstr "Hores per empleat"
+msgstr "Ure po zaposlencu"
 
 msgctxt "model:timesheet.hours_employee.open.start,name:"
 msgid "Open Hours per Employee"
-msgstr "Obrir hores per empleat"
+msgstr "Odprte ure po zaposlencu"
 
 msgctxt "model:timesheet.hours_employee_monthly,name:"
 msgid "Hours per Employee per Month"
-msgstr "Hores per empleat i mes"
+msgstr "Mesečne ure po zaposlencu"
 
 msgctxt "model:timesheet.hours_employee_weekly,name:"
 msgid "Hours per Employee per Week"
-msgstr "Hores per empleat i setmana"
+msgstr "Tedenske ure po zaposlencu"
 
 msgctxt "model:timesheet.line,name:"
 msgid "Timesheet Line"
-msgstr "Línia de full de treball"
+msgstr "Evidenca prisotnosti"
 
 msgctxt "model:timesheet.line.enter.start,name:"
 msgid "Enter Lines"
-msgstr "Afegir línies"
+msgstr "Vnos postavk"
 
 msgctxt "model:timesheet.work,name:"
 msgid "Work"
-msgstr "Treball"
+msgstr "Dejavnost"
 
 msgctxt "model:timesheet.work.open.start,name:"
 msgid "Open Work"
-msgstr "Obrir treball"
+msgstr "Odpri dejavnost"
 
 msgctxt "view:timesheet.hours_employee.open.start:"
 msgid "Hours per Employee"
-msgstr "Hores per empleat"
+msgstr "Ure po zaposlencu"
 
 msgctxt "view:timesheet.hours_employee:"
 msgid "Hours"
-msgstr "Hores"
+msgstr "Ure"
 
 msgctxt "view:timesheet.hours_employee:"
 msgid "Hours per Employee"
-msgstr "Hores per empleat"
+msgstr "Ure po zaposlencu"
 
 msgctxt "view:timesheet.hours_employee_monthly:"
 msgid "Hours per Employee per Month"
-msgstr "Hores per empleat i mes"
+msgstr "Mesečne ure po zaposlencu"
 
 msgctxt "view:timesheet.hours_employee_weekly:"
 msgid "Hours per Employee per Week"
-msgstr "Hores per empleat i setmana"
+msgstr "Tedenske ure po zaposlencu"
 
 msgctxt "view:timesheet.line.enter.start:"
 msgid "Enter Timesheet"
-msgstr "Afegeix full de treball"
+msgstr "Vnos prisotnosti"
 
 msgctxt "view:timesheet.line:"
 msgid "Hours"
-msgstr "Hores"
+msgstr "Ure"
 
 msgctxt "view:timesheet.line:"
 msgid "Timesheet Line"
-msgstr "Línia de full de treball"
+msgstr "Evidenca prisotnosti"
 
 msgctxt "view:timesheet.line:"
 msgid "Timesheet Lines"
-msgstr "Línies del full de treball"
+msgstr "Evidenca prisotnosti"
 
 msgctxt "view:timesheet.work.open.start:"
 msgid "Hours per Work"
-msgstr "Hores per treball"
+msgstr "Ure po dejavnosti"
 
 msgctxt "view:timesheet.work:"
 msgid "Hours per Work"
-msgstr "Hores per treball"
+msgstr "Ure po dejavnosti"
 
 msgctxt "view:timesheet.work:"
 msgid "Work"
-msgstr "Treball"
+msgstr "Dejavnost"
 
 msgctxt "view:timesheet.work:"
 msgid "Works"
-msgstr "Treballs"
+msgstr "Dejavnosti"
 
 msgctxt "wizard_button:timesheet.hours_employee.open,start,end:"
 msgid "Cancel"
-msgstr "Cancel·la"
+msgstr "Prekliči"
 
 msgctxt "wizard_button:timesheet.hours_employee.open,start,open_:"
 msgid "Open"
-msgstr "Obre"
+msgstr "Odpri"
 
 msgctxt "wizard_button:timesheet.line.enter,start,end:"
 msgid "Cancel"
-msgstr "Cancel·la"
+msgstr "Prekliči"
 
 msgctxt "wizard_button:timesheet.line.enter,start,enter:"
 msgid "Enter"
-msgstr "Afegeix"
+msgstr "Vnos"
 
 msgctxt "wizard_button:timesheet.work.open,start,end:"
 msgid "Cancel"
-msgstr "Cancel·la"
+msgstr "Prekliči"
 
 msgctxt "wizard_button:timesheet.work.open,start,open_:"
 msgid "Open"
-msgstr "Obre"
+msgstr "Odpri"
 
 msgctxt "wizard_button:timesheet.work.open2,start,end:"
 msgid "Cancel"
-msgstr "Cancel·la"
+msgstr "Prekliči"
 
 msgctxt "wizard_button:timesheet.work.open2,start,open_:"
 msgid "Open"
-msgstr "Obre"
+msgstr "Odpri"
diff --git a/setup.py b/setup.py
index 2f74046..3aa56a3 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
 major_version = int(major_version)
 minor_version = int(minor_version)
 
-requires = []
+requires = ['python-sql']
 for dep in info.get('depends', []):
     if not re.match(r'(ir|res|webdav)(\W|$)', dep):
         requires.append('trytond_%s >= %s.%s, < %s.%s' %
@@ -64,6 +64,7 @@ setup(name='trytond_timesheet',
         'Natural Language :: French',
         'Natural Language :: German',
         'Natural Language :: Russian',
+        'Natural Language :: Slovenian',
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.6',
diff --git a/tests/__init__.py b/tests/__init__.py
index 7da0f02..11bca20 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -2,3 +2,5 @@
 #this repository contains the full copyright notices and license terms.
 
 from .test_timesheet import suite
+
+__all__ = ['suite']
diff --git a/tryton.cfg b/tryton.cfg
index edb48ca..2c85ffe 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=2.8.0
+version=3.0.0
 depends:
     company
     company_work_time
diff --git a/trytond_timesheet.egg-info/PKG-INFO b/trytond_timesheet.egg-info/PKG-INFO
index ab086c7..c9e184c 100644
--- a/trytond_timesheet.egg-info/PKG-INFO
+++ b/trytond_timesheet.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-timesheet
-Version: 2.8.0
+Version: 3.0.0
 Summary: Tryton module with timesheets
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.8/
+Download-URL: http://downloads.tryton.org/3.0/
 Description: trytond_timesheet
         =================
         
@@ -60,6 +60,7 @@ Classifier: Natural Language :: English
 Classifier: Natural Language :: French
 Classifier: Natural Language :: German
 Classifier: Natural Language :: Russian
+Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.6
diff --git a/trytond_timesheet.egg-info/SOURCES.txt b/trytond_timesheet.egg-info/SOURCES.txt
index 7d468c5..2644413 100644
--- a/trytond_timesheet.egg-info/SOURCES.txt
+++ b/trytond_timesheet.egg-info/SOURCES.txt
@@ -25,6 +25,7 @@ locale/es_ES.po
 locale/fr_FR.po
 locale/nl_NL.po
 locale/ru_RU.po
+locale/sl_SI.po
 trytond_timesheet.egg-info/PKG-INFO
 trytond_timesheet.egg-info/SOURCES.txt
 trytond_timesheet.egg-info/dependency_links.txt
diff --git a/trytond_timesheet.egg-info/requires.txt b/trytond_timesheet.egg-info/requires.txt
index 0e5dc9e..d103351 100644
--- a/trytond_timesheet.egg-info/requires.txt
+++ b/trytond_timesheet.egg-info/requires.txt
@@ -1,3 +1,4 @@
-trytond_company >= 2.8, < 2.9
-trytond_company_work_time >= 2.8, < 2.9
-trytond >= 2.8, < 2.9
\ No newline at end of file
+python-sql
+trytond_company >= 3.0, < 3.1
+trytond_company_work_time >= 3.0, < 3.1
+trytond >= 3.0, < 3.1
\ No newline at end of file
diff --git a/work.py b/work.py
index b90d971..fd08005 100644
--- a/work.py
+++ b/work.py
@@ -1,10 +1,14 @@
 #This file is part of Tryton.  The COPYRIGHT file at the top level of
 #this repository contains the full copyright notices and license terms.
+from sql import Literal
+from sql.aggregate import Sum
+
 from trytond.model import ModelView, ModelSQL, fields
 from trytond.wizard import Wizard, StateView, StateAction, Button
 from trytond.pyson import PYSONEncoder, Not, Bool, Eval
 from trytond.transaction import Transaction
 from trytond.pool import Pool
+from trytond.tools import reduce_ids
 
 __all__ = ['Work', 'OpenWorkStart', 'OpenWork', 'OpenWork2', 'OpenWorkGraph']
 
@@ -26,9 +30,6 @@ class Work(ModelSQL, ModelView):
             depends=['timesheet_available'],
             help="Total time spent on this work"), 'get_hours')
     timesheet_available = fields.Boolean('Available on timesheets',
-        states={
-            'readonly': Bool(Eval('timesheet_lines', [0])),
-            },
         help="Allow to fill in timesheets with this work")
     timesheet_start_date = fields.Date('Timesheet Start',
         states={
@@ -57,6 +58,9 @@ class Work(ModelSQL, ModelView):
                 'invalid_parent_company': ('Every work must be in the same '
                     'company as it\'s parent work but "%(child)s" and '
                     '"%(parent)s" are in different companies.'),
+                'change_timesheet_available': ('You can not unset "Available '
+                    'on timesheets" for work "%s" because it already has  '
+                    'timesheets.'),
                 })
 
     @staticmethod
@@ -96,54 +100,38 @@ class Work(ModelSQL, ModelView):
                     })
 
     @classmethod
-    def _tree_qty(cls, hours_by_wt, children, ids, to_compute):
-        res = 0
-        for h in ids:
-            if (not children.get(h)) or (not to_compute[h]):
-                res += hours_by_wt.setdefault(h, 0)
-            else:
-                sub_qty = cls._tree_qty(
-                    hours_by_wt, children, children[h], to_compute)
-                hours_by_wt.setdefault(h, 0)
-                hours_by_wt[h] += sub_qty
-                res += hours_by_wt[h]
-                to_compute[h] = False
-        return res
-
-    @classmethod
     def get_hours(cls, works, name):
+        pool = Pool()
+        Line = pool.get('timesheet.line')
+        transaction = Transaction()
+        cursor = transaction.cursor
+        in_max = cursor.IN_MAX
+        context = transaction.context
+
+        table_w = cls.__table__()
+        table_c = cls.__table__()
+        line = Line.__table__()
         ids = [w.id for w in works]
-        all_works = cls.search([
-                ('parent', 'child_of', ids),
-                ])
-        all_ids = [w.id for w in all_works]
-        # force inactive ids to be in all_ids
-        all_ids = list(set(all_ids + ids))
-        clause = ("SELECT work, sum(hours) FROM timesheet_line "
-            "WHERE work IN (%s) "
-            % ",".join(('%s',) * len(all_ids)))
-        date_cond = ""
-        args = []
-        if Transaction().context.get('from_date'):
-            date_cond = " AND date >= %s"
-            args.append(Transaction().context['from_date'])
-        if Transaction().context.get('to_date'):
-            date_cond += " AND date <= %s"
-            args.append(Transaction().context['to_date'])
-        clause += date_cond + " GROUP BY work"
-
-        Transaction().cursor.execute(clause, all_ids + args)
-
-        hours_by_wt = dict((i[0], i[1]) for i in
-            Transaction().cursor.fetchall())
-        to_compute = dict.fromkeys(all_ids, True)
-        works = cls.browse(all_ids)
-        children = {}
-        for work in works:
-            if work.parent:
-                children.setdefault(work.parent.id, []).append(work.id)
-        cls._tree_qty(hours_by_wt, children, ids, to_compute)
-        return hours_by_wt
+        hours = dict.fromkeys(ids, 0)
+        where = Literal(True)
+        if context.get('from_date'):
+            where &= line.date >= context['from_date']
+        if context.get('to_date'):
+            where &= line.date <= context['to_date']
+        if context.get('employees'):
+            where &= line.employee.in_(context['employees'])
+        for i in range(0, len(ids), in_max):
+            sub_ids = ids[i:i + in_max]
+            red_sql = reduce_ids(table_w.id, sub_ids)
+            cursor.execute(*table_w.join(table_c,
+                    condition=(table_c.left >= table_w.left)
+                    & (table_c.right <= table_w.right)
+                    ).join(line, 'LEFT', condition=line.work == table_c.id
+                    ).select(table_w.id, Sum(line.hours),
+                    where=red_sql & where,
+                    group_by=table_w.id))
+            hours.update(dict(cursor.fetchall()))
+        return hours
 
     def get_rec_name(self, name):
         if self.parent:
@@ -177,7 +165,17 @@ class Work(ModelSQL, ModelView):
 
     @classmethod
     def write(cls, works, vals):
+        pool = Pool()
+        Lines = pool.get('timesheet.line')
         childs = None
+        if not vals.get('timesheet_available', True):
+            in_max = Transaction().cursor.IN_MAX
+            for i in range(0, len(works), in_max):
+                sub_ids = [w.id for w in works[i:i + in_max]]
+                lines = Lines.search([('work', 'in', sub_ids)], limit=1)
+                if lines:
+                    cls.raise_user_error('change_timesheet_available',
+                        lines[0].work.rec_name)
         if not vals.get('active', True):
             childs = cls.search([
                     ('parent', 'child_of', [w.id for w in works]),
diff --git a/work.xml b/work.xml
index 51a6a99..e357047 100644
--- a/work.xml
+++ b/work.xml
@@ -25,7 +25,7 @@ this repository contains the full copyright notices and license terms. -->
         <record model="ir.action.act_window" id="act_work_tree">
             <field name="name">Works</field>
             <field name="res_model">timesheet.work</field>
-            <field name="domain">[('parent', '=', False)]</field>
+            <field name="domain">[('parent', '=', None)]</field>
         </record>
         <record model="ir.action.act_window.view"
             id="act_work_tree_view1">
@@ -71,7 +71,7 @@ this repository contains the full copyright notices and license terms. -->
         <record model="ir.action.act_window" id="act_work_tree2">
             <field name="name">Works</field>
             <field name="res_model">timesheet.work</field>
-            <field name="domain">[('parent', '=', False)]</field>
+            <field name="domain">[('parent', '=', None)]</field>
         </record>
         <record model="ir.action.act_window.view"
             id="act_work_tree2_view1">
@@ -88,7 +88,7 @@ this repository contains the full copyright notices and license terms. -->
         <record model="ir.action.act_window" id="act_work_form2">
             <field name="name">Hours per Work</field>
             <field name="res_model">timesheet.work</field>
-            <field name="domain">[('parent', '=', Get(Eval('timesheet.act_work_tree2', {}), 'id', False))]</field>
+            <field name="domain">[('parent', '=', Get(Eval('timesheet.act_work_tree2', {}), 'id', None))]</field>
         </record>
         <record model="ir.action.act_window.view"
             id="act_work_form2_view1">
-- 
tryton-modules-timesheet



More information about the tryton-debian-vcs mailing list