summaryrefslogtreecommitdiff
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
parent51a363741a7c40d91052e90f7d1aa0f6defc2f99 (diff)
(andri) fix realization
-rw-r--r--indoteknik_custom/models/down_payment.py46
-rw-r--r--indoteknik_custom/views/down_payment.xml20
-rw-r--r--indoteknik_custom/views/down_payment_realization.xml5
3 files changed, 56 insertions, 15 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,)
diff --git a/indoteknik_custom/views/down_payment.xml b/indoteknik_custom/views/down_payment.xml
index 4c327d36..55edad4e 100644
--- a/indoteknik_custom/views/down_payment.xml
+++ b/indoteknik_custom/views/down_payment.xml
@@ -43,16 +43,30 @@
<field name="bank_name" colspan="2" attrs="{'readonly': [('status', '=', 'approved')]}"/>
<field name="account_name" colspan="2" attrs="{'readonly': [('status', '=', 'approved')]}"/>
<field name="bank_account" colspan="2" attrs="{'readonly': [('status', '=', 'approved')]}"/>
+ <field name="user_id" readonly="1"/>
+ <field name="departement_type"/>
+ <field name="status_pay_down_payment" readonly="1"/>
+ <field name="create_date" readonly="1"/>
+ <field name="estimated_return_date" readonly="1"/>
+ <field name="days_remaining" readonly="1"/>
+ <field name="detail_note" attrs="{'readonly': [('status', '=', 'approved')]}"/>
</group>
+
+ <group>
+
+ <field name="attachment_file"/>
+ </group>
+
+
<group string="" col="2">
- <field name="user_id" readonly="1"/>
+ <!-- <field name="user_id" readonly="1"/>
<field name="departement_type"/>
<field name="status_pay_down_payment" readonly="1"/>
<field name="create_date" readonly="1"/>
<field name="estimated_return_date" readonly="1"/>
<field name="days_remaining" readonly="1"/>
- <field name="detail_note" attrs="{'readonly': [('status', '=', 'approved')]}"/>
+ <field name="detail_note" attrs="{'readonly': [('status', '=', 'approved')]}"/> -->
</group>
</group>
</sheet>
@@ -73,6 +87,7 @@
<field name="applicant_name"/>
<field name="nominal"/>
<field name="departement_type" optional='hide'/>
+ <field name="days_remaining" readonly="1"/>
<field name="status"
readonly="1"
decoration-success="status == 'approved'"
@@ -83,7 +98,6 @@
decoration-danger="status_pay_down_payment == 'pending'"
widget="badge"/>
<field name="estimated_return_date" optional="hide"/>
- <field name="days_remaining" readonly="1"/>
</tree>
</field>
</record>
diff --git a/indoteknik_custom/views/down_payment_realization.xml b/indoteknik_custom/views/down_payment_realization.xml
index 3dcd2a8e..cd9459a9 100644
--- a/indoteknik_custom/views/down_payment_realization.xml
+++ b/indoteknik_custom/views/down_payment_realization.xml
@@ -13,11 +13,12 @@
</header>
<sheet>
<h1>
- <field name="title" class="oe_title"/>
+ <field name="name" class="oe_title"/>
</h1>
<group col="2">
<group>
<field name="pum_id" readonly="1"/>
+ <field name="title" required="1"/>
<field name="goals" required="1"/>
<field name="related" required="1"/>
</group>
@@ -29,7 +30,7 @@
<notebook>
<page string="Rincian Pemberian">
<field name="pemberian_line_ids" nolabel="1">
- <tree editable="bottom">
+ <tree editable="false" create="false" delete="false">
<field name="date"/>
<field name="description"/>
<field name="value" sum="Total Pemberian"/>