diff options
Diffstat (limited to 'indoteknik_custom/models/account_asset.py')
| -rw-r--r-- | indoteknik_custom/models/account_asset.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/indoteknik_custom/models/account_asset.py b/indoteknik_custom/models/account_asset.py index c54f1d97..dbcb6ba4 100644 --- a/indoteknik_custom/models/account_asset.py +++ b/indoteknik_custom/models/account_asset.py @@ -1,5 +1,7 @@ from odoo import fields, models, api, _ from odoo.exceptions import AccessError, UserError, ValidationError +from odoo.tools import DEFAULT_SERVER_DATE_FORMAT as DF +from odoo.tools import float_compare, float_is_zero class AccountAsset(models.Model): @@ -15,6 +17,10 @@ class AccountAsset(models.Model): raise UserError("Asset masih mempunyai Value") asset.state = 'close' + +class AccountAssetDepreciationLine(models.Model): + _inherit = 'account.asset.depreciation.line' + def create_move(self, post_move=True): created_moves = self.env['account.move'] prec = self.env['decimal.precision'].precision_get('Account') @@ -74,7 +80,9 @@ class AccountAsset(models.Model): created_moves.filtered(lambda m: any( m.asset_depreciation_ids.mapped( 'asset_id.category_id.open_asset'))).post() - created_moves.action_post() + + for move in created_moves: + move.action_post() return [x.id for x in created_moves] def create_grouped_move(self, post_move=True): |
