summaryrefslogtreecommitdiff
path: root/fixco_custom/models/update_depreciation_move_wizard.py
diff options
context:
space:
mode:
Diffstat (limited to 'fixco_custom/models/update_depreciation_move_wizard.py')
-rw-r--r--fixco_custom/models/update_depreciation_move_wizard.py42
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