[tryton-debian-vcs] tryton-modules-project-invoice branch upstream-3.6 updated. upstream/3.6.1-1-gdb63d0e

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Dec 23 16:53:31 UTC 2015


The following commit has been merged in the upstream-3.6 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-project-invoice.git;a=commitdiff;h=upstream/3.6.1-1-gdb63d0e

commit db63d0ec9c4082501866573462b1f2500bc32e13
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Dec 23 15:17:43 2015 +0100

    Adding upstream version 3.6.2.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/CHANGELOG b/CHANGELOG
index 61b8263..a5d0c7b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.6.2 - 2015-12-22
+* Bug fixes (see mercurial logs for details)
+
 Version 3.6.1 - 2015-07-13
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index e070cc5..5a539b7 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_project_invoice
-Version: 3.6.1
+Version: 3.6.2
 Summary: Tryton module to invoice projects
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/tests/scenario_project_invoice_timesheet.rst b/tests/scenario_project_invoice_timesheet.rst
index 351963f..0c6d775 100644
--- a/tests/scenario_project_invoice_timesheet.rst
+++ b/tests/scenario_project_invoice_timesheet.rst
@@ -168,7 +168,7 @@ Invoice project::
     >>> project.duration_to_invoice
     datetime.timedelta(0)
     >>> project.invoiced_amount
-    Decimal('100.000000000000')
+    Decimal('100.00')
 
 Create more timesheets::
 
@@ -188,7 +188,7 @@ Check project duration::
     >>> project.duration_to_invoice
     datetime.timedelta(0, 14400)
     >>> project.invoiced_amount
-    Decimal('100.000000000000')
+    Decimal('100.00')
 
 Invoice again project::
 
@@ -199,4 +199,4 @@ Invoice again project::
     >>> project.duration_to_invoice
     datetime.timedelta(0)
     >>> project.invoiced_amount
-    Decimal('180.000000000000')
+    Decimal('180.00')
diff --git a/tryton.cfg b/tryton.cfg
index 1f87746..f95bd1f 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=3.6.1
+version=3.6.2
 depends:
     ir
     project
diff --git a/trytond_project_invoice.egg-info/PKG-INFO b/trytond_project_invoice.egg-info/PKG-INFO
index d531a83..34be11c 100644
--- a/trytond_project_invoice.egg-info/PKG-INFO
+++ b/trytond_project_invoice.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-project-invoice
-Version: 3.6.1
+Version: 3.6.2
 Summary: Tryton module to invoice projects
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/work.py b/work.py
index b6684ab..f7d46b8 100644
--- a/work.py
+++ b/work.py
@@ -99,12 +99,6 @@ class Work:
         else:
             return 'manual'
 
-    @property
-    def effort_hours(self):
-        if not self.effort_duration:
-            return 0
-        return self.effort_duration.total_seconds() / 60 / 60
-
     @staticmethod
     def default_invoiced_duration():
         return datetime.timedelta()
@@ -151,6 +145,7 @@ class Work:
     def _get_invoiced_amount_effort(works):
         pool = Pool()
         InvoiceLine = pool.get('account.invoice.line')
+        Currency = pool.get('currency.currency')
 
         invoice_lines = InvoiceLine.browse([
                 w.invoice_line.id for w in works
@@ -159,9 +154,14 @@ class Work:
         id2invoice_lines = dict((l.id, l) for l in invoice_lines)
         amounts = {}
         for work in works:
+            currency = work.company.currency
             if work.invoice_line:
                 invoice_line = id2invoice_lines[work.invoice_line.id]
-                amounts[work.id] = invoice_line.amount
+                invoice_currency = (invoice_line.invoice.currency
+                    if invoice_line.invoice else invoice_line.currency)
+                amounts[work.id] = Currency.compute(invoice_currency,
+                    Decimal(str(work.effort_hours)) * invoice_line.unit_price,
+                    currency)
             else:
                 amounts[work.id] = Decimal(0)
         return amounts
@@ -170,6 +170,7 @@ class Work:
     def _get_invoiced_amount_timesheet(works):
         pool = Pool()
         InvoiceLine = pool.get('account.invoice.line')
+        Currency = pool.get('currency.currency')
 
         invoice_lines = InvoiceLine.browse([
                 t.invoice_line.id for w in works
@@ -179,13 +180,18 @@ class Work:
         id2invoice_lines = dict((l.id, l) for l in invoice_lines)
         amounts = {}
         for work in works:
+            currency = work.company.currency
             amounts[work.id] = Decimal(0)
             for timesheet_line in work.work.timesheet_lines:
                 if not timesheet_line.invoice_line:
                     continue
                 invoice_line = id2invoice_lines[timesheet_line.invoice_line.id]
-                amounts[work.id] += (invoice_line.unit_price
-                    * Decimal(str(timesheet_line.hours)))
+                invoice_currency = (invoice_line.invoice.currency
+                    if invoice_line.invoice else invoice_line.currency)
+                amounts[work.id] += Currency.compute(invoice_currency,
+                    (Decimal(str(timesheet_line.hours))
+                        * invoice_line.unit_price),
+                    currency)
         return amounts
 
     @staticmethod
-- 
tryton-modules-project-invoice



More information about the tryton-debian-vcs mailing list