trytond-patches/account_asset_update_asset....

51 lines
1.9 KiB
Diff

diff --git a/trytond/trytond/modules/account_asset/asset.py b/trytond/trytond/modules/account_asset/asset.py
index 2d6a395..a5a0a3c 100644
--- a/trytond/trytond/modules/account_asset/asset.py
+++ b/trytond/trytond/modules/account_asset/asset.py
@@ -803,7 +803,9 @@ class CreateMoves(Wizard):
class UpdateAssetShowDepreciation(ModelView):
'Update Asset Show Depreciation'
__name__ = 'account.asset.update.show_depreciation'
- amount = fields.Numeric('Amount', readonly=True)
+ amount = fields.Numeric('Amount',
+ digits=(16, Eval('currency_digits', 2)),
+ depends=['currency_digits'], readonly=True)
date = fields.Date('Date', required=True,
domain=[
('date', '>=', Eval('latest_move_date')),
@@ -819,6 +821,17 @@ class UpdateAssetShowDepreciation(ModelView):
'Depreciation Account', readonly=True)
counterpart_account = fields.Many2One('account.account',
'Counterpart Account')
+ currency_digits = fields.Integer('Currency Digits', required=True)
+
+ @staticmethod
+ def default_currency_digits():
+ Asset = Pool().get('account.asset')
+
+ context = Transaction().context
+ active_id = context.get('active_id')
+ if active_id:
+ return Asset(active_id).currency_digits
+ return 2
class UpdateAsset(Wizard):
@@ -959,6 +972,16 @@ class AssetRevision(ModelSQL, ModelView):
super().__setup__()
cls.__access__.add('asset')
+ @staticmethod
+ def default_currency_digits():
+ Asset = Pool().get('account.asset')
+
+ context = Transaction().context
+ active_id = context.get('active_id')
+ if active_id:
+ return Asset(active_id).currency_digits
+ return 2
+
@fields.depends('asset', '_parent_asset.currency')
def on_change_with_currency(self, name=None):
if self.asset and self.asset.currency: