[tryton-debian-vcs] tryton-modules-project-invoice branch debian updated. debian/2.8.2-1-5-g75e483b

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


The following commit has been merged in the debian branch:
http://debian.tryton.org/gitweb/?p=packages/tryton-modules-project-invoice.git;a=commitdiff;h=debian/2.8.2-1-5-g75e483b

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

    Releasing debian version 3.0.0-1.

diff --git a/debian/changelog b/debian/changelog
index 71f5833..c989d1b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+tryton-modules-project-invoice (3.0.0-1) unstable; urgency=low
+
+  * Merging upstream version 3.0.0.
+  * Updating to standards version 3.9.5, no changes needed.
+  * Changing to buildsystem pybuild.
+  * Adding python-sql to Depends.
+
+ -- Mathias Behrle <mathiasb at m9s.biz>  Mon, 25 Nov 2013 17:54:48 +0100
+
 tryton-modules-project-invoice (2.8.2-1) unstable; urgency=low
 
   * Adapting the rules file to work also with git-buildpackage.
commit bf8ec43346316e60d6376832b7ba3775c7d89f07
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Nov 25 17:45:06 2013 +0100

    Adding python-sql to Depends.

diff --git a/debian/control b/debian/control
index 19fc01c..c9a085c 100644
--- a/debian/control
+++ b/debian/control
@@ -20,7 +20,8 @@ Depends:
  tryton-modules-project (>= ${version:major}),
  tryton-modules-project-revenue (>= ${version:major}),
  tryton-modules-timesheet (>= ${version:major}),
- tryton-modules-product (>= ${version:major}), python-pkg-resources
+ tryton-modules-product (>= ${version:major}),
+ python-sql, python-pkg-resources
 Description: Tryton Application Platform (Project Invoice 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 4bda5de070aa538722e79682eba02e935f34e829
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 19:51:51 2013 +0100

    Changing to buildsystem pybuild.

diff --git a/debian/control b/debian/control
index 865d06a..19fc01c 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-project-invoice.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 d5a8dec5a1c31895f6f63a9aee010444132f459d
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 87a9a0d..865d06a 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-project-invoice.git
 Vcs-Git: git://debian.tryton.org/packages/tryton-modules-project-invoice.git
commit 185d416ca15f57adab50fbea88bed6a8be450a66
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 17:27:48 2013 +0100

    Merging upstream version 3.0.0.

diff --git a/CHANGELOG b/CHANGELOG
index ade1819..cd2dc58 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,7 +1,4 @@
-Version 2.8.2 - 2013-07-22
-* Bug fixes (see mercurial logs for details)
-
-Version 2.8.1 - 2013-06-09
+Version 3.0.0 - 2013-10-21
 * Bug fixes (see mercurial logs for details)
 
 Version 2.8.0 - 2013-04-22
diff --git a/INSTALL b/INSTALL
index 55c60dd..2a0be6c 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,6 +6,7 @@ Prerequisites
 
  * Python 2.6 or later (http://www.python.org/)
  * trytond (http://www.tryton.org/)
+ * python-sql (http://code.google.com/p/python-sql/)
  * trytond_project (http://www.tryton.org/)
  * trytond_project_revenue (http://www.tryton.org/)
  * trytond_timesheet (http://www.tryton.org/)
diff --git a/PKG-INFO b/PKG-INFO
index 8a4b772..97b0fd1 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_project_invoice
-Version: 2.8.2
+Version: 3.0.0
 Summary: Tryton module to invoice projects
 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_project_invoice
         =======================
         
@@ -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/locale/ca_ES.po b/locale/ca_ES.po
index 5c356ee..9747808 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -18,6 +18,10 @@ msgctxt "error:timesheet.line:"
 msgid "You can not delete invoiced line."
 msgstr "No podeu eliminar una línia facturada."
 
+msgctxt "error:timesheet.line:"
+msgid "You can not modify invoiced line."
+msgstr "No podeu modificar una línia facturada."
+
 msgctxt "field:project.work,hours_to_invoice:"
 msgid "Hours to Invoice"
 msgstr "Hores a facturar"
diff --git a/locale/de_DE.po b/locale/de_DE.po
index ef3e301..f7c6caf 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -18,6 +18,10 @@ msgctxt "error:timesheet.line:"
 msgid "You can not delete invoiced line."
 msgstr "Abgrechnete Zeilen können nicht gelöscht werden."
 
+msgctxt "error:timesheet.line:"
+msgid "You can not modify invoiced line."
+msgstr "Eine abgerechnete Zeile kann nicht geändert werden."
+
 msgctxt "field:project.work,hours_to_invoice:"
 msgid "Hours to Invoice"
 msgstr "Abrechenbare Stunden"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 5bbfdb8..f138942 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -16,7 +16,11 @@ msgstr "No hay ningún producto en la actividad «%s»."
 
 msgctxt "error:timesheet.line:"
 msgid "You can not delete invoiced line."
-msgstr "No puede eliminar una línea de factura."
+msgstr "No puede eliminar una línea facturada."
+
+msgctxt "error:timesheet.line:"
+msgid "You can not modify invoiced line."
+msgstr "No puede modificar una línea facturada."
 
 msgctxt "field:project.work,hours_to_invoice:"
 msgid "Hours to Invoice"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index 9f35bc4..6b0f2e6 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -4,7 +4,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "error:project.work:"
 msgid "There is no list price on work \"%s\"."
-msgstr "No hay ninguna lista de precio en el trabajo \"%s\"."
+msgstr "No hay precio en el trabajo \"%s\"."
 
 msgctxt "error:project.work:"
 msgid "There is no party on work \"%s\"."
@@ -16,7 +16,11 @@ msgstr "No hay ningún producto en el trabajo \"%s\"."
 
 msgctxt "error:timesheet.line:"
 msgid "You can not delete invoiced line."
-msgstr "No puede eliminar una línea de factura."
+msgstr "No puede eliminar una línea facturada."
+
+msgctxt "error:timesheet.line:"
+msgid "You can not modify invoiced line."
+msgstr "No puede modificar una línea facturada."
 
 msgctxt "field:project.work,hours_to_invoice:"
 msgid "Hours to Invoice"
@@ -64,7 +68,7 @@ msgstr "Por el esfuerzo estimado"
 
 msgctxt "selection:project.work,invoice_method:"
 msgid "On Timesheet"
-msgstr "Por las horas realitzadas"
+msgstr "Por las horas realizadas"
 
 msgctxt "selection:project.work,project_invoice_method:"
 msgid "Manual"
@@ -76,7 +80,7 @@ msgstr "Por el esfuerzo estimado"
 
 msgctxt "selection:project.work,project_invoice_method:"
 msgid "On Timesheet"
-msgstr "Por las horas realitzadas"
+msgstr "Por las horas realizadas"
 
 msgctxt "view:project.work:"
 msgid "Invoice"
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index 4dbe59e..edd6723 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -18,6 +18,10 @@ msgctxt "error:timesheet.line:"
 msgid "You can not delete invoiced line."
 msgstr "Vous ne pouvez supprimer une ligne facturée."
 
+msgctxt "error:timesheet.line:"
+msgid "You can not modify invoiced line."
+msgstr "Vous ne pouvez pas modifier une ligne facturée."
+
 msgctxt "field:project.work,hours_to_invoice:"
 msgid "Hours to Invoice"
 msgstr "Heures à facturer"
diff --git a/locale/de_DE.po b/locale/sl_SI.po
similarity index 68%
copy from locale/de_DE.po
copy to locale/sl_SI.po
index ef3e301..901ce6d 100644
--- a/locale/de_DE.po
+++ b/locale/sl_SI.po
@@ -4,80 +4,84 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 
 msgctxt "error:project.work:"
 msgid "There is no list price on work \"%s\"."
-msgstr "Fehlender Listenpreis für Arbeit \"%s\"."
+msgstr "Pri dejavnosti \"%s\" ni cenika."
 
 msgctxt "error:project.work:"
 msgid "There is no party on work \"%s\"."
-msgstr "Fehlende Partei für Arbeit \"%s\"."
+msgstr "Pri dejavnosti \"%s\" ni stranke."
 
 msgctxt "error:project.work:"
 msgid "There is no product on work \"%s\"."
-msgstr "Fehlender Artikel für Arbeit \"%s\"."
+msgstr "Pri dejavnosti \"%s\" ni izdelka."
 
 msgctxt "error:timesheet.line:"
 msgid "You can not delete invoiced line."
-msgstr "Abgrechnete Zeilen können nicht gelöscht werden."
+msgstr "Obračunane postavke ni možne brisati."
+
+msgctxt "error:timesheet.line:"
+msgid "You can not modify invoiced line."
+msgstr "Obračunane postavke ni možne popraviti."
 
 msgctxt "field:project.work,hours_to_invoice:"
 msgid "Hours to Invoice"
-msgstr "Abrechenbare Stunden"
+msgstr "Ure za obračun"
 
 msgctxt "field:project.work,invoice_line:"
 msgid "Invoice Line"
-msgstr "Rechnungsposition"
+msgstr "Postavka računa"
 
 msgctxt "field:project.work,invoice_method:"
 msgid "Invoice Method"
-msgstr "Methode Rechnungsstellung"
+msgstr "Način obračuna"
 
 msgctxt "field:project.work,invoiced_amount:"
 msgid "Invoiced Amount"
-msgstr "Abgerechneter Betrag"
+msgstr "Zaračunan znesek"
 
 msgctxt "field:project.work,invoiced_hours:"
 msgid "Invoiced Hours"
-msgstr "Abgerechnete Stunden"
+msgstr "Zaračunane ure"
 
 msgctxt "field:project.work,project_invoice_method:"
 msgid "Invoice Method"
-msgstr "Methode Rechnungsstellung"
+msgstr "Način obračuna"
 
 msgctxt "field:timesheet.line,invoice_line:"
 msgid "Invoice Line"
-msgstr "Rechnungsposition"
+msgstr "Postavka računa"
 
 msgctxt "model:ir.action,name:open_invoice"
 msgid "Invoices"
-msgstr "Rechnungsausgang"
+msgstr "Računi"
 
 msgctxt "model:res.group,name:group_project_invoice"
 msgid "Project Invoice"
-msgstr "Projekte Fakturierung"
+msgstr "Projekt - obračun"
 
 msgctxt "selection:project.work,invoice_method:"
 msgid "Manual"
-msgstr "Manuell"
+msgstr "Ročno"
 
 msgctxt "selection:project.work,invoice_method:"
 msgid "On Effort"
-msgstr "Nach Arbeitsaufwand"
+msgstr "Po oceni dela"
 
 msgctxt "selection:project.work,invoice_method:"
 msgid "On Timesheet"
-msgstr "Nach Zeitaufwand"
+msgstr "Po dejanskem delu"
 
 msgctxt "selection:project.work,project_invoice_method:"
 msgid "Manual"
-msgstr "Manuell"
+msgstr "Ročno"
 
 msgctxt "selection:project.work,project_invoice_method:"
 msgid "On Effort"
-msgstr "Nach Arbeitsaufwand"
+msgstr "Po oceni dela"
 
 msgctxt "selection:project.work,project_invoice_method:"
 msgid "On Timesheet"
-msgstr "Nach Zeitaufwand"
+msgstr "Po dejanskem delu"
 
 msgctxt "view:project.work:"
 msgid "Invoice"
-msgstr "Rechnung"
+msgstr "Račun"
diff --git a/setup.py b/setup.py
index fcb849b..d20d425 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_project_invoice',
         '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 ebafcc1..4f749be 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_project_invoice import suite
+
+__all__ = ['suite']
diff --git a/tests/scenario_project_invoice_effort.rst b/tests/scenario_project_invoice_effort.rst
index b6ad4d6..37e03a0 100644
--- a/tests/scenario_project_invoice_effort.rst
+++ b/tests/scenario_project_invoice_effort.rst
@@ -57,13 +57,37 @@ Create company::
 Reload the context::
 
     >>> User = Model.get('res.user')
+    >>> Group = Model.get('res.group')
     >>> config._context = User.get_preferences(True, config.context)
 
+Create project user::
+
+    >>> project_user = User()
+    >>> project_user.name = 'Project'
+    >>> project_user.login = 'project'
+    >>> project_user.main_company = company
+    >>> project_group, = Group.find([('name', '=', 'Project Administration')])
+    >>> timesheet_group, = Group.find([('name', '=', 'Timesheet Administration')])
+    >>> project_user.groups.extend([project_group, timesheet_group])
+    >>> project_user.save()
+
+Create project invoice user::
+
+    >>> project_invoice_user = User()
+    >>> project_invoice_user.name = 'Project Invoice'
+    >>> project_invoice_user.login = 'project_invoice'
+    >>> project_invoice_user.main_company = company
+    >>> project_invoice_group, = Group.find([('name', '=', 'Project Invoice')])
+    >>> project_group, = Group.find([('name', '=', 'Project Administration')])
+    >>> project_invoice_user.groups.extend(
+    ...     [project_invoice_group, project_group])
+    >>> project_invoice_user.save()
+
 Create chart of accounts::
 
     >>> AccountTemplate = Model.get('account.account.template')
     >>> Account = Model.get('account.account')
-    >>> account_template, = AccountTemplate.find([('parent', '=', False)])
+    >>> account_template, = AccountTemplate.find([('parent', '=', None)])
     >>> create_chart = Wizard('account.create_chart')
     >>> create_chart.execute('account')
     >>> create_chart.form.account_template = account_template
@@ -131,6 +155,7 @@ Create product::
 
 Create a Project::
 
+    >>> config.user = project_user.id
     >>> ProjectWork = Model.get('project.work')
     >>> TimesheetWork = Model.get('timesheet.work')
     >>> project = ProjectWork()
@@ -182,6 +207,7 @@ Check project hours::
 
 Invoice project::
 
+    >>> config.user = project_invoice_user.id
     >>> ProjectWork.invoice([project.id], config.context)
     >>> project.reload()
     >>> project.invoiced_hours
@@ -193,6 +219,7 @@ Invoice project::
 
 Do project::
 
+    >>> config.user = project_user.id
     >>> project.state = 'done'
     >>> project.save()
 
@@ -208,6 +235,7 @@ Check project hours::
 
 Invoice again project::
 
+    >>> config.user = project_invoice_user.id
     >>> ProjectWork.invoice([project.id], config.context)
     >>> project.reload()
     >>> project.invoiced_hours
diff --git a/tests/scenario_project_invoice_timesheet.rst b/tests/scenario_project_invoice_timesheet.rst
index 5666d53..cef9ed0 100644
--- a/tests/scenario_project_invoice_timesheet.rst
+++ b/tests/scenario_project_invoice_timesheet.rst
@@ -57,13 +57,37 @@ Create company::
 Reload the context::
 
     >>> User = Model.get('res.user')
+    >>> Group = Model.get('res.group')
     >>> config._context = User.get_preferences(True, config.context)
 
+Create project user::
+
+    >>> project_user = User()
+    >>> project_user.name = 'Project'
+    >>> project_user.login = 'project'
+    >>> project_user.main_company = company
+    >>> project_group, = Group.find([('name', '=', 'Project Administration')])
+    >>> timesheet_group, = Group.find([('name', '=', 'Timesheet Administration')])
+    >>> project_user.groups.extend([project_group, timesheet_group])
+    >>> project_user.save()
+
+Create project invoice user::
+
+    >>> project_invoice_user = User()
+    >>> project_invoice_user.name = 'Project Invoice'
+    >>> project_invoice_user.login = 'project_invoice'
+    >>> project_invoice_user.main_company = company
+    >>> project_invoice_group, = Group.find([('name', '=', 'Project Invoice')])
+    >>> project_group, = Group.find([('name', '=', 'Project Administration')])
+    >>> project_invoice_user.groups.extend(
+    ...     [project_invoice_group, project_group])
+    >>> project_invoice_user.save()
+
 Create chart of accounts::
 
     >>> AccountTemplate = Model.get('account.account.template')
     >>> Account = Model.get('account.account')
-    >>> account_template, = AccountTemplate.find([('parent', '=', False)])
+    >>> account_template, = AccountTemplate.find([('parent', '=', None)])
     >>> create_chart = Wizard('account.create_chart')
     >>> create_chart.execute('account')
     >>> create_chart.form.account_template = account_template
@@ -131,6 +155,7 @@ Create product::
 
 Create a Project::
 
+    >>> config.user = project_user.id
     >>> ProjectWork = Model.get('project.work')
     >>> TimesheetWork = Model.get('timesheet.work')
     >>> project = ProjectWork()
@@ -179,6 +204,7 @@ Check project hours::
 
 Invoice project::
 
+    >>> config.user = project_invoice_user.id
     >>> ProjectWork.invoice([project.id], config.context)
     >>> project.reload()
     >>> project.invoiced_hours
@@ -190,6 +216,7 @@ Invoice project::
 
 Create more timesheets::
 
+    >>> config.user = project_user.id
     >>> TimesheetLine = Model.get('timesheet.line')
     >>> line = TimesheetLine()
     >>> line.employee = employee
@@ -209,6 +236,7 @@ Check project hours::
 
 Invoice again project::
 
+    >>> config.user = project_invoice_user.id
     >>> ProjectWork.invoice([project.id], config.context)
     >>> project.reload()
     >>> project.invoiced_hours
diff --git a/timesheet.py b/timesheet.py
index 67ee5cc..39b7414 100644
--- a/timesheet.py
+++ b/timesheet.py
@@ -17,6 +17,7 @@ class TimesheetLine:
     def __setup__(cls):
         super(TimesheetLine, cls).__setup__()
         cls._error_messages.update({
+                'modify_invoiced_line': 'You can not modify invoiced line.',
                 'delete_invoiced_line': 'You can not delete invoiced line.',
                 })
 
@@ -29,6 +30,12 @@ class TimesheetLine:
         return super(TimesheetLine, cls).copy(records, default=default)
 
     @classmethod
+    def write(cls, records, values):
+        if any(r.invoice_line for r in records):
+            cls.raise_user_error('modify_invoiced_line')
+        super(TimesheetLine, cls).write(records, values)
+
+    @classmethod
     def delete(cls, records):
         if any(r.invoice_line for r in records):
             cls.raise_user_error('delete_invoiced_line')
diff --git a/timesheet.xml b/timesheet.xml
new file mode 100644
index 0000000..c773caf
--- /dev/null
+++ b/timesheet.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<tryton>
+    <data>
+        <record model="ir.rule.group" id="rule_group_line_project_invoice">
+            <field name="model" search="[('model', '=', 'timesheet.line')]"/>
+            <field name="global_p" eval="False"/>
+            <field name="default_p" eval="False"/>
+        </record>
+        <record model="ir.rule.group-res.group"
+            id="rule_group_line_project_invoice_group_project_invoice">
+            <field name="rule_group" ref="rule_group_line_project_invoice"/>
+            <field name="group" ref="group_project_invoice"/>
+        </record>
+    </data>
+</tryton>
diff --git a/tryton.cfg b/tryton.cfg
index 2c711bf..a68f498 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=2.8.2
+version=3.0.0
 depends:
     ir
     project
@@ -11,3 +11,4 @@ depends:
 xml:
     project.xml
     work.xml
+    timesheet.xml
diff --git a/trytond_project_invoice.egg-info/PKG-INFO b/trytond_project_invoice.egg-info/PKG-INFO
index fd13513..f53780c 100644
--- a/trytond_project_invoice.egg-info/PKG-INFO
+++ b/trytond_project_invoice.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-project-invoice
-Version: 2.8.2
+Version: 3.0.0
 Summary: Tryton module to invoice projects
 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_project_invoice
         =======================
         
@@ -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_project_invoice.egg-info/SOURCES.txt b/trytond_project_invoice.egg-info/SOURCES.txt
index 4663da6..e00a96a 100644
--- a/trytond_project_invoice.egg-info/SOURCES.txt
+++ b/trytond_project_invoice.egg-info/SOURCES.txt
@@ -6,6 +6,7 @@ MANIFEST.in
 README
 project.xml
 setup.py
+timesheet.xml
 tryton.cfg
 work.xml
 ./__init__.py
@@ -19,6 +20,7 @@ locale/de_DE.po
 locale/es_AR.po
 locale/es_ES.po
 locale/fr_FR.po
+locale/sl_SI.po
 tests/scenario_project_invoice_effort.rst
 tests/scenario_project_invoice_timesheet.rst
 trytond_project_invoice.egg-info/PKG-INFO
diff --git a/trytond_project_invoice.egg-info/requires.txt b/trytond_project_invoice.egg-info/requires.txt
index a51e671..d1fcedf 100644
--- a/trytond_project_invoice.egg-info/requires.txt
+++ b/trytond_project_invoice.egg-info/requires.txt
@@ -1,7 +1,8 @@
-trytond_project >= 2.8, < 2.9
-trytond_project_revenue >= 2.8, < 2.9
-trytond_timesheet >= 2.8, < 2.9
-trytond_account >= 2.8, < 2.9
-trytond_account_invoice >= 2.8, < 2.9
-trytond_product >= 2.8, < 2.9
-trytond >= 2.8, < 2.9
\ No newline at end of file
+python-sql
+trytond_project >= 3.0, < 3.1
+trytond_project_revenue >= 3.0, < 3.1
+trytond_timesheet >= 3.0, < 3.1
+trytond_account >= 3.0, < 3.1
+trytond_account_invoice >= 3.0, < 3.1
+trytond_product >= 3.0, < 3.1
+trytond >= 3.0, < 3.1
\ No newline at end of file
diff --git a/work.py b/work.py
index b237dde..765e61e 100644
--- a/work.py
+++ b/work.py
@@ -2,6 +2,7 @@
 #this repository contains the full copyright notices and license terms.
 from itertools import groupby
 from decimal import Decimal
+from sql.aggregate import Sum
 
 from trytond.model import ModelView, fields
 from trytond.pool import PoolMeta
@@ -183,19 +184,21 @@ class Work:
         pool = Pool()
         TimesheetLine = pool.get('timesheet.line')
         cursor = Transaction().cursor
+        line = TimesheetLine.__table__()
 
         hours = {}
         twork2work = dict((w.work.id, w.id) for w in works)
         ids = twork2work.keys()
         for i in range(0, len(ids), cursor.IN_MAX):
             sub_ids = ids[i:i + cursor.IN_MAX]
-            red_sql, red_ids = reduce_ids('work', sub_ids)
-            cursor.execute('SELECT work, SUM(hours) '
-                'FROM "' + TimesheetLine._table + '" '
-                'WHERE ' + red_sql + ' '
-                    'AND invoice_line IS ' + (
-                    'NOT NULL ' if invoiced else 'NULL ') +
-                'GROUP BY work', red_ids)
+            red_sql = reduce_ids(line.work, sub_ids)
+            if invoiced:
+                where = line.invoice_line != None
+            else:
+                where = line.invoice_line == None
+            cursor.execute(*line.select(line.work, Sum(line.hours),
+                    where=red_sql & where,
+                    group_by=line.work))
             hours.update(dict((twork2work[w], h)
                     for w, h in cursor.fetchall()))
         return hours
-- 
tryton-modules-project-invoice



More information about the tryton-debian-vcs mailing list