minor fix
This commit is contained in:
parent
f7cd48828d
commit
7bbca26c48
12
wage_type.py
12
wage_type.py
|
@ -7,6 +7,7 @@ from trytond.transaction import Transaction
|
|||
from trytond.i18n import gettext
|
||||
from .exceptions import WageTypeValidationError
|
||||
from trytond.tools import lstrip_wildcard
|
||||
from trytond.pool import Pool
|
||||
|
||||
STATES = {'readonly': Not(Bool(Eval('active')))}
|
||||
|
||||
|
@ -29,9 +30,13 @@ class WageType(ModelSQL, ModelView):
|
|||
('deduction', 'Deduction'),
|
||||
], 'Definition', required=True)
|
||||
unit_price_formula = fields.Char('Unit Price Formula',
|
||||
help='Python expression for eval(expr)')
|
||||
help="""Python expression for eval(expr) \b
|
||||
-salary: the salary employee \b
|
||||
-minimum_salary: the salary minimum fixed """)
|
||||
expense_formula = fields.Char('Expense Formula',
|
||||
help='Python expression for eval(expr)')
|
||||
help="""Python expression for eval(expr) \b
|
||||
-salary: the salary employee \b
|
||||
-minimum_salary: the salary minimum fixed """)
|
||||
uom = fields.Many2One('product.uom', 'UOM', required=True)
|
||||
default_quantity = fields.Numeric('Default Quantity', digits=(16, 2))
|
||||
type_concept = fields.Selection([
|
||||
|
@ -132,6 +137,9 @@ class WageType(ModelSQL, ModelView):
|
|||
Compute a formula field with a salary value as float
|
||||
:return: A decimal
|
||||
'''
|
||||
Configuration = Pool().get('staff.configuration')
|
||||
configuration = Configuration(1)
|
||||
minimum_salary = float(configuration.minimum_salary or 0)
|
||||
formula = getattr(self, formula)
|
||||
if not formula:
|
||||
return Decimal('0.0')
|
||||
|
|
Loading…
Reference in New Issue