asset: Feld 'change_symbol' für Prozenzzeichen + test
This commit is contained in:
parent
166a9e13a9
commit
8a4c8fa58f
7 changed files with 40 additions and 33 deletions
11
rate.py
11
rate.py
|
@ -3,13 +3,13 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the
|
||||
# full copyright notices and license terms.
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, fields, Unique, Check
|
||||
from trytond.model import ModelView, ModelSQL, fields, Unique, Check, SymbolMixin
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval, Bool
|
||||
|
||||
|
||||
class Rate(ModelSQL, ModelView):
|
||||
class Rate(SymbolMixin, ModelSQL, ModelView):
|
||||
'Rate'
|
||||
__name__ = 'investment.rate'
|
||||
|
||||
|
@ -29,6 +29,8 @@ class Rate(ModelSQL, ModelView):
|
|||
uom = fields.Function(fields.Many2One(string='Uom',
|
||||
readonly=True, model_name='product.uom'),
|
||||
'on_change_with_uom')
|
||||
symbol = fields.Function(fields.Char(string='Symbol',
|
||||
readonly=True), 'on_change_with_symbol')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -51,6 +53,11 @@ class Rate(ModelSQL, ModelView):
|
|||
IrDate = Pool().get('ir.date')
|
||||
return IrDate.today()
|
||||
|
||||
def on_change_with_symbol(self, name=None):
|
||||
""" symbol:%
|
||||
"""
|
||||
return '%'
|
||||
|
||||
@fields.depends('asset', '_parent_asset.uom')
|
||||
def on_change_with_uom(self, name=None):
|
||||
""" get unit of asset
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue