[tryton-debian-vcs] tryton-modules-timesheet-cost branch upstream updated. upstream/3.6.0-1-gf531582
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Wed Nov 11 11:30:57 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-timesheet-cost.git;a=commitdiff;h=upstream/3.6.0-1-gf531582
commit f531582494b5a76d264e1febead695ff98691e02
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed Nov 11 12:11:21 2015 +0100
Adding upstream version 3.8.0.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index 1b06dc3..d03aa50 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+Version 3.8.0 - 2015-11-02
+* Bug fixes (see mercurial logs for details)
+* Store cost price on timesheet line
+
Version 3.6.0 - 2015-04-20
* Bug fixes (see mercurial logs for details)
* Add support for PyPy
@@ -8,4 +12,4 @@ Version 3.2.0 - 2014-04-21
* Bug fixes (see mercurial logs for details)
Version 3.0.0 - 2013-10-21
-* Initial release
\ No newline at end of file
+* Initial release
diff --git a/INSTALL b/INSTALL
index dfd0a5a..87ed3d7 100644
--- a/INSTALL
+++ b/INSTALL
@@ -5,8 +5,10 @@ Prerequisites
-------------
* Python 2.7 or later (http://www.python.org/)
+ * python-sql 0.4 or later (http://pypi.python.org/pypi/python-sql)
* trytond (http://www.tryton.org/)
* trytond_timesheet (http://www.tryton.org/)
+ * trytond_party (http://www.tryton.org/)
* trytond_company (http://www.tryton.org/)
Installation
diff --git a/PKG-INFO b/PKG-INFO
index 356543d..6e743f0 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond_timesheet_cost
-Version: 3.6.0
+Version: 3.8.0
Summary: Tryton module to add cost on timesheet
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_timesheet_cost
======================
@@ -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/company.py b/company.py
index 66b3940..0f6fbd6 100644
--- a/company.py
+++ b/company.py
@@ -1,26 +1,27 @@
# 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
-from trytond.model import ModelView, ModelSQL, fields
-from trytond.pyson import Eval
+from trytond.model import ModelView, ModelSQL, fields, Unique
from trytond.cache import Cache
from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
from trytond import backend
+from trytond.config import config
-__all__ = ['Employee', 'EmployeeCostPrice']
+__all__ = ['Employee', 'EmployeeCostPrice', 'price_digits']
__metaclass__ = PoolMeta
+price_digits = (16, config.getint(
+ 'timesheet_cost', 'price_decimal', default=4))
+
class Employee:
__name__ = 'company.employee'
cost_price = fields.Function(fields.Numeric('Cost Price',
- digits=(16, Eval('currency_digits', 2)), depends=['currency_digits'],
- help="Hourly cost price for this Employee"), 'get_cost_price')
+ digits=price_digits,
+ help="Hourly cost price for this Employee"), 'get_cost_price')
cost_prices = fields.One2Many('company.employee_cost_price', 'employee',
'Cost Prices', help="List of hourly cost price over time")
- currency_digits = fields.Function(fields.Integer('Currency Digits'),
- 'on_change_with_currency_digits')
_cost_prices_cache = Cache('company_employee.cost_prices')
def get_cost_price(self, name):
@@ -68,21 +69,6 @@ class Employee:
break
return cost
- @fields.depends('company')
- def on_change_with_currency_digits(self, name=None):
- if self.company:
- return self.company.currency.digits
- return 2
-
- @staticmethod
- def default_currency_digits():
- Company = Pool().get('company.company')
- company = Transaction().context.get('company')
- if company:
- company = Company(company)
- return company.currency.digits
- return 2
-
class EmployeeCostPrice(ModelSQL, ModelView):
'Employee Cost Price'
@@ -90,12 +76,8 @@ class EmployeeCostPrice(ModelSQL, ModelView):
_rec_name = 'date'
date = fields.Date('Date', required=True, select=True)
cost_price = fields.Numeric('Cost Price',
- digits=(16, Eval('currency_digits', 2)),
- required=True, depends=['currency_digits'],
- help="Hourly cost price")
+ digits=price_digits, required=True, help="Hourly cost price")
employee = fields.Many2One('company.employee', 'Employee')
- currency_digits = fields.Function(fields.Integer('Currency Digits'),
- 'on_change_with_currency_digits')
@classmethod
def __register__(cls, module_name):
@@ -110,9 +92,10 @@ class EmployeeCostPrice(ModelSQL, ModelView):
@classmethod
def __setup__(cls):
super(EmployeeCostPrice, cls).__setup__()
+ t = cls.__table__()
cls._sql_constraints = [
('employee_date_cost_price_uniq',
- 'UNIQUE(employee, date, cost_price)',
+ Unique(t, t.employee, t.date, t.cost_price),
'A employee can only have one cost price by date.'),
]
cls._order.insert(0, ('date', 'DESC'))
@@ -144,18 +127,3 @@ class EmployeeCostPrice(ModelSQL, ModelView):
Employee = Pool().get('company.employee')
super(EmployeeCostPrice, cls).write(*args)
Employee._cost_prices_cache.clear()
-
- @fields.depends('employee')
- def on_change_with_currency_digits(self, name=None):
- if self.employee:
- return self.employee.company.currency.digits
- return 2
-
- @staticmethod
- def default_currency_digits():
- Company = Pool().get('company.company')
- company = Transaction().context.get('company')
- if company:
- company = Company(company)
- return company.currency.digits
- return 2
diff --git a/company.xml b/company.xml
index 1c3fdbf..a5ded29 100644
--- a/company.xml
+++ b/company.xml
@@ -20,5 +20,38 @@ this repository contains the full copyright notices and license terms. -->
<field name="inherit" ref="company.employee_view_form"/>
<field name="name">employee_form</field>
</record>
+
+ <record model="ir.model.access" id="access_employee_cost_price">
+ <field name="model"
+ search="[('model', '=', 'company.employee_cost_price')]"/>
+ <field name="perm_read" eval="False"/>
+ <field name="perm_write" eval="False"/>
+ <field name="perm_create" eval="False"/>
+ <field name="perm_delete" eval="False"/>
+ </record>
+ <record model="ir.model.access" id="access_employee_cost_price_admin">
+ <field name="model"
+ search="[('model', '=', 'company.employee_cost_price')]"/>
+ <field name="group" ref="party.group_party_admin"/>
+ <field name="perm_read" eval="True"/>
+ <field name="perm_write" eval="True"/>
+ <field name="perm_create" eval="True"/>
+ <field name="perm_delete" eval="True"/>
+ </record>
+ <record model="ir.model.field.access"
+ id="model_field_access_employee_cost_price">
+ <field name="field"
+ search="[('model.model', '=', 'company.employee'), ('name', '=', 'cost_price')]"/>
+ <field name="perm_read" eval="False"/>
+ <field name="perm_write" eval="False"/>
+ </record>
+ <record model="ir.model.field.access"
+ id="model_field_access_employee_cost_price_admin">
+ <field name="field"
+ search="[('model.model', '=', 'company.employee'), ('name', '=', 'cost_price')]"/>
+ <field name="group" ref="party.group_party_admin"/>
+ <field name="perm_read" eval="True"/>
+ <field name="perm_write" eval="True"/>
+ </record>
</data>
</tryton>
diff --git a/locale/bg_BG.po b/locale/bg_BG.po
index 0518b1b..d062fa0 100644
--- a/locale/bg_BG.po
+++ b/locale/bg_BG.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Себестойност"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Цифри за валута"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Фабрична цена"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Създадено от"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Цифри за валута"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Дата"
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Променено от"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Себестойност за час за този служител"
diff --git a/locale/ca_ES.po b/locale/ca_ES.po
index 5afc02e..932ca1a 100644
--- a/locale/ca_ES.po
+++ b/locale/ca_ES.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Preus de cost"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimals de la moneda"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Preu de cost"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Usuari creació"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimals de la moneda"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Data"
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Usuari modificació"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Preu de cost per hora per a aquest empleat."
diff --git a/locale/cs_CZ.po b/locale/cs_CZ.po
index 281f035..9d878ca 100644
--- a/locale/cs_CZ.po
+++ b/locale/cs_CZ.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr ""
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr ""
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr ""
diff --git a/locale/de_DE.po b/locale/de_DE.po
index e86c29b..22e56e5 100644
--- a/locale/de_DE.po
+++ b/locale/de_DE.po
@@ -16,10 +16,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Kostenpreise"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Nachkommastellen Währung"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Kostenpreis"
@@ -32,10 +28,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Erstellt durch"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Nachkommastellen Währung"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Datum"
@@ -60,6 +52,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Letzte Änderung durch"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr "Kostenpreis"
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Kostenpreis pro Stunde für diesen Mitarbeiter"
diff --git a/locale/es_AR.po b/locale/es_AR.po
index 829c82a..69508ff 100644
--- a/locale/es_AR.po
+++ b/locale/es_AR.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Precios de costo"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de moneda"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Precio de costo"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Usuario creación"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de moneda"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Fecha"
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Precio de costo por hora para este empleado"
diff --git a/locale/es_CO.po b/locale/es_CO.po
index 28f7641..7a9e3bb 100644
--- a/locale/es_CO.po
+++ b/locale/es_CO.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Costos"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de Moneda"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Costo"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Creado por Usuario"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de Moneda"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Fecha"
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Modificado por Usuario"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Costo por hora del empleado"
diff --git a/locale/es_EC.po b/locale/es_EC.po
index c0b26ba..86d1cac 100644
--- a/locale/es_EC.po
+++ b/locale/es_EC.po
@@ -4,35 +4,27 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:company.employee_cost_price:"
msgid "A employee can only have one cost price by date."
-msgstr "Un empleado sólo puede disponer de un precio de costo por fecha."
+msgstr "Un empleado sólo puede tener un precio de costo por fecha."
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
-msgstr "Precio de Costo"
+msgstr "Precio de costo"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
-msgstr "Precios de Costo"
-
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de Moneda"
+msgstr "Precios de costo"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
-msgstr "Precio de Costo"
+msgstr "Precio de costo"
msgctxt "field:company.employee_cost_price,create_date:"
msgid "Create Date"
-msgstr "Fecha de Creación"
+msgstr "Fecha de creación"
msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
-msgstr "Creado por Usuario"
-
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de Moneda"
+msgstr "Creado por usuario"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
@@ -52,11 +44,15 @@ msgstr "Nombre"
msgctxt "field:company.employee_cost_price,write_date:"
msgid "Write Date"
-msgstr "Fecha de Modificación"
+msgstr "Fecha de modificación"
msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
-msgstr "Modificado por Usuario"
+msgstr "Modificado por usuario"
+
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
@@ -72,7 +68,7 @@ msgstr "Precio de costo por hora"
msgctxt "model:company.employee_cost_price,name:"
msgid "Employee Cost Price"
-msgstr "Precio de Costo del Empleado"
+msgstr "Precio de costo del empleado"
msgctxt "view:company.employee:"
msgid "Cost"
@@ -80,4 +76,4 @@ msgstr "Costo"
msgctxt "view:company.employee_cost_price:"
msgid "Cost Prices"
-msgstr "Precios de Costo"
+msgstr "Precios de costo"
diff --git a/locale/es_ES.po b/locale/es_ES.po
index 085436b..ae3b1f6 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Precios de coste"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de la moneda"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Precio de coste"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Usuario creación"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de la moneda"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Fecha"
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Precio de coste por hora para este empleado."
diff --git a/locale/es_AR.po b/locale/es_MX.po
similarity index 77%
copy from locale/es_AR.po
copy to locale/es_MX.po
index 829c82a..1955367 100644
--- a/locale/es_AR.po
+++ b/locale/es_MX.po
@@ -4,7 +4,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:company.employee_cost_price:"
msgid "A employee can only have one cost price by date."
-msgstr "Un empleado sólo puede disponer de un precio de costo por fecha."
+msgstr "Un empleado sólo puede disponer de un costo por fecha."
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Precios de costo"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de moneda"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Precio de costo"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Usuario creación"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimales de moneda"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Fecha"
@@ -58,17 +50,21 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Usuario modificación"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
-msgstr "Precio de costo por hora para este empleado"
+msgstr "Precio de costo por hora para este empleado."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time"
-msgstr "Lista de precio de costo por hora a lo largo del tiempo"
+msgstr "Lista de costos por hora a lo largo del tiempo."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price"
-msgstr "Precio de costo por hora"
+msgstr "Precio de costo por hora."
msgctxt "model:company.employee_cost_price,name:"
msgid "Employee Cost Price"
@@ -76,8 +72,8 @@ msgstr "Precio de costo del empleado"
msgctxt "view:company.employee:"
msgid "Cost"
-msgstr "Costo"
+msgstr ""
msgctxt "view:company.employee_cost_price:"
msgid "Cost Prices"
-msgstr "Precios de costo"
+msgstr ""
diff --git a/locale/fr_FR.po b/locale/fr_FR.po
index bdbf1db..979cf73 100644
--- a/locale/fr_FR.po
+++ b/locale/fr_FR.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Prix de revient"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Décimales de la devise"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Prix de revient"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Créé par"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Décimales de la devise"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Date"
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Mis à jour par"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Prix de revient horaire de cet employé"
diff --git a/locale/cs_CZ.po b/locale/hu_HU.po
similarity index 90%
copy from locale/cs_CZ.po
copy to locale/hu_HU.po
index 281f035..9d878ca 100644
--- a/locale/cs_CZ.po
+++ b/locale/hu_HU.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr ""
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr ""
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr ""
diff --git a/locale/cs_CZ.po b/locale/it_IT.po
similarity index 90%
copy from locale/cs_CZ.po
copy to locale/it_IT.po
index 281f035..9d878ca 100644
--- a/locale/cs_CZ.po
+++ b/locale/it_IT.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr ""
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr ""
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr ""
diff --git a/locale/cs_CZ.po b/locale/ja_JP.po
similarity index 90%
copy from locale/cs_CZ.po
copy to locale/ja_JP.po
index 281f035..9d878ca 100644
--- a/locale/cs_CZ.po
+++ b/locale/ja_JP.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr ""
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr ""
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr ""
diff --git a/locale/cs_CZ.po b/locale/lt_LT.po
similarity index 90%
copy from locale/cs_CZ.po
copy to locale/lt_LT.po
index 281f035..9d878ca 100644
--- a/locale/cs_CZ.po
+++ b/locale/lt_LT.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr ""
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr ""
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr ""
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr ""
diff --git a/locale/nl_NL.po b/locale/nl_NL.po
index 3a31540..974f943 100644
--- a/locale/nl_NL.po
+++ b/locale/nl_NL.po
@@ -16,11 +16,6 @@ msgid "Cost Prices"
msgstr ""
#, fuzzy
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Valuta decimalen"
-
-#, fuzzy
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Kostprijs"
@@ -34,11 +29,6 @@ msgid "Create User"
msgstr ""
#, fuzzy
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Valuta decimalen"
-
-#, fuzzy
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Vervaldatum"
@@ -65,6 +55,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr ""
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr ""
diff --git a/locale/sl_SI.po b/locale/pt_BR.po
similarity index 70%
copy from locale/sl_SI.po
copy to locale/pt_BR.po
index 8575ac0..e45187f 100644
--- a/locale/sl_SI.po
+++ b/locale/pt_BR.po
@@ -4,43 +4,35 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "error:company.employee_cost_price:"
msgid "A employee can only have one cost price by date."
-msgstr "Zaposlenec ima lahko samo en strošek na datum."
+msgstr "Um empregado somente pode ter um preço de custo por data."
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
-msgstr "Strošek"
+msgstr "Preço de custo"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
-msgstr "Stroški"
-
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimalke"
+msgstr "Preços de custo"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
-msgstr "Strošek"
+msgstr "Preços de custo"
msgctxt "field:company.employee_cost_price,create_date:"
msgid "Create Date"
-msgstr "Izdelano"
+msgstr "Data de criação"
msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
-msgstr "Izdelal"
-
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimalke"
+msgstr "Criado por"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
-msgstr "Datum"
+msgstr "Data"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
-msgstr "Zaposlenec"
+msgstr "Empregado"
msgctxt "field:company.employee_cost_price,id:"
msgid "ID"
@@ -48,36 +40,40 @@ msgstr "ID"
msgctxt "field:company.employee_cost_price,rec_name:"
msgid "Name"
-msgstr "Ime"
+msgstr "Nome"
msgctxt "field:company.employee_cost_price,write_date:"
msgid "Write Date"
-msgstr "Zapisano"
+msgstr "Data de edição"
msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
-msgstr "Zapisal"
+msgstr "Editado por"
+
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr "Preço de custo"
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
-msgstr "Strošek na uro za tega zaposlenca"
+msgstr "Preço de custo por hora para este empregado."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time"
-msgstr "Seznam stroškov na uro po času"
+msgstr "Lista de preços de custo por hora ao longo do tempo."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price"
-msgstr "Strošek na uro"
+msgstr "Preço de custo por hora"
msgctxt "model:company.employee_cost_price,name:"
msgid "Employee Cost Price"
-msgstr "Strošek zaposlenca"
+msgstr "Preço de custo do empregado"
msgctxt "view:company.employee:"
msgid "Cost"
-msgstr "Strošek"
+msgstr "Custo"
msgctxt "view:company.employee_cost_price:"
msgid "Cost Prices"
-msgstr "Stroški"
+msgstr "Custo"
diff --git a/locale/ru_RU.po b/locale/ru_RU.po
index 60e4ecf..89b80bc 100644
--- a/locale/ru_RU.po
+++ b/locale/ru_RU.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Себестоимость"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Кол-во цифр валюты"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Себестоимость"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Создано пользователем"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Кол-во цифр валюты"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Дата"
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Изменено пользователем"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr ""
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Часовая себестоимость для этого сотрудника"
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
index 8575ac0..6045e4d 100644
--- a/locale/sl_SI.po
+++ b/locale/sl_SI.po
@@ -14,10 +14,6 @@ msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Stroški"
-msgctxt "field:company.employee,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimalke"
-
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Strošek"
@@ -30,10 +26,6 @@ msgctxt "field:company.employee_cost_price,create_uid:"
msgid "Create User"
msgstr "Izdelal"
-msgctxt "field:company.employee_cost_price,currency_digits:"
-msgid "Currency Digits"
-msgstr "Decimalke"
-
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Datum"
@@ -58,6 +50,10 @@ msgctxt "field:company.employee_cost_price,write_uid:"
msgid "Write User"
msgstr "Zapisal"
+msgctxt "field:timesheet.line,cost_price:"
+msgid "Cost Price"
+msgstr "Strošek"
+
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee"
msgstr "Strošek na uro za tega zaposlenca"
diff --git a/setup.py b/setup.py
index 6dca2b3..491a800 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 >= 0.4']
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/timesheet.py b/timesheet.py
index 367da06..0499ab8 100644
--- a/timesheet.py
+++ b/timesheet.py
@@ -1,8 +1,13 @@
# 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
+from sql import Null
+
from trytond.transaction import Transaction
from trytond.pool import Pool, PoolMeta
+from trytond.model import fields
+from trytond import backend
+
+from .company import price_digits
__all__ = ['TimesheetLine']
__metaclass__ = PoolMeta
@@ -11,17 +16,65 @@ __metaclass__ = PoolMeta
class TimesheetLine:
__name__ = 'timesheet.line'
- def compute_cost(self):
- Currency = Pool().get('currency.currency')
+ cost_price = fields.Numeric('Cost Price',
+ digits=price_digits, required=True, readonly=True)
+
+ @classmethod
+ def __register__(cls, module_name):
+ pool = Pool()
+ Employee = pool.get('company.employee')
+ TableHandler = backend.get('TableHandler')
+
+ cursor = Transaction().cursor
+ table = cls.__table__()
+ table_h = TableHandler(cursor, cls, module_name)
+
+ migrate_cost_price = not table_h.column_exist('cost_price')
+
+ super(TimesheetLine, cls).__register__(module_name)
+
+ # Migration from 3.6: add cost_price
+ if migrate_cost_price:
+ cursor.execute(*table.select(table.id, table.employee, table.date,
+ where=(table.cost_price == 0)
+ & (table.employee != Null)
+ & (table.date != Null)))
+ for line_id, employee_id, date in cursor.fetchall():
+ employee = Employee(employee_id)
+ cost_price = employee.compute_cost_price(date=date)
+ cursor.execute(*table.update(
+ [table.cost_price],
+ [cost_price],
+ where=table.id == line_id))
+
+ @classmethod
+ def default_cost_price(cls):
+ # Needed at creation as cost_price is required
+ return 0
- cost_price = self.employee.compute_cost_price(date=self.date)
+ @classmethod
+ def create(cls, vlist):
+ # XXX Remove cost_price because proteus set it as default value
+ vlist = [v.copy() for v in vlist]
+ for values in vlist:
+ values.pop('cost_price', None)
+ lines = super(TimesheetLine, cls).create(vlist)
+ cls.sync_cost(lines)
+ return lines
- line_company = self.employee.company
- work_company = self.work.company
- if (line_company != work_company and
- line_company.currency != work_company.currency):
- with Transaction().set_context(date=self.date):
- cost_price = Currency.compute(line_company.currency,
- cost_price, work_company.currency)
+ @classmethod
+ def write(cls, *args):
+ super(TimesheetLine, cls).write(*args)
+ cls.sync_cost(sum(args[0:None:2], []))
- return Decimal(str(self.hours)) * cost_price
+ @classmethod
+ def sync_cost(cls, lines):
+ with Transaction().set_context(_check_access=False):
+ to_write = []
+ lines = cls.browse(lines)
+ for line in lines:
+ cost_price = line.employee.compute_cost_price(date=line.date)
+ if cost_price != line.cost_price:
+ to_write.extend([[line], {'cost_price': cost_price}])
+ if to_write:
+ cls.write(*to_write)
diff --git a/timesheet.xml b/timesheet.xml
new file mode 100644
index 0000000..c8b33c8
--- /dev/null
+++ b/timesheet.xml
@@ -0,0 +1,22 @@
+<?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>
+ <record model="ir.model.field.access"
+ id="model_field_access_timesheet_cost_price">
+ <field name="field"
+ search="[('model.model', '=', 'timesheet.line'), ('name', '=', 'cost_price')]"/>
+ <field name="perm_read" eval="False"/>
+ <field name="perm_write" eval="False"/>
+ </record>
+ <record model="ir.model.field.access"
+ id="model_field_access_timesheet_cost_price_admin">
+ <field name="field"
+ search="[('model.model', '=', 'timesheet.line'), ('name', '=', 'cost_price')]"/>
+ <field name="group" ref="party.group_party_admin"/>
+ <field name="perm_read" eval="True"/>
+ <field name="perm_write" eval="True"/>
+ </record>
+ </data>
+</tryton>
diff --git a/tryton.cfg b/tryton.cfg
index 7d3e5e1..3b18022 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,8 +1,10 @@
[tryton]
-version=3.6.0
+version=3.8.0
depends:
ir
company
+ party
timesheet
xml:
company.xml
+ timesheet.xml
diff --git a/trytond_timesheet_cost.egg-info/PKG-INFO b/trytond_timesheet_cost.egg-info/PKG-INFO
index d161f7a..ff07695 100644
--- a/trytond_timesheet_cost.egg-info/PKG-INFO
+++ b/trytond_timesheet_cost.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
Metadata-Version: 1.1
Name: trytond-timesheet-cost
-Version: 3.6.0
+Version: 3.8.0
Summary: Tryton module to add cost on timesheet
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_timesheet_cost
======================
@@ -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_timesheet_cost.egg-info/SOURCES.txt b/trytond_timesheet_cost.egg-info/SOURCES.txt
index ae744f7..347f93f 100644
--- a/trytond_timesheet_cost.egg-info/SOURCES.txt
+++ b/trytond_timesheet_cost.egg-info/SOURCES.txt
@@ -6,11 +6,13 @@ MANIFEST.in
README
company.xml
setup.py
+timesheet.xml
tryton.cfg
./__init__.py
./company.py
./company.xml
./timesheet.py
+./timesheet.xml
./tryton.cfg
./locale/bg_BG.po
./locale/ca_ES.po
@@ -20,8 +22,14 @@ tryton.cfg
./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
@@ -37,8 +45,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_timesheet_cost.egg-info/PKG-INFO
diff --git a/trytond_timesheet_cost.egg-info/requires.txt b/trytond_timesheet_cost.egg-info/requires.txt
index a192133..e99a811 100644
--- a/trytond_timesheet_cost.egg-info/requires.txt
+++ b/trytond_timesheet_cost.egg-info/requires.txt
@@ -1,3 +1,5 @@
-trytond_company >= 3.6, < 3.7
-trytond_timesheet >= 3.6, < 3.7
-trytond >= 3.6, < 3.7
\ No newline at end of file
+python-sql >= 0.4
+trytond_company >= 3.8, < 3.9
+trytond_party >= 3.8, < 3.9
+trytond_timesheet >= 3.8, < 3.9
+trytond >= 3.8, < 3.9
\ No newline at end of file
--
tryton-modules-timesheet-cost
More information about the tryton-debian-vcs
mailing list