diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2026-02-02 14:30:25 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2026-02-02 14:30:25 +0700 |
| commit | 18f978648362e8d9d5ed447d89bf1e969894b237 (patch) | |
| tree | fb7b5fd158787e0ec8eb9655cba1f43df1366754 /fixco_custom/models/update_depreciation_move_wizard.py | |
| parent | 2086d9f4540d3453cb2179560253769491aa0153 (diff) | |
push
Diffstat (limited to 'fixco_custom/models/update_depreciation_move_wizard.py')
| -rw-r--r-- | fixco_custom/models/update_depreciation_move_wizard.py | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/fixco_custom/models/update_depreciation_move_wizard.py b/fixco_custom/models/update_depreciation_move_wizard.py index 094494b..7d465f1 100644 --- a/fixco_custom/models/update_depreciation_move_wizard.py +++ b/fixco_custom/models/update_depreciation_move_wizard.py @@ -7,26 +7,42 @@ class UpdateDepreciationMoveWizard(models.TransientModel): 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.") + # 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 - updated_count = 0 - for line in lines: - if not line.move_check: - line.move_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': f'{updated_count} baris berhasil di-update.', + 'message': 'Depresiasi berhasil di-update.', 'type': 'success', 'sticky': False, } - } + }
\ No newline at end of file |
