From ca5912d9f29f4bb2e7b482cce01f917285ed53cb Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Mon, 4 Aug 2025 09:55:46 +0700 Subject: penyusutan, reklas, journal uang muka --- .../models/update_depreciation_move_wizard.py | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 fixco_custom/models/update_depreciation_move_wizard.py (limited to 'fixco_custom/models/update_depreciation_move_wizard.py') diff --git a/fixco_custom/models/update_depreciation_move_wizard.py b/fixco_custom/models/update_depreciation_move_wizard.py new file mode 100644 index 0000000..094494b --- /dev/null +++ b/fixco_custom/models/update_depreciation_move_wizard.py @@ -0,0 +1,32 @@ +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 + 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, + } + } -- cgit v1.2.3