[tryton-debian-vcs] tryton-modules-project-invoice branch upstream updated. upstream/4.2.0-1-gb2c57f9

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Jun 7 13:34:51 UTC 2017


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

commit b2c57f92d8399c95f6e7487bd3b5aba9194ffddf
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Jun 7 15:26:51 2017 +0200

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

diff --git a/CHANGELOG b/CHANGELOG
index 48cab07..fba5484 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.4.0 - 2017-05-01
+* Bug fixes (see mercurial logs for details)
+
 Version 4.2.0 - 2016-11-28
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index 20bd036..4d643a0 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (C) 2013-2016 Cédric Krier.
-Copyright (C) 2013-2016 B2CK SPRL.
+Copyright (C) 2013-2017 Cédric Krier.
+Copyright (C) 2013-2017 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 d3a01df..68cb561 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_project_invoice
-Version: 4.2.0
+Version: 4.4.0
 Summary: Tryton module to invoice projects
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/4.2/
+Download-URL: http://downloads.tryton.org/4.4/
 Description: trytond_project_invoice
         =======================
         
@@ -52,7 +52,7 @@ Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Financial and Insurance Industry
 Classifier: Intended Audience :: Legal Industry
 Classifier: Intended Audience :: Manufacturing
-Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
 Classifier: Natural Language :: Bulgarian
 Classifier: Natural Language :: Catalan
 Classifier: Natural Language :: Chinese (Simplified)
diff --git a/locale/es_419.po b/locale/es_419.po
index 96b88bd..0b32136 100644
--- a/locale/es_419.po
+++ b/locale/es_419.po
@@ -42,9 +42,10 @@ msgctxt "field:project.work,invoiced_duration:"
 msgid "Invoiced Duration"
 msgstr "Duración facturada"
 
+#, fuzzy
 msgctxt "field:project.work,invoiced_progress:"
 msgid "Invoiced Progress"
-msgstr ""
+msgstr "Progreso facturado de trabajo"
 
 msgctxt "field:project.work,project_invoice_method:"
 msgid "Invoice Method"
diff --git a/setup.py b/setup.py
index 64ff039..167cdaf 100644
--- a/setup.py
+++ b/setup.py
@@ -85,7 +85,7 @@ setup(name=name,
         'Intended Audience :: Financial and Insurance Industry',
         'Intended Audience :: Legal Industry',
         'Intended Audience :: Manufacturing',
-        'License :: OSI Approved :: GNU General Public License (GPL)',
+        'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
         'Natural Language :: Bulgarian',
         'Natural Language :: Catalan',
         'Natural Language :: Chinese (Simplified)',
diff --git a/tests/scenario_project_invoice_effort.rst b/tests/scenario_project_invoice_effort.rst
index 7c393c7..182f2ba 100644
--- a/tests/scenario_project_invoice_effort.rst
+++ b/tests/scenario_project_invoice_effort.rst
@@ -101,30 +101,24 @@ Create a Project::
 
     >>> config.user = project_user.id
     >>> ProjectWork = Model.get('project.work')
-    >>> TimesheetWork = Model.get('timesheet.work')
     >>> project = ProjectWork()
     >>> project.name = 'Test effort'
-    >>> work = TimesheetWork()
-    >>> work.name = 'Test effort'
-    >>> work.save()
-    >>> project.work = work
     >>> project.type = 'project'
     >>> project.party = customer
     >>> project.project_invoice_method = 'effort'
     >>> project.product = product
     >>> project.effort_duration = datetime.timedelta(hours=1)
-    >>> task = ProjectWork()
+    >>> task = project.children.new()
     >>> task.name = 'Task 1'
-    >>> work = TimesheetWork()
-    >>> work.name = 'Task 1'
-    >>> work.save()
-    >>> task.work = work
     >>> task.type = 'task'
     >>> task.product = product
     >>> task.effort_duration = datetime.timedelta(hours=5)
-    >>> project.children.append(task)
+    >>> task_no_effort = project.children.new()
+    >>> task_no_effort.name = "Task 2"
+    >>> task_no_effort.type = 'task'
+    >>> task_no_effort.effort_duration = None
     >>> project.save()
-    >>> task, = project.children
+    >>> task, task_no_effort = project.children
 
 Check project duration::
 
@@ -165,6 +159,8 @@ Invoice project::
 Do project::
 
     >>> config.user = project_user.id
+    >>> task_no_effort.state = 'done'
+    >>> task_no_effort.save()
     >>> project.state = 'done'
     >>> project.save()
 
diff --git a/timesheet.xml b/timesheet.xml
index 16436b4..8938bd7 100644
--- a/timesheet.xml
+++ b/timesheet.xml
@@ -19,7 +19,7 @@ this repository contains the full copyright notices and license terms. -->
         <field name="name">Timesheet Lines</field>
         <field name="res_model">timesheet.line</field>
         <field name="domain"
-            eval="[('invoice_line.invoice', 'in', Eval('active_ids'))]"
+            eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('invoice_line.invoice', '=', Eval('active_id')), ('invoice_line.invoice', 'in', Eval('active_ids')))]"
             pyson="1"/>
     </record>
     <record model="ir.action.keyword"
