[tryton-debian-vcs] tryton-modules-project-revenue branch upstream-2.2 created. 6509d05d7edf2bb39c53efd00ce8218d4597e70c

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Nov 27 17:07:14 UTC 2013


The following commit has been merged in the upstream-2.2 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-modules-project-revenue.git;a=commitdiff;h=6509d05d7edf2bb39c53efd00ce8218d4597e70c
commit 6509d05d7edf2bb39c53efd00ce8218d4597e70c
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Feb 24 19:46:18 2013 +0100

    Adding upstream version 2.2.2.

diff --git a/CHANGELOG b/CHANGELOG
index f9faa83..9be758a 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 2.2.2 - 2012-11-05
+* Bug fixes (see mercurial logs for details)
+
 Version 2.2.1 - 2011-12-26
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index bd93e8d..d3682c5 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (C) 2008-2011 Cédric Krier.
-Copyright (C) 2008-2011 B2CK SPRL.
+Copyright (C) 2008-2012 Cédric Krier.
+Copyright (C) 2008-2012 B2CK SPRL.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/PKG-INFO b/PKG-INFO
index ed9cb51..8776ea9 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond_project_revenue
-Version: 2.2.1
+Version: 2.2.2
 Summary: Add product on timesheet lines.
 Define allowed services for each employees.
 
diff --git a/__tryton__.py b/__tryton__.py
index 2d1b3e9..f28fc57 100644
--- a/__tryton__.py
+++ b/__tryton__.py
@@ -7,7 +7,7 @@
     'name_es_CO': 'Ingresos por proyectos',
     'name_es_ES': 'Beneficio de proyecto',
     'name_fr_FR': 'Revenu des projets',
-    'version': '2.2.1',
+    'version': '2.2.2',
     'author': 'B2CK',
     'email': 'info at b2ck.com',
     'website': 'http://www.tryton.org/',
diff --git a/service.py b/service.py
index fcf6892..5fa0a32 100644
--- a/service.py
+++ b/service.py
@@ -57,6 +57,7 @@ class Employee(ModelSQL, ModelView, Cacheable):
             for edate, ecost in employee_costs:
                 if date >= edate:
                     cost = ecost
+                else:
                     break
         return cost
 
diff --git a/trytond_project_revenue.egg-info/PKG-INFO b/trytond_project_revenue.egg-info/PKG-INFO
index d47e23c..3d75b9f 100644
--- a/trytond_project_revenue.egg-info/PKG-INFO
+++ b/trytond_project_revenue.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond-project-revenue
-Version: 2.2.1
+Version: 2.2.2
 Summary: Add product on timesheet lines.
 Define allowed services for each employees.
 
diff --git a/work.py b/work.py
index c5c419b..c70e333 100644
--- a/work.py
+++ b/work.py
@@ -60,10 +60,11 @@ class Work(ModelSQL, ModelView):
                 ('parent', 'child_of', ids),
                 ('active', '=', True)]) + ids
         all_ids = list(set(all_ids))
+        works = set(self.browse(all_ids))
         res = {}
         id2work = {}
         leafs = set()
-        for work in self.browse(all_ids):
+        for work in works:
             id2work[work.id] = work
             if not work.children:
                 leafs.add(work.id)
@@ -73,20 +74,20 @@ class Work(ModelSQL, ModelView):
                 res[work.id] += timesheet_line_obj.compute_cost(ts_line)
 
         while leafs:
-            parents = set()
             for work_id in leafs:
                 work = id2work[work_id]
+                works.remove(work)
                 if not work.active:
                     continue
                 if work.parent and work.parent.id in res:
                     res[work.parent.id] += res[work_id]
-                    parents.add(work.parent.id)
-            leafs = parents
-
-        for id in all_ids:
-            if id not in ids:
-                del res[id]
-
+            next_leafs = set(w.id for w in works)
+            for work in works:
+                if not work.parent:
+                    continue
+                if work.parent.id in next_leafs and work.parent in works:
+                    next_leafs.remove(work.parent.id)
+            leafs = next_leafs
         return res
 
     def get_revenue(self, ids, name):
@@ -94,10 +95,11 @@ class Work(ModelSQL, ModelView):
                 ('parent', 'child_of', ids),
                 ('active', '=', True)]) + ids
         all_ids = list(set(all_ids))
+        works = set(self.browse(all_ids))
         res = {}
         id2work = {}
         leafs = set()
-        for work in self.browse(all_ids):
+        for work in works:
             id2work[work.id] = work
             if not work.children:
                 leafs.add(work.id)
@@ -108,20 +110,20 @@ class Work(ModelSQL, ModelView):
                 res[work.id] = Decimal('0')
 
         while leafs:
-            parents = set()
             for work_id in leafs:
                 work = id2work[work_id]
+                works.remove(work)
                 if not work.active:
                     continue
                 if work.parent and work.parent.id in res:
                     res[work.parent.id] += res[work_id]
-                    parents.add(work.parent.id)
-            leafs = parents
-
-        for id in all_ids:
-            if id not in ids:
-                del res[id]
-
+            next_leafs = set(w.id for w in works)
+            for work in works:
+                if not work.parent:
+                    continue
+                if work.parent.id in next_leafs and work.parent in works:
+                    next_leafs.remove(work.parent.id)
+            leafs = next_leafs
         return res
 
     def get_currency_digits(self, ids, name):
-- 
tryton-modules-project-revenue



More information about the tryton-debian-vcs mailing list