From ecd71ba1ed5dab6375d46488d7dda49a5344e802 Mon Sep 17 00:00:00 2001 From: Mqdd Date: Wed, 11 Mar 2026 11:17:26 +0700 Subject: journal entries --- indoteknik_custom/models/upah_harian_office.py | 32 +++++++++++++++++++++- .../views/upah_harian_office_views.xml | 8 ++++++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/upah_harian_office.py b/indoteknik_custom/models/upah_harian_office.py index 12d4a32e..d5ee5878 100644 --- a/indoteknik_custom/models/upah_harian_office.py +++ b/indoteknik_custom/models/upah_harian_office.py @@ -57,6 +57,8 @@ class UpahHarian(models.Model): string='Activity Line' ) + journal_upah_id = fields.Many2one('account.move') + total_upah = fields.Float( 'Total Upah Harian', compute='_compute_total_upah', @@ -198,7 +200,35 @@ class UpahHarian(models.Model): def action_create_journal_entries(self): - return + + if self.env.user.has_group('indoteknik_custom.group_role_fat'): + raise UserError("Hanya Finance yang bisa create journal") + + move = self.env['account.move'].create({ + 'date': fields.Date.today(), + 'journal_id': 11, + }) + + self.journal_upah_id = move.id + + return { + 'type': 'ir.actions.act_window', + 'name': 'Journal Entry', + 'res_model': 'account.move', + 'view_mode': 'form', + 'res_id': move.id, + 'target': 'current', + } + + def action_open_journal(self): + return { + 'name': 'Journal Entry', + 'view_mode': 'form', + 'res_model': 'account.move', + 'type': 'ir.actions.act_window', + 'res_id': self.journal_upah_id.id, + 'target': 'current' + } # Constrains @api.constrains('attachment_file_image', 'attachment_file_pdf', 'attachment_type') diff --git a/indoteknik_custom/views/upah_harian_office_views.xml b/indoteknik_custom/views/upah_harian_office_views.xml index 8be9136b..7b84bd5c 100644 --- a/indoteknik_custom/views/upah_harian_office_views.xml +++ b/indoteknik_custom/views/upah_harian_office_views.xml @@ -37,6 +37,14 @@ +

-- cgit v1.2.3