Add monetary field
issue10598 review338511002
This commit is contained in:
+4
-11
@@ -7,6 +7,8 @@ from trytond.pool import PoolMeta, Pool
|
||||
from trytond.pyson import Eval
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
from trytond.modules.currency.fields import Monetary
|
||||
|
||||
|
||||
class Fee(DeactivableMixin, ModelSQL, ModelView):
|
||||
'Account Dunning Fee'
|
||||
@@ -86,14 +88,11 @@ class FeeDunningLevel(ModelSQL, ModelView):
|
||||
dunning = fields.Many2One(
|
||||
'account.dunning', 'Dunning', required=True, select=True)
|
||||
level = fields.Many2One('account.dunning.level', 'Level', required=True)
|
||||
amount = fields.Numeric('Amount', digits=(16, Eval('currency_digits', 2)),
|
||||
depends=['currency_digits'])
|
||||
amount = Monetary(
|
||||
"Amount", currency='currency', digits='currency')
|
||||
currency = fields.Many2One('currency.currency', 'Currency')
|
||||
moves = fields.One2Many('account.move', 'origin', 'Moves', readonly=True)
|
||||
|
||||
currency_digits = fields.Function(fields.Integer('Currency Digits'),
|
||||
'on_change_with_currency_digits')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(FeeDunningLevel, cls).__setup__()
|
||||
@@ -103,12 +102,6 @@ class FeeDunningLevel(ModelSQL, ModelView):
|
||||
'account_dunning_fee.msg_fee_dunning_level_unique'),
|
||||
]
|
||||
|
||||
@fields.depends('currency')
|
||||
def on_change_with_currency_digits(self, name=None):
|
||||
if self.currency:
|
||||
return self.currency.digits
|
||||
return 2
|
||||
|
||||
def get_rec_name(self, name):
|
||||
return '%s @ %s' % (self.dunning.rec_name, self.level.rec_name)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="level"/>
|
||||
<label name="amount"/>
|
||||
<group col="2" id="amount_currency">
|
||||
<field name="amount"/>
|
||||
<field name="amount" symbol=""/>
|
||||
<field name="currency"/>
|
||||
</group>
|
||||
<field name="moves" colspan="4"/>
|
||||
|
||||
@@ -5,5 +5,4 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="dunning" expand="2"/>
|
||||
<field name="level" expand="1"/>
|
||||
<field name="amount"/>
|
||||
<field name="currency"/>
|
||||
</tree>
|
||||
|
||||
Reference in New Issue
Block a user