diff --git a/tryton.cfg b/tryton.cfg
index 55ffda2..bd5ce75 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=4.2.0
+version=4.4.0
 depends:
     ir
     project
diff --git a/trytond_project_invoice.egg-info/PKG-INFO b/trytond_project_invoice.egg-info/PKG-INFO
index 269d462..7693212 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: 4.2.0
+Version: 4.4.0
 Summary: Tryton module to invoice projects
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: GPL-3
-Download-URL: http://downloads.tryton.org/4.2/
+Download-URL: http://downloads.tryton.org/4.4/
 Description: trytond_project_invoice
         =======================
         
@@ -52,7 +52,7 @@ Classifier: Intended Audience :: Developers
 Classifier: Intended Audience :: Financial and Insurance Industry
 Classifier: Intended Audience :: Legal Industry
 Classifier: Intended Audience :: Manufacturing
-Classifier: License :: OSI Approved :: GNU General Public License (GPL)
+Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
 Classifier: Natural Language :: Bulgarian
 Classifier: Natural Language :: Catalan
 Classifier: Natural Language :: Chinese (Simplified)
diff --git a/trytond_project_invoice.egg-info/requires.txt b/trytond_project_invoice.egg-info/requires.txt
index ff1fab9..48fc471 100644
--- a/trytond_project_invoice.egg-info/requires.txt
+++ b/trytond_project_invoice.egg-info/requires.txt
@@ -1,8 +1,8 @@
 python-sql >= 0.4
-trytond_project >= 4.2, < 4.3
-trytond_project_revenue >= 4.2, < 4.3
-trytond_timesheet >= 4.2, < 4.3
-trytond_account >= 4.2, < 4.3
-trytond_account_invoice >= 4.2, < 4.3
-trytond_product >= 4.2, < 4.3
-trytond >= 4.2, < 4.3
+trytond_project >= 4.4, < 4.5
+trytond_project_revenue >= 4.4, < 4.5
+trytond_timesheet >= 4.4, < 4.5
+trytond_account >= 4.4, < 4.5
+trytond_account_invoice >= 4.4, < 4.5
+trytond_product >= 4.4, < 4.5
+trytond >= 4.4, < 4.5
diff --git a/work.py b/work.py
index ee240f9..2934599 100644
--- a/work.py
+++ b/work.py
@@ -42,7 +42,7 @@ class Work:
             },
         depends=['invoiced_duration', 'type'])
     invoice_method = fields.Function(fields.Selection(INVOICE_METHODS,
-            'Invoice Method'), 'get_invoice_method')
+            'Invoice Method'), 'on_change_with_invoice_method')
     invoiced_duration = fields.Function(fields.TimeDelta('Invoiced Duration',
             'company_work_time',
             states={
@@ -96,7 +96,9 @@ class Work:
         default.setdefault('invoice_line', None)
         return super(Work, cls).copy(records, default=default)
 
-    def get_invoice_method(self, name):
+    @fields.depends('type', 'project_invoice_method',
+        'parent', '_parent_parent.invoice_method')
+    def on_change_with_invoice_method(self, name=None):
         if self.type == 'project':
             return self.project_invoice_method
         elif self.parent:
@@ -141,7 +143,7 @@ class Work:
     @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)
+            if w.state == 'done' and not w.invoice_line and w.effort_duration)
 
     @staticmethod
     def _get_duration_to_invoice_progress(works):
@@ -418,6 +420,7 @@ class Work:
     def _group_lines_to_invoice_key(self, line):
         "The key to group lines"
         return (('product', line['product']),
+            ('unit', line['unit']),
             ('unit_price', line['unit_price']),
             ('description', line['description']))
 
@@ -425,23 +428,27 @@ class Work:
         "Return a invoice line for the lines"
         pool = Pool()
         InvoiceLine = pool.get('account.invoice.line')
-        ModelData = pool.get('ir.model.data')
         Uom = pool.get('product.uom')
 
-        hour = Uom(ModelData.get_id('product', 'uom_hour'))
         quantity = sum(l['quantity'] for l in lines)
         product = key['product']
 
         invoice_line = InvoiceLine()
         invoice_line.type = 'line'
-        invoice_line.quantity = Uom.compute_qty(hour, quantity,
-            product.default_uom)
-        invoice_line.unit = product.default_uom
-        invoice_line.product = product
         invoice_line.description = key['description']
         invoice_line.account = product.account_revenue_used
-        invoice_line.unit_price = Uom.compute_price(hour, key['unit_price'],
-            product.default_uom)
+        if (key['unit']
+                and key['unit'].category == product.default_uom.category):
+            invoice_line.product = product
+            invoice_line.unit_price = Uom.compute_price(
+                key['unit'], key['unit_price'], product.default_uom)
+            invoice_line.quantity = Uom.compute_qty(
+                key['unit'], quantity, product.default_uom)
+            invoice_line.unit = product.default_uom
+        else:
+            invoice_line.unit_price = key['unit_price']
+            invoice_line.quantity = quantity
+            invoice_line.unit = key['unit']
 
         taxes = []
         pattern = invoice_line._get_tax_rule_pattern()
@@ -464,6 +471,12 @@ class Work:
         return []
 
     def _get_lines_to_invoice_effort(self):
+        pool = Pool()
+        ModelData = pool.get('ir.model.data')
+        Uom = pool.get('product.uom')
+
+        hour = Uom(ModelData.get_id('product', 'uom_hour'))
+
         if (not self.invoice_line
                 and self.effort_hours
                 and self.state == 'done'):
@@ -474,6 +487,7 @@ class Work:
             return [{
                     'product': self.product,
                     'quantity': self.effort_hours,
+                    'unit': hour,
                     'unit_price': self.list_price,
                     'origin': self,
                     'description': self.name,
@@ -506,6 +520,7 @@ class Work:
             return [{
                     'product': self.product,
                     'quantity': quantity,
+                    'unit': hour,
                     'unit_price': self.list_price,
                     'origin': invoiced_progress,
                     'description': self.name,
@@ -514,6 +529,11 @@ class Work:
         return []
 
     def _get_lines_to_invoice_timesheet(self):
+        pool = Pool()
+        ModelData = pool.get('ir.model.data')
+        Uom = pool.get('product.uom')
+
+        hour = Uom(ModelData.get_id('product', 'uom_hour'))
         if (self.timesheet_works
                 and any(tw.timesheet_lines for tw in self.timesheet_works)):
             if not self.product:
@@ -523,6 +543,7 @@ class Work:
             return [{
                     'product': self.product,
                     'quantity': l.hours,
+                    'unit': hour,
                     'unit_price': self.list_price,
                     'origin': l,
                     'description': self.name,
-- 
tryton-modules-project-invoice



More information about the tryton-debian-vcs mailing list