diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-03-11 11:17:26 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-03-11 11:17:26 +0700 |
| commit | ecd71ba1ed5dab6375d46488d7dda49a5344e802 (patch) | |
| tree | 3b7240f9cfcdd943a15a98991d2cb4b256c6861d | |
| parent | be4edf2a1ae2b7e628764d499ecbd2b96eb178ea (diff) | |
<MIqdad> journal entries
| -rw-r--r-- | indoteknik_custom/models/upah_harian_office.py | 32 | ||||
| -rw-r--r-- | indoteknik_custom/views/upah_harian_office_views.xml | 8 |
2 files changed, 39 insertions, 1 deletions
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 @@ <sheet> + <button name="action_open_journal" + type="object" + class="oe_stat_button" + icon="fa-book" + width="250px" + attrs="{'invisible': [('journal_upah_id', '=', False)]}"> + <field name="journal_upah_id" string="Journal" widget="statinfo"/> + </button> <div class="oe_title"> <h1> |
