summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-07-19 08:51:19 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-07-19 08:51:19 +0700
commit17c147f8c988c36c46e035e954c0d90f3ea18f20 (patch)
tree10149a846ee0bea9d0e2b8817fad9937271a8579 /indoteknik_custom/models
parent51a363741a7c40d91052e90f7d1aa0f6defc2f99 (diff)
(andri) fix realization
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/down_payment.py46
1 files changed, 36 insertions, 10 deletions
diff --git a/indoteknik_custom/models/down_payment.py b/indoteknik_custom/models/down_payment.py
index e9fd51d0..68f6954d 100644
--- a/indoteknik_custom/models/down_payment.py
+++ b/indoteknik_custom/models/down_payment.py
@@ -69,6 +69,9 @@ class DownPayment(models.Model):
('hr_ga', 'HR & GA'),
], string='Departement Type', tracking=3, required=True)
+ attachment_file = fields.Binary(string="Attachment")
+
+
# Sales & MD : Darren ID 19
# Marketing : Iwan ID 216
# Logistic & Procurement : Rafly H ID 21
@@ -90,17 +93,39 @@ class DownPayment(models.Model):
return mapping.get(self.departement_type)
def action_realisasi_pum(self):
- return {
- 'type': 'ir.actions.act_window',
- 'name': 'Realisasi PUM',
- 'res_model': 'realization.down.payment',
- 'view_mode': 'form',
- 'target': 'current',
- 'context': {
- 'default_pum_id': self.id,
- 'default_value_down_payment': self.nominal,
+ self.ensure_one()
+
+ realization = self.env['realization.down.payment'].search([('pum_id', '=', self.id)], limit=1)
+
+ if realization:
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Realisasi PUM',
+ 'res_model': 'realization.down.payment',
+ 'view_mode': 'form',
+ 'target': 'current',
+ 'res_id': realization.id,
+ }
+ else:
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Realisasi PUM',
+ 'res_model': 'realization.down.payment',
+ 'view_mode': 'form',
+ 'target': 'current',
+ 'context': {
+ 'default_pum_id': self.id,
+ 'default_value_down_payment': self.nominal,
+ 'default_name': f'Realisasi - {self.number or ""}',
+ 'default_pemberian_line_ids': [
+ (0, 0, {
+ 'date': self.create_date.date() if self.create_date else fields.Date.today(),
+ 'description': 'Uang Muka',
+ 'value': self.nominal
+ })
+ ]
+ }
}
- }
def action_confirm_payment(self):
@@ -175,6 +200,7 @@ class RealizationDownPayment(models.Model):
_inherit = ['mail.thread']
pum_id = fields.Many2one('down.payment', string='No PUM')
+ name = fields.Char(string='Nama', readonly=True, tracking=3)
title = fields.Char(string='Judul', tracking=3)
goals = fields.Text(string='Tujuan', tracking=3)
related = fields.Char(string='Terkait', tracking=3,)