changeset 26f24e3def35 in modules/project_invoice:default
details: 
https://hg.tryton.org/modules/project_invoice?cmd=changeset;node=26f24e3def35
description:
        Make project status configurable

        issue7746
        review64411002
diffstat:

 doc/index.rst                                     |   2 +-
 tests/scenario_project_invoice_effort.rst         |   6 +++---
 tests/scenario_project_invoice_multiple_party.rst |   4 ++--
 tests/scenario_project_invoice_progress.rst       |  10 +++++-----
 work.py                                           |   4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)

diffs (111 lines):

diff -r 03e1b2950de9 -r 26f24e3def35 doc/index.rst
--- a/doc/index.rst     Sat Dec 07 15:07:58 2019 +0100
+++ b/doc/index.rst     Tue Jan 28 11:45:54 2020 +0100
@@ -6,7 +6,7 @@
 
 - Manual: Tryton doesn't create any invoice.
 - On Effort: The invoices are created based on the *Effort* hours for all
-  children works in state *Done*.
+  children works with 100% progress.
 - On Progress: The invoices are create proportionally to the *Progress* of the
   *Effort* hours of each children work.
 - On Timesheet: The invoices are created based on the timesheets encoded on all
diff -r 03e1b2950de9 -r 26f24e3def35 tests/scenario_project_invoice_effort.rst
--- a/tests/scenario_project_invoice_effort.rst Sat Dec 07 15:07:58 2019 +0100
+++ b/tests/scenario_project_invoice_effort.rst Tue Jan 28 11:45:54 2020 +0100
@@ -137,7 +137,7 @@
 
 Do 1 task::
 
-    >>> task.state = 'done'
+    >>> task.progress = 1
     >>> task.save()
 
 Check project duration::
@@ -164,9 +164,9 @@
 Do project::
 
     >>> set_user(project_user)
-    >>> task_no_effort.state = 'done'
+    >>> task_no_effort.progress = 1
     >>> task_no_effort.save()
-    >>> project.state = 'done'
+    >>> project.progress = 1
     >>> project.save()
 
 Check project duration::
diff -r 03e1b2950de9 -r 26f24e3def35 
tests/scenario_project_invoice_multiple_party.rst
--- a/tests/scenario_project_invoice_multiple_party.rst Sat Dec 07 15:07:58 
2019 +0100
+++ b/tests/scenario_project_invoice_multiple_party.rst Tue Jan 28 11:45:54 
2020 +0100
@@ -95,9 +95,9 @@
 
 Do project and subproject::
 
-    >>> subproject.state = 'done'
+    >>> subproject.progress = 1
     >>> subproject.save()
-    >>> project.state = 'done'
+    >>> project.progress = 1
     >>> project.save()
 
 Check project duration::
diff -r 03e1b2950de9 -r 26f24e3def35 tests/scenario_project_invoice_progress.rst
--- a/tests/scenario_project_invoice_progress.rst       Sat Dec 07 15:07:58 
2019 +0100
+++ b/tests/scenario_project_invoice_progress.rst       Tue Jan 28 11:45:54 
2020 +0100
@@ -159,12 +159,12 @@
     >>> project.invoiced_amount
     Decimal('50.00')
 
-Do 75% of task and 100% of project::
+Do 75% of task and 80% of project::
 
     >>> set_user(project_user)
     >>> task.progress = 0.75
     >>> task.save()
-    >>> project.progress = 1.
+    >>> project.progress = 0.80
     >>> project.save()
 
 Check project duration::
@@ -172,7 +172,7 @@
     >>> project.reload()
     >>> project.invoiced_duration == datetime.timedelta(0, 9000)
     True
-    >>> project.duration_to_invoice == datetime.timedelta(0, 8100)
+    >>> project.duration_to_invoice == datetime.timedelta(0, 7380)
     True
     >>> project.invoiced_amount
     Decimal('50.00')
@@ -181,9 +181,9 @@
 
     >>> set_user(project_invoice_user)
     >>> project.click('invoice')
-    >>> project.invoiced_duration == datetime.timedelta(0, 17100)
+    >>> project.invoiced_duration == datetime.timedelta(0, 16380)
     True
     >>> project.duration_to_invoice
     datetime.timedelta(0)
     >>> project.invoiced_amount
-    Decimal('95.00')
+    Decimal('91.00')
diff -r 03e1b2950de9 -r 26f24e3def35 work.py
--- a/work.py   Sat Dec 07 15:07:58 2019 +0100
+++ b/work.py   Tue Jan 28 11:45:54 2020 +0100
@@ -143,7 +143,7 @@
     @staticmethod
     def _get_duration_to_invoice_effort(works):
         return dict((w.id, w.effort_duration) for w in works
-            if w.state == 'done' and not w.invoice_line and w.effort_duration)
+            if w.progress == 1 and not w.invoice_line and w.effort_duration)
 
     @staticmethod
     def _get_duration_to_invoice_progress(works):
@@ -485,7 +485,7 @@
 
         if (not self.invoice_line
                 and self.effort_hours
-                and self.state == 'done'):
+                and self.progress == 1):
             if not self.product:
                 raise InvoicingError(
                     gettext('project_invoice.msg_missing_product',

Reply via email to