[tryton-debian-vcs] tryton-modules-project-revenue branch upstream updated. upstream/3.6.0-1-g0ad81f2
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Wed Nov 11 11:26:44 UTC 2015
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-revenue.git;a=commitdiff;h=upstream/3.6.0-1-g0ad81f2
commit 0ad81f2132ea75a39bae7769b32e6eda851f7eb1
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed Nov 11 12:11:14 2015 +0100
Adding upstream version 3.8.0.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index 588c0ff..fa2bfee 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,12 @@
+Version 3.8.0 - 2015-11-02
+* Bug fixes (see mercurial logs for details)
+* Use product price_decimal for list price
+* Include linked purchase to cost
+
Version 3.6.0 - 2015-04-20
* Bug fixes (see mercurial logs for details)
* Add support for PyPy
+
Version 3.4.0 - 2014-10-20
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index ef5ad1c..7f122c6 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_project_revenue
-Version: 3.6.0
+Version: 3.8.0
Summary: Tryton module to add revenue on project
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.6/
+Download-URL: http://downloads.tryton.org/3.8/
Description: trytond_project_revenue
=======================
@@ -60,6 +60,9 @@ Classifier: Natural Language :: Dutch
Classifier: Natural Language :: English
Classifier: Natural Language :: French
Classifier: Natural Language :: German
+Classifier: Natural Language :: Hungarian
+Classifier: Natural Language :: Italian
+Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
diff --git a/__init__.py b/__init__.py
index d66b71d..72fdea2 100644
--- a/__init__.py
+++ b/__init__.py
@@ -3,9 +3,11 @@
from trytond.pool import Pool
from .work import *
+from .purchase import *
def register():
Pool.register(
Work,
+ PurchaseLine,
module='project_revenue', type_='model')
diff --git a/locale/bg_BG.po b/locale/bg_BG.po
index 27cdbeb..5817efd 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -18,14 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Продукт"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Приход"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Разход"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Приход"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index cdf01f9..d343401 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -18,14 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Producte"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr "Línies de compra"
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Ingressos"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Cost"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr "Temps del treball"
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Ingressos"
+msgid "Purchases"
+msgstr "Compres"
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index bfce1c1..281d93e 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -18,6 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr ""
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr ""
+
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
+
+msgctxt "view:project.work:"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index dfbad15..d10a356 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -16,16 +16,20 @@ msgstr "Listenpreis"
msgctxt "field:project.work,product:"
msgid "Product"
-msgstr "Artikel"
+msgstr "Variante"
+
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr "Einkaufspositionen"
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Ertrag"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Kosten"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr "Aufgabe Aufwand"
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Ertrag"
+msgid "Purchases"
+msgstr "Einkäufe"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 45621a7..bc5b3ab 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -18,14 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Producto"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr "Líneas de compra"
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Ingresos"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Costo"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr "Actividades"
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Ingresos"
+msgid "Purchases"
+msgstr "Compras"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 557d5bf..96c20c5 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -18,14 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Producto"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Ingresos"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Costo"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Ingresos"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/es_EC.po b/locale/es_EC.po
index f679887..2b4655e 100644
--- a/locale/es_EC.po
+++ b/locale/es_EC.po
@@ -18,14 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Producto"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr "Líneas de compra"
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Ingresos"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Costo"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr "Esfuerzo de trabajo"
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Ingresos"
+msgid "Purchases"
+msgstr "Compras"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index e2e2fa1..abb2a90 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -18,14 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Producto"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr "Líneas de compra"
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Ingresos"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Coste"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr "Tiempo del trabajo"
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Ingresos"
+msgid "Purchases"
+msgstr "Compras"
diff --git a/locale/es_ES.po b/locale/es_MX.po
similarity index 74%
copy from locale/es_ES.po
copy to locale/es_MX.po
index e2e2fa1..ca8f08d 100644
--- a/locale/es_ES.po
+++ b/locale/es_MX.po
@@ -18,14 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Producto"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Ingresos"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Coste"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Ingresos"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index 7e1da76..7892424 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -18,14 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Produit"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr "Lignes d'achat"
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Revenu"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Coût"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr "Effort de travail"
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Revenu"
+msgid "Purchases"
+msgstr "Achats"
diff --git a/locale/cs_CZ.po b/locale/hu_HU.po
similarity index 66%
copy from locale/cs_CZ.po
copy to locale/hu_HU.po
index bfce1c1..281d93e 100644
--- a/locale/cs_CZ.po
+++ b/locale/hu_HU.po
@@ -18,6 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr ""
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr ""
+
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
+
+msgctxt "view:project.work:"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/cs_CZ.po b/locale/it_IT.po
similarity index 66%
copy from locale/cs_CZ.po
copy to locale/it_IT.po
index bfce1c1..281d93e 100644
--- a/locale/cs_CZ.po
+++ b/locale/it_IT.po
@@ -18,6 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr ""
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr ""
+
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
+
+msgctxt "view:project.work:"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/cs_CZ.po b/locale/ja_JP.po
similarity index 66%
copy from locale/cs_CZ.po
copy to locale/ja_JP.po
index bfce1c1..281d93e 100644
--- a/locale/cs_CZ.po
+++ b/locale/ja_JP.po
@@ -18,6 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr ""
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr ""
+
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
+
+msgctxt "view:project.work:"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/cs_CZ.po b/locale/lt_LT.po
similarity index 66%
copy from locale/cs_CZ.po
copy to locale/lt_LT.po
index bfce1c1..281d93e 100644
--- a/locale/cs_CZ.po
+++ b/locale/lt_LT.po
@@ -18,6 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr ""
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr ""
+
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
+
+msgctxt "view:project.work:"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index ff670b0..1ededcb 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -21,7 +21,19 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Producten"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
#, fuzzy
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Opbrengst"
+
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
+
+msgctxt "view:project.work:"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/de_DE.po b/locale/pt_BR.po
similarity index 54%
copy from locale/de_DE.po
copy to locale/pt_BR.po
index dfbad15..6bf091c 100644
--- a/locale/de_DE.po
+++ b/locale/pt_BR.po
@@ -4,28 +4,32 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:project.work,cost:"
msgid "Cost"
-msgstr "Kosten"
+msgstr "Custo"
msgctxt "field:project.work,currency_digits:"
msgid "Currency Digits"
-msgstr "Nachkommastellen Währung"
+msgstr "Dígitos da Moeda"
msgctxt "field:project.work,list_price:"
msgid "List Price"
-msgstr "Listenpreis"
+msgstr "Preço de Lista"
msgctxt "field:project.work,product:"
msgid "Product"
-msgstr "Artikel"
+msgstr "Produto"
+
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr "Linhas de compra"
msgctxt "field:project.work,revenue:"
msgid "Revenue"
-msgstr "Ertrag"
+msgstr "Receita"
-msgctxt "view:project.work:"
-msgid "Cost"
-msgstr "Kosten"
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr "Esforço de trabalho"
msgctxt "view:project.work:"
-msgid "Revenue"
-msgstr "Ertrag"
+msgid "Purchases"
+msgstr "Compras"
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index 37adc4f..7d8b25d 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -18,6 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Продукт"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr ""
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Доходы"
+
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr ""
+
+msgctxt "view:project.work:"
+msgid "Purchases"
+msgstr ""
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 9bd05d7..ef8f148 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -18,6 +18,18 @@ msgctxt "field:project.work,product:"
msgid "Product"
msgstr "Izdelek"
+msgctxt "field:project.work,purchase_lines:"
+msgid "Purchase Lines"
+msgstr "Nabavne postavke"
+
msgctxt "field:project.work,revenue:"
msgid "Revenue"
msgstr "Prihodki"
+
+msgctxt "field:purchase.line,work:"
+msgid "Work Effort"
+msgstr "Ocena naloge"
+
+msgctxt "view:project.work:"
+msgid "Purchases"
+msgstr "Nabavni nalogi"
diff --git a/purchase.py b/purchase.py
new file mode 100644
index 0000000..0218afa
--- /dev/null
+++ b/purchase.py
@@ -0,0 +1,17 @@
+# This file is part of Tryton. The COPYRIGHT file at the top level of
+# this repository contains the full copyright notices and license terms.
+from trytond.pool import PoolMeta
+from trytond.model import fields
+from trytond.pyson import Eval
+
+__all__ = ['PurchaseLine']
+
+
+class PurchaseLine:
+ __metaclass__ = PoolMeta
+ __name__ = 'purchase.line'
+
+ work = fields.Many2One('project.work', 'Work Effort', select=True,
+ domain=[
+ ('company', '=', Eval('_parent_purchase', {}).get('company', -1)),
+ ])
diff --git a/purchase.xml b/purchase.xml
new file mode 100644
index 0000000..fb6612f
--- /dev/null
+++ b/purchase.xml
@@ -0,0 +1,12 @@
+<?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 depends="purchase">
+ <record model="ir.ui.view" id="purchase_line_view_form">
+ <field name="model">purchase.line</field>
+ <field name="inherit" ref="purchase.purchase_line_view_form"/>
+ <field name="name">purchase_line_form</field>
+ </record>
+ </data>
+</tryton>
diff --git a/setup.py b/setup.py
index 5da1c70..9592760 100644
--- a/setup.py
+++ b/setup.py
@@ -41,7 +41,7 @@ if minor_version % 2:
'hg+http://hg.tryton.org/modules/%s#egg=%s-%s' % (
name[8:], name, version))
-requires = []
+requires = ['python-sql']
for dep in info.get('depends', []):
if not re.match(r'(ir|res|webdav)(\W|$)', dep):
requires.append(get_require_version('trytond_%s' % dep))
@@ -81,6 +81,9 @@ setup(name=name,
'Natural Language :: English',
'Natural Language :: French',
'Natural Language :: German',
+ 'Natural Language :: Hungarian',
+ 'Natural Language :: Italian',
+ 'Natural Language :: Portuguese (Brazilian)',
'Natural Language :: Russian',
'Natural Language :: Slovenian',
'Natural Language :: Spanish',
diff --git a/tryton.cfg b/tryton.cfg
index 30ea087..5bbde70 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
[tryton]
-version=3.6.0
+version=3.8.0
depends:
ir
project
@@ -7,5 +7,8 @@ depends:
timesheet_cost
company
product
+extras_depend:
+ purchase
xml:
work.xml
+ purchase.xml
diff --git a/trytond_project_revenue.egg-info/PKG-INFO b/trytond_project_revenue.egg-info/PKG-INFO
index 3f36851..4708be3 100644
--- a/trytond_project_revenue.egg-info/PKG-INFO
+++ b/trytond_project_revenue.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-project-revenue
-Version: 3.6.0
+Version: 3.8.0
Summary: Tryton module to add revenue on project
Home-page: http://www.tryton.org/
Author: Tryton
Author-email: issue_tracker at tryton.org
License: GPL-3
-Download-URL: http://downloads.tryton.org/3.6/
+Download-URL: http://downloads.tryton.org/3.8/
Description: trytond_project_revenue
=======================
@@ -60,6 +60,9 @@ Classifier: Natural Language :: Dutch
Classifier: Natural Language :: English
Classifier: Natural Language :: French
Classifier: Natural Language :: German
+Classifier: Natural Language :: Hungarian
+Classifier: Natural Language :: Italian
+Classifier: Natural Language :: Portuguese (Brazilian)
Classifier: Natural Language :: Russian
Classifier: Natural Language :: Slovenian
Classifier: Natural Language :: Spanish
diff --git a/trytond_project_revenue.egg-info/SOURCES.txt b/trytond_project_revenue.egg-info/SOURCES.txt
index 349dfa7..c79505f 100644
--- a/trytond_project_revenue.egg-info/SOURCES.txt
+++ b/trytond_project_revenue.egg-info/SOURCES.txt
@@ -4,10 +4,13 @@ INSTALL
LICENSE
MANIFEST.in
README
+purchase.xml
setup.py
tryton.cfg
work.xml
./__init__.py
+./purchase.py
+./purchase.xml
./tryton.cfg
./work.py
./work.xml
@@ -19,14 +22,23 @@ work.xml
./locale/es_CO.po
./locale/es_EC.po
./locale/es_ES.po
+./locale/es_MX.po
./locale/fr_FR.po
+./locale/hu_HU.po
+./locale/it_IT.po
+./locale/ja_JP.po
+./locale/lt_LT.po
./locale/nl_NL.po
+./locale/pt_BR.po
./locale/ru_RU.po
./locale/sl_SI.po
./tests/__init__.py
./tests/test_project_revenue.py
+./view/purchase_line_form.xml
./view/work_form.xml
-./view/work_list2.xml
+./view/work_form_purchase.xml
+./view/work_list.xml
+./view/work_list_children.xml
./view/work_tree.xml
locale/bg_BG.po
locale/ca_ES.po
@@ -36,8 +48,14 @@ locale/es_AR.po
locale/es_CO.po
locale/es_EC.po
locale/es_ES.po
+locale/es_MX.po
locale/fr_FR.po
+locale/hu_HU.po
+locale/it_IT.po
+locale/ja_JP.po
+locale/lt_LT.po
locale/nl_NL.po
+locale/pt_BR.po
locale/ru_RU.po
locale/sl_SI.po
trytond_project_revenue.egg-info/PKG-INFO
@@ -47,6 +65,9 @@ trytond_project_revenue.egg-info/entry_points.txt
trytond_project_revenue.egg-info/not-zip-safe
trytond_project_revenue.egg-info/requires.txt
trytond_project_revenue.egg-info/top_level.txt
+view/purchase_line_form.xml
view/work_form.xml
-view/work_list2.xml
+view/work_form_purchase.xml
+view/work_list.xml
+view/work_list_children.xml
view/work_tree.xml
\ No newline at end of file
diff --git a/trytond_project_revenue.egg-info/requires.txt b/trytond_project_revenue.egg-info/requires.txt
index d488472..9228461 100644
--- a/trytond_project_revenue.egg-info/requires.txt
+++ b/trytond_project_revenue.egg-info/requires.txt
@@ -1,6 +1,7 @@
-trytond_project >= 3.6, < 3.7
-trytond_timesheet >= 3.6, < 3.7
-trytond_timesheet_cost >= 3.6, < 3.7
-trytond_company >= 3.6, < 3.7
-trytond_product >= 3.6, < 3.7
-trytond >= 3.6, < 3.7
\ No newline at end of file
+python-sql
+trytond_project >= 3.8, < 3.9
+trytond_timesheet >= 3.8, < 3.9
+trytond_timesheet_cost >= 3.8, < 3.9
+trytond_company >= 3.8, < 3.9
+trytond_product >= 3.8, < 3.9
+trytond >= 3.8, < 3.9
\ No newline at end of file
diff --git a/view/work_list2.xml b/view/purchase_line_form.xml
similarity index 53%
copy from view/work_list2.xml
copy to view/purchase_line_form.xml
index 33ec82f..c539d19 100644
--- a/view/work_list2.xml
+++ b/view/purchase_line_form.xml
@@ -2,9 +2,10 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
- <xpath expr="/tree/field[@name='total_effort']" position="after">
- <field name="product"/>
- <field name="list_price"/>
- <field name="cost"/>
+ <xpath
+ expr="/form/notebook/page[@id='general']/field[@name='delivery_date']"
+ position="after">
+ <label name="work"/>
+ <field name="work"/>
</xpath>
</data>
diff --git a/view/work_form.xml b/view/work_form.xml
index 3872ca0..b261803 100644
--- a/view/work_form.xml
+++ b/view/work_form.xml
@@ -2,8 +2,8 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
- <xpath expr="/form/notebook/page[@id='general']/field[@name='effort_duration']"
- position="after">
+ <xpath expr="/form/notebook/page[@id='general']/label[@name='timesheet_duration']"
+ position="before">
<label name="product"/>
<field name="product"/>
<label name="list_price"/>
diff --git a/view/work_list2.xml b/view/work_form_purchase.xml
similarity index 51%
copy from view/work_list2.xml
copy to view/work_form_purchase.xml
index 33ec82f..1778935 100644
--- a/view/work_list2.xml
+++ b/view/work_form_purchase.xml
@@ -2,9 +2,9 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<data>
- <xpath expr="/tree/field[@name='total_effort']" position="after">
- <field name="product"/>
- <field name="list_price"/>
- <field name="cost"/>
+ <xpath expr="/form/notebook" position="inside">
+ <page string="Purchases" id="purchase">
+ <field name="purchase_lines" colspan="4" widget="many2many"/>
+ </page>
</xpath>
</data>
diff --git a/view/work_list2.xml b/view/work_list.xml
similarity index 91%
copy from view/work_list2.xml
copy to view/work_list.xml
index 33ec82f..ee7972a 100644
--- a/view/work_list2.xml
+++ b/view/work_list.xml
@@ -5,6 +5,7 @@ this repository contains the full copyright notices and license terms. -->
<xpath expr="/tree/field[@name='total_effort']" position="after">
<field name="product"/>
<field name="list_price"/>
+ <field name="revenue"/>
<field name="cost"/>
</xpath>
</data>
diff --git a/view/work_list2.xml b/view/work_list_children.xml
similarity index 100%
rename from view/work_list2.xml
rename to view/work_list_children.xml
diff --git a/work.py b/work.py
index bd050a8..7cac750 100644
--- a/work.py
+++ b/work.py
@@ -1,7 +1,10 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from decimal import Decimal
-import datetime
+from collections import defaultdict
+
+from sql.aggregate import Sum
+from sql.operators import Concat
from trytond.model import fields
from trytond.pyson import Eval, Id
@@ -9,6 +12,8 @@ from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
from trytond.tools import reduce_ids, grouped_slice
+from trytond.modules.product import price_digits
+
__all__ = ['Work']
__metaclass__ = PoolMeta
@@ -19,86 +24,139 @@ class Work:
domain=[
('type', '=', 'service'),
('default_uom_category', '=', Id('product', 'uom_cat_time')),
- ],
- states={
- 'invisible': ~Eval('timesheet_available'),
- },
- depends=['timesheet_available'])
- list_price = fields.Numeric('List Price',
- digits=(16, Eval('currency_digits', 2)), depends=['currency_digits'])
+ ])
+ list_price = fields.Numeric('List Price', digits=price_digits)
revenue = fields.Function(fields.Numeric('Revenue',
digits=(16, Eval('currency_digits', 2)),
- depends=['currency_digits']), 'get_revenue')
+ depends=['currency_digits']), 'get_total')
cost = fields.Function(fields.Numeric('Cost',
- states={
- 'invisible': ~Eval('timesheet_available'),
- },
digits=(16, Eval('currency_digits', 2)),
- depends=['currency_digits', 'timesheet_available']), 'get_cost')
+ depends=['currency_digits']), 'get_total')
currency_digits = fields.Function(fields.Integer('Currency Digits'),
'on_change_with_currency_digits')
@classmethod
- def get_cost(cls, works, name):
+ def __setup__(cls):
+ pool = Pool()
+
+ super(Work, cls).__setup__()
+
+ try:
+ pool.get('purchase.line')
+ except KeyError:
+ pass
+ else:
+ # Add purchase lines if purchase is installed
+ cls.purchase_lines = fields.One2Many('purchase.line', 'work',
+ 'Purchase Lines', domain=[
+ ('purchase.company', '=', Eval('company', -1)),
+ ],
+ depends=['company'])
+
+ @classmethod
+ def _get_cost(cls, works):
pool = Pool()
- Employee = pool.get('company.employee')
Line = pool.get('timesheet.line')
Work = pool.get('timesheet.work')
transaction = Transaction()
cursor = transaction.cursor
- works += cls.search([
- ('parent', 'child_of', [w.id for w in works]),
- ('active', '=', True)]) + works
costs = dict.fromkeys([w.id for w in works], 0)
- works_to_timesheet = dict((w.work.id, w.id) for w in works)
- table_w = Work.__table__()
- table_c = Work.__table__()
+ table = cls.__table__()
+ work = Work.__table__()
line = Line.__table__()
- timesheet_work_ids = works_to_timesheet.keys()
- employee_ids = set()
- for sub_ids in grouped_slice(timesheet_work_ids):
- red_sql = reduce_ids(table_w.id, sub_ids)
- cursor.execute(*table_w.join(table_c,
- condition=(table_c.left >= table_w.left)
- & (table_c.right <= table_w.right)
- ).join(line, condition=line.work == table_c.id
- ).select(line.employee,
+ # Timesheet cost
+ work_ids = [w.id for w in works]
+ for sub_ids in grouped_slice(work_ids):
+ red_sql = reduce_ids(table.id, sub_ids)
+ cursor.execute(*table.join(work,
+ condition=table.work == work.id
+ ).join(line, condition=line.work == work.id
+ ).select(table.id, Sum(line.cost_price * line.duration),
where=red_sql,
- group_by=line.employee))
- employee_ids |= set(r[0] for r in cursor.fetchall())
- for employee in Employee.browse(list(employee_ids)):
- employee_costs = employee.get_employee_costs()
- to_date = None
- for from_date, cost in reversed(employee_costs):
- with transaction.set_context(
- from_date=from_date,
- to_date=to_date,
- employees=[employee.id]):
- for timesheet_work in Work.browse(timesheet_work_ids):
- work_id = works_to_timesheet[timesheet_work.id]
- costs[work_id] += (
- Decimal(str(timesheet_work.hours)) * cost)
- to_date = from_date - datetime.timedelta(1)
+ group_by=[table.id]))
+ for work_id, cost in cursor.fetchall():
+ # SQLite stores timedelta as float
+ if not isinstance(cost, float):
+ cost = cost.total_seconds()
+ # Convert from seconds
+ cost /= 60 * 60
+ costs[work_id] += Decimal(str(cost))
+
+ # Purchase cost
+ if hasattr(cls, 'purchase_lines'):
+ for work_id, cost in cls._purchase_cost(works).iteritems():
+ costs[work_id] += cost
+
for work in works:
costs[work.id] = work.company.currency.round(costs[work.id])
return costs
@classmethod
- def get_revenue(cls, works, name):
- works = cls.search([
- ('parent', 'child_of', [w.id for w in works]),
- ('active', '=', True)]) + works
-
- def getter(work):
- if work.list_price:
- return work.list_price * Decimal(str(work.effort_hours))
+ def _purchase_cost(cls, works):
+ 'Compute direct purchase cost'
+ pool = Pool()
+ Currency = pool.get('currency.currency')
+ PurchaseLine = pool.get('purchase.line')
+ InvoiceLine = pool.get('account.invoice.line')
+ Invoice = pool.get('account.invoice')
+ Company = pool.get('company.company')
+
+ cursor = Transaction().cursor
+ table = cls.__table__()
+ purchase_line = PurchaseLine.__table__()
+ invoice_line = InvoiceLine.__table__()
+ invoice = Invoice.__table__()
+ company = Company.__table__()
+
+ amounts = defaultdict(Decimal)
+ work_ids = [w.id for w in works]
+ work2currency = {}
+ iline2work = {}
+ for sub_ids in grouped_slice(work_ids):
+ where = reduce_ids(table.id, sub_ids)
+ cursor.execute(*table.join(purchase_line,
+ condition=purchase_line.work == table.id
+ ).join(invoice_line,
+ condition=invoice_line.origin == Concat(
+ 'purchase.line,', purchase_line.id)
+ ).join(invoice,
+ condition=invoice_line.invoice == invoice.id
+ ).select(invoice_line.id, table.id,
+ where=where & ~invoice.state.in_(['draft', 'cancel'])))
+ iline2work.update(cursor.fetchall())
+
+ cursor.execute(*table.join(company,
+ condition=table.company == company.id
+ ).select(table.id, company.currency,
+ where=where))
+ work2currency.update(cursor.fetchall())
+
+ currencies = Currency.browse(set(work2currency.itervalues()))
+ id2currency = {c.id: c for c in currencies}
+
+ invoice_lines = InvoiceLine.browse(iline2work.keys())
+ for invoice_line in invoice_lines:
+ invoice = invoice_line.invoice
+ work_id = iline2work[invoice_line.id]
+ currency_id = work2currency[work_id]
+ currency = id2currency[currency_id]
+ if currency != invoice.currency:
+ with Transaction().set_context(date=invoice.currency_date):
+ amount = Currency.compute(invoice.currency,
+ invoice_line.amount, currency)
else:
- return Decimal(0)
+ amount = invoice_line.amount
+ amounts[work_id] += amount
+ return amounts
- return cls.sum_tree(works, getter)
+ @classmethod
+ def _get_revenue(cls, works):
+ return {w.id: (w.list_price * Decimal(str(w.effort_hours))
+ if w.list_price else Decimal(0))
+ for w in works}
@fields.depends('company')
def on_change_with_currency_digits(self, name=None):
@@ -115,7 +173,7 @@ class Work:
return company.currency.digits
return 2
- @fields.depends('product', 'party', 'company')
+ @fields.depends('product', 'company')
def on_change_product(self):
pool = Pool()
User = pool.get('res.user')
@@ -126,20 +184,17 @@ class Work:
if not self.product:
return
- context = {}
-
- if self.party:
- context['customer'] = self.party.id
-
hour_uom = Uom(ModelData.get_id('product', 'uom_hour'))
-
- with Transaction().set_context(context):
- self.list_price = Uom.compute_price(self.product.default_uom,
- self.product.list_price, hour_uom)
+ self.list_price = Uom.compute_price(self.product.default_uom,
+ self.product.list_price, hour_uom)
if self.company:
user = User(Transaction().user)
if user.company != self.company:
if user.company.currency != self.company.currency:
self.list_price = Currency.compute(user.company.currency,
- self.list_price, self.company.currency)
+ self.list_price, self.company.currency, round=False)
+
+ digits = self.__class__.list_price.digits
+ self.list_price = self.list_price.quantize(
+ Decimal(str(10.0 ** -digits[1])))
diff --git a/work.xml b/work.xml
index 17fbdbe..413c34c 100644
--- a/work.xml
+++ b/work.xml
@@ -16,10 +16,25 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">work_tree</field>
</record>
- <record model="ir.ui.view" id="work_view_list2">
+ <record model="ir.ui.view" id="work_view_list">
<field name="model">project.work</field>
- <field name="inherit" ref="project.work_view_list2"/>
- <field name="name">work_list2</field>
+ <field name="inherit" ref="project.work_view_list"/>
+ <field name="name">work_list</field>
+ </record>
+
+ <record model="ir.ui.view" id="work_view_list_children">
+ <field name="model">project.work</field>
+ <field name="inherit" ref="project.work_view_list_children"/>
+ <field name="name">work_list_children</field>
+ </record>
+
+ </data>
+ <data depends="purchase">
+
+ <record model="ir.ui.view" id="work_view_form_purchase">
+ <field name="model">project.work</field>
+ <field name="inherit" ref="project.work_view_form"/>
+ <field name="name">work_form_purchase</field>
</record>
</data>
--
tryton-modules-project-revenue
More information about the tryton-debian-vcs
mailing list