diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2026-02-12 14:18:25 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2026-02-12 14:18:25 +0700 |
| commit | 387334dc0929087ac51cc09a90d2db15d79413f1 (patch) | |
| tree | 2d2f48a8da7fdb6f92d6e02f3696dec97dcf34ba /indoteknik_custom/models/update_depreciation_move_wizard.py | |
| parent | 6c749fd5c8deee7e38cc123b77e06b938bdcc3b3 (diff) | |
automatic reconcile by GL and automatic penyusutan asset
Diffstat (limited to 'indoteknik_custom/models/update_depreciation_move_wizard.py')
| -rw-r--r-- | indoteknik_custom/models/update_depreciation_move_wizard.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/indoteknik_custom/models/update_depreciation_move_wizard.py b/indoteknik_custom/models/update_depreciation_move_wizard.py new file mode 100644 index 00000000..7d465f1d --- /dev/null +++ b/indoteknik_custom/models/update_depreciation_move_wizard.py @@ -0,0 +1,48 @@ +from odoo import models, fields, api +from odoo.exceptions import UserError + +class UpdateDepreciationMoveWizard(models.TransientModel): + _name = 'update.depreciation.move.wizard' + _description = 'Wizard untuk Update Move Check Depreciation Line' + + target_date = fields.Date(string="Tanggal Depresiasi", required=True) + + # def action_update_move_check(self): + # lines = self.env['account.asset.depreciation.line'].search([ + # ('depreciation_date', '=', self.target_date), + # ]) + # if not lines: + # raise UserError("Tidak ada baris depresiasi dengan tanggal tersebut.") + + # updated_count = 0 + # for line in lines: + # if not line.move_check: + # line.move_check = True + # line.move_posted_check = True + # updated_count += 1 + + # return { + # 'type': 'ir.actions.client', + # 'tag': 'display_notification', + # 'params': { + # 'title': 'Update Selesai', + # 'message': f'{updated_count} baris berhasil di-update.', + # 'type': 'success', + # 'sticky': False, + # } + # } + + def action_update_move_check(self): + assets = self.env['account.asset.asset'] + assets.compute_generated_entries(self.target_date) + + return { + 'type': 'ir.actions.client', + 'tag': 'display_notification', + 'params': { + 'title': 'Update Selesai', + 'message': 'Depresiasi berhasil di-update.', + 'type': 'success', + 'sticky': False, + } + }
\ No newline at end of file |
