summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2026-03-11 11:17:26 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2026-03-11 11:17:26 +0700
commitecd71ba1ed5dab6375d46488d7dda49a5344e802 (patch)
tree3b7240f9cfcdd943a15a98991d2cb4b256c6861d /indoteknik_custom/models
parentbe4edf2a1ae2b7e628764d499ecbd2b96eb178ea (diff)
<MIqdad> journal entries
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/upah_harian_office.py32
1 files changed, 31 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')