first commit

This commit is contained in:
root
2026-03-14 09:42:12 +00:00
commit 0adbd20c2c
10991 changed files with 1646955 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

View File

@@ -0,0 +1,113 @@
# 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 trytond.config as config
from trytond.cache import Cache
from trytond.model import Index, ModelSQL, ModelView, Unique, fields
from trytond.pool import Pool, PoolMeta
from trytond.transaction import Transaction
__all__ = ['price_digits']
price_digits = (16, config.getint(
'timesheet_cost', 'price_decimal', default=4))
class Employee(metaclass=PoolMeta):
__name__ = 'company.employee'
cost_price = fields.Function(fields.Numeric('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.")
_cost_prices_cache = Cache('company_employee.cost_prices')
def get_cost_price(self, name):
'''
Return the cost price at the date given in the context or the
current date
'''
ctx_date = Transaction().context.get('date', None)
return self.compute_cost_price(ctx_date)
def get_employee_costs(self):
"Return a sorted list by date of start date and cost_price"
pool = Pool()
CostPrice = pool.get('company.employee_cost_price')
# Get from cache employee costs or fetch them from the db
employee_costs = self._cost_prices_cache.get(self.id)
if employee_costs is None:
cost_prices = CostPrice.search([
('employee', '=', self.id),
], order=[('date', 'ASC')])
employee_costs = []
for cost_price in cost_prices:
employee_costs.append(
(cost_price.date, cost_price.cost_price))
self._cost_prices_cache.set(self.id, employee_costs)
return employee_costs
def compute_cost_price(self, date=None):
"Return the cost price at the given date"
pool = Pool()
Date = pool.get('ir.date')
employee_costs = self.get_employee_costs()
if date is None:
with Transaction().set_context(company=self.company.id):
date = Date.today()
# compute the cost price for the given date
cost = 0
if employee_costs and date >= employee_costs[0][0]:
for edate, ecost in employee_costs:
if date >= edate:
cost = ecost
else:
break
return cost
class EmployeeCostPrice(ModelSQL, ModelView):
__name__ = 'company.employee_cost_price'
date = fields.Date("Date", required=True)
cost_price = fields.Numeric('Cost Price',
digits=price_digits, required=True, help="Hourly cost price.")
employee = fields.Many2One('company.employee', 'Employee')
@classmethod
def __setup__(cls):
super().__setup__()
t = cls.__table__()
cls._sql_constraints = [
('employee_date_cost_price_uniq',
Unique(t, t.employee, t.date, t.cost_price),
'timesheet_cost.msg_employee_unique_cost_price_date'),
]
cls._sql_indexes.add(
Index(
t,
(t.employee, Index.Range()),
(t.date, Index.Range(order='ASC'))))
cls._order.insert(0, ('date', 'DESC'))
@staticmethod
def default_cost_price():
return Decimal(0)
@staticmethod
def default_date():
Date = Pool().get('ir.date')
return Date.today()
def get_rec_name(self, name):
return Pool().get('ir.lang').get().strftime(self.date)
@classmethod
def on_modification(cls, mode, prices, field_names=None):
pool = Pool()
Employee = pool.get('company.employee')
super().on_modification(mode, prices, field_names=field_names)
Employee._cost_prices_cache.clear()

View File

@@ -0,0 +1,55 @@
<?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.ui.view" id="cost_price_view_form">
<field name="model">company.employee_cost_price</field>
<field name="type">form</field>
<field name="name">employee_cost_price_form</field>
</record>
<record model="ir.ui.view" id="cost_price_view_tree">
<field name="model">company.employee_cost_price</field>
<field name="type">tree</field>
<field name="name">employee_cost_price_tree</field>
</record>
<record model="ir.ui.view" id="employee_view_form">
<field name="model">company.employee</field>
<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">company.employee_cost_price</field>
<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">company.employee_cost_price</field>
<field name="group" ref="company.group_employee_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="model">company.employee</field>
<field name="field">cost_price</field>
<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="model">company.employee</field>
<field name="field">cost_price</field>
<field name="group" ref="company.group_employee_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,55 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Фабрична цена"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Себестойност"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Фабрична цена"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Дата"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Служител"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Фабрична цена"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Себестойност за час за този служител"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Списък на себестойност за час през времето"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Себестойност за час"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Себестойност на клиент"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Разход"

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Preu de cost"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Preus de cost"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Preu de cost"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Data"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Empleat"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Preu de cost"
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Preu de cost per hora per a aquest empleat."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Llista de preus de cost per hora a través del temps."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Preu de cost per hora."
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Preu de cost de l'empleat"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Un empleat només pot tenir un preu de cost per data."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Cost"

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
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 ""
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr ""
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr ""
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr ""
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr ""

View File

@@ -0,0 +1,53 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Einstandspreis"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Einstandspreise"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Einstandspreis"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Datum"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Mitarbeiter"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Einstandspreis"
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Einstandspreis pro Stunde für diesen Mitarbeiter."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Entwicklung des Einstandspreises pro Stunde."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Einstandspreis pro Stunde."
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Mitarbeiter Einstandspreis"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
"Es kann nur ein Einstandspreis pro Datum für einen Mitarbeiter eingetragen "
"werden."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Kosten"

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Precio de coste"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Precios de coste"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Precio de coste"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Fecha"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Empleado"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Precio de coste"
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Precio de coste por hora para este empleado."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Lista de precios de coste por hora a lo largo del tiempo."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Precio de coste por hora."
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Precio de coste del empleado"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Un empleado sólo puede tener un precio de coste por fecha."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Coste"

View File

@@ -0,0 +1,55 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Precio de costo"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Precios de costo"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Precio de costo"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr ""
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Precio de costo"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Precio de costo por hora para este empleado"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Lista de precio de costo por hora de tiempo extra"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Precio de costo por hora"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Precio de costo del empleado"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Costo"

View File

@@ -0,0 +1,55 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Ostuhind"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Ostuhinnad"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Ostuhind"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Kuupäev"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Töötaja"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Ostuhind"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Töötaja tunnitasu"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Tunnitasu ületunni hind"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Tunnitasu"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Töötaja tasu"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Töötajal saab olla ainult üks tasu kuupäeva kohta"
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Kulu"

View File

@@ -0,0 +1,55 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "مبلغ هزینه"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "مبالغ هزینه"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "مبلغ هزینه"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "تاریخ"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "کارمند"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "مبلغ هزینه"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "مبلغ هزینه ساعتی برای این کارمند"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "لیست مبلغ هزینه ساعتی اضافه کار"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "مبلغ هزینه ساعتی"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "مبلغ هزینه کارمند"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "در هر تاریخ ،یک کارمند تنها می تواند یک مبلغ هزینه داشته باشد."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "هزینه"

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
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 ""
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr ""
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr ""
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr ""
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr ""

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Prix de revient"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Prix de revient"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Prix de revient"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Date"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Employé"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Prix de revient"
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Prix de revient horaire de cet employé."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Liste du prix de revient horaire au cours du temps."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Prix de revient horaire."
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Prix de revient de l'employé de la société"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Un employé ne peut avoir qu'un seul prix de revient par date."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Coût"

View File

@@ -0,0 +1,56 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Költség"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Költség"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Költség"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Dátum"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Alkalmazott"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Költség"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Alkalmazott költsége per óra "
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Lista a költség per óráról"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Költség per óra"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Alkalmazott költsége"
#, fuzzy
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Egy alkalmazottnak dátumonként egy költség írható be."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Költség"

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Tanggal"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Karyawan"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr ""
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr ""
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr ""
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr ""
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr ""

View File

@@ -0,0 +1,53 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Prezzo di costo"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Costi"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Prezzo di costo"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Data"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Dipendente"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Prezzo di costo"
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Costo orario per questo dipendente."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Elenco dei costi orari nel tempo."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Prezzo di costo orario."
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Costo del dipendente"
#, fuzzy
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Un dipendente può avere un costo giornaliero."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Costo"

View File

@@ -0,0 +1,56 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "ລາຄາຄິດໄລ່"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "ລາຄາຄິດໄລ່"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "ລາຄາຄິດໄລ່"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "ວັນທີ"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "ພະນັກງານ"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "ລາຄາຄິດໄລ່"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "ລາຄາຕໍ່ຊົ່ວໂມງສຳລັບພະນັກງານຜູ້ນີ້"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "ບັນຊີລາຍການຄ່າລ່ວງເວລາ"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "ລາຄາຕໍ່ຊົ່ວໂມງ"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "ມູນຄ່າລາຄາພະນັກງານ"
#, fuzzy
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "ລູກຈ້າງຜູ້ໜຶ່ງສາມາດມີພຽງມູນຄ່າລາຄາດຽວຕໍ່ມື້ເທົ່ານັ້ນ"
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "ມູນຄ່າ"

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
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 ""
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr ""
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr ""
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr ""
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr ""

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Kostprijs"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Kostprijzen"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Kostprijs"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Datum"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Werknemer"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Kostprijs"
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Kostprijs per uur voor deze werknemer."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Lijst met kostprijs per uur in de tijd."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Kostprijs per uur."
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Bedrijfsmedewerker kostprijs"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Een medewerker kan slechts één kostprijs hebben per datum."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Kosten"

View File

@@ -0,0 +1,55 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Cena kosztów"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Ceny kosztów"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Cena kosztów"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Data"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Pracownik"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Cena kosztów"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Godzinowa cena kosztów"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Godzinowa cena kosztów"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Godzinowa cena kosztów"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Robocza cena kosztów"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Koszt"

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Preço de custo"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Preços de custo"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Preços de custo"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Data"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Empregado"
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 "Preço de custo por hora deste empregado."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
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 "Preço de custo por hora."
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Preço de Custo do Empregado"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Um empregado somente pode ter um preço de custo por data."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Custo"

View File

@@ -0,0 +1,52 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Cost"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Costuri"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Cost"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Data"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Angajat"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Cost"
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Costul orar pentru acest Angajat."
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Lista de cost pe ora în timp."
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Preț de cost orar."
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Preţ de cost Angajat"
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Un angajat poate avea numai un sigur cost pe data."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Cost"

View File

@@ -0,0 +1,56 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Себестоимость"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Себестоимость"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Себестоимость"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Дата"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Сотрудник"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Себестоимость"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Часовая себестоимость для этого сотрудника"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Список часовой себестоимости по времени"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Часовая себестоимость"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Себестоимость сотрудника"
#, fuzzy
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "У сотрудника может быть только одна себестоимость за день."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Стоимость"

View File

@@ -0,0 +1,56 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Strošek"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Stroški"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Strošek"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Datum"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Zaposlenec"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Strošek"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Strošek na uro za tega zaposlenca"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Seznam stroškov na uro po času"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Strošek na uro"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Strošek zaposlenca"
#, fuzzy
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Zaposlenec ima lahko samo en strošek na datum."
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Strošek"

View File

@@ -0,0 +1,56 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr "Maliyet Fiyatı"
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr "Maliyet Fiyatları"
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr "Maliyet Fiyatı"
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "Tarih"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
msgstr "Çalışan"
msgctxt "field:timesheet.line,cost_price:"
msgid "Cost Price"
msgstr "Maliyet fiyatı"
#, fuzzy
msgctxt "help:company.employee,cost_price:"
msgid "Hourly cost price for this Employee."
msgstr "Bu çalışan için saatlik maliyet fiyatı"
#, fuzzy
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr "Saatlik fazla mesai maliyet fiyatı listesi"
#, fuzzy
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr "Saatlik maliyet fiyatı"
#, fuzzy
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr "Çalışan Maliyet Fiyatı"
#, fuzzy
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr "Bir çalışan için tarihe göre yalnız bir maliyet fiyatı olabilir"
msgctxt "view:company.employee:"
msgid "Cost"
msgstr "Maliyet"

View File

@@ -0,0 +1,51 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr ""
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
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 ""
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr ""
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr ""
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr ""
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr ""

View File

@@ -0,0 +1,52 @@
#
msgid ""
msgstr "Content-Type: text/plain; charset=utf-8\n"
msgctxt "field:company.employee,cost_price:"
msgid "Cost Price"
msgstr ""
msgctxt "field:company.employee,cost_prices:"
msgid "Cost Prices"
msgstr ""
msgctxt "field:company.employee_cost_price,cost_price:"
msgid "Cost Price"
msgstr ""
#, fuzzy
msgctxt "field:company.employee_cost_price,date:"
msgid "Date"
msgstr "日期格式"
msgctxt "field:company.employee_cost_price,employee:"
msgid "Employee"
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 ""
msgctxt "help:company.employee,cost_prices:"
msgid "List of hourly cost price over time."
msgstr ""
msgctxt "help:company.employee_cost_price,cost_price:"
msgid "Hourly cost price."
msgstr ""
msgctxt "model:company.employee_cost_price,string:"
msgid "Company Employee Cost Price"
msgstr ""
msgctxt "model:ir.message,text:msg_employee_unique_cost_price_date"
msgid "An employee can only have one cost price by date."
msgstr ""
msgctxt "view:company.employee:"
msgid "Cost"
msgstr ""

View File

@@ -0,0 +1,10 @@
<?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 grouped="1">
<record model="ir.message" id="msg_employee_unique_cost_price_date">
<field name="text">An employee can only have one cost price by date.</field>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,2 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.

View File

@@ -0,0 +1,52 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
import datetime
from decimal import Decimal
from trytond.modules.company.tests import (
CompanyTestMixin, create_company, create_employee, set_company)
from trytond.pool import Pool
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
class TimesheetCostTestCase(CompanyTestMixin, ModuleTestCase):
'Test TimesheetCost module'
module = 'timesheet_cost'
@with_transaction()
def test_compute_cost_price(self):
'Test compute_cost_price'
pool = Pool()
Party = pool.get('party.party')
EmployeeCostPrice = pool.get('company.employee_cost_price')
cost_prices = [
(datetime.date(2011, 1, 1), Decimal(10)),
(datetime.date(2012, 1, 1), Decimal(15)),
(datetime.date(2013, 1, 1), Decimal(20)),
]
test_prices = [
(datetime.date(2010, 1, 1), 0),
(datetime.date(2011, 1, 1), Decimal(10)),
(datetime.date(2011, 6, 1), Decimal(10)),
(datetime.date(2012, 1, 1), Decimal(15)),
(datetime.date(2012, 6, 1), Decimal(15)),
(datetime.date(2013, 1, 1), Decimal(20)),
(datetime.date(2013, 6, 1), Decimal(20)),
]
party = Party(name='Pam Beesly')
party.save()
company = create_company()
with set_company(company):
employee = create_employee(company)
for date, cost_price in cost_prices:
EmployeeCostPrice(
employee=employee,
date=date,
cost_price=cost_price).save()
for date, cost_price in test_prices:
self.assertEqual(employee.compute_cost_price(date), cost_price)
del ModuleTestCase

View File

@@ -0,0 +1,34 @@
# 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.model import fields
from trytond.pool import PoolMeta
from .company import price_digits
class Line(metaclass=PoolMeta):
__name__ = 'timesheet.line'
cost_price = fields.Numeric('Cost Price',
digits=price_digits, required=True, readonly=True)
@classmethod
def default_cost_price(cls):
# Needed at creation as cost_price is required
return 0
@classmethod
def preprocess_values(cls, mode, values):
values = super().preprocess_values(mode, values)
if mode == 'create':
# XXX Remove cost_price because proteus set it as default value
values.pop('cost_price', None)
return values
def compute_fields(self, field_names=None):
values = super().compute_fields(field_names=field_names)
cost_price = self.employee.compute_cost_price(date=self.date)
if getattr(self, 'cost_price', None) != cost_price:
values['cost_price'] = cost_price
return values

View File

@@ -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="model">timesheet.line</field>
<field name="field">cost_price</field>
<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="model">timesheet.line</field>
<field name="field">cost_price</field>
<field name="group" ref="party.group_party_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
</record>
</data>
</tryton>

View File

@@ -0,0 +1,17 @@
[tryton]
version=7.8.1
depends:
ir
company
party
timesheet
xml:
company.xml
timesheet.xml
message.xml
[register]
model:
company.Employee
company.EmployeeCostPrice
timesheet.Line

View File

@@ -0,0 +1,11 @@
<?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. -->
<form>
<label name="date"/>
<field name="date"/>
<label name="cost_price"/>
<field name="cost_price"/>
<label name="employee"/>
<field name="employee"/>
</form>

View File

@@ -0,0 +1,7 @@
<?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. -->
<tree>
<field name="date"/>
<field name="cost_price"/>
</tree>

View File

@@ -0,0 +1,11 @@
<?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. -->
<data>
<xpath expr="/form" position="inside">
<separator string="Cost" id="cost_prices" colspan="4"/>
<label name="cost_price"/>
<field name="cost_price"/>
<field name="cost_prices" colspan="4"/>
</xpath>
</data>