summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIndoteknik . <it@fixcomart.co.id>2025-06-05 08:35:39 +0700
committerIndoteknik . <it@fixcomart.co.id>2025-06-05 08:35:39 +0700
commitfa2c8cc7b00e963e740307484c174961f61ffc84 (patch)
tree52971fd5d0ae1d05df4c472055b93715992cbca8
parent3882ee6c3299525eeb8924cd9c7245f65cd15a28 (diff)
(andri) add field Journal Uang Muka di PO dan Purchase Order pada CAB
-rw-r--r--indoteknik_custom/models/account_move.py11
-rwxr-xr-xindoteknik_custom/models/purchase_order.py2
-rw-r--r--indoteknik_custom/models/uangmuka_pembelian.py2
-rw-r--r--indoteknik_custom/views/account_move.xml1
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml1
5 files changed, 16 insertions, 1 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 30de67be..24cedc34 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -68,6 +68,17 @@ class AccountMove(models.Model):
purchase_order_id = fields.Many2one('purchase.order', string='Purchase Order')
length_of_payment = fields.Integer(string="Length of Payment", compute='compute_length_of_payment')
+ def name_get(self):
+ result = []
+ for move in self:
+ if move.move_type == 'entry':
+ # Tampilkan nomor CAB (name)
+ result.append((move.id, move.name))
+ else:
+ # Gunakan default display
+ result.append((move.id, move.display_name))
+ return result
+
def compute_length_of_payment(self):
for rec in self:
payment_term = rec.invoice_payment_term_id.line_ids[0].days
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 240289bf..0696dd9f 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -65,7 +65,7 @@ class PurchaseOrder(models.Model):
sale_order = fields.Char(string='Sale Order')
matches_so = fields.Many2many('sale.order', string='Matches SO', compute='_compute_matches_so')
is_create_uangmuka = fields.Boolean(string='Uang Muka?')
- move_id = fields.Many2one('account.move', string='Account Move')
+ move_id = fields.Many2one('account.move', string='Journal Entries Uang Muka', domain=[('move_type', '=', 'entry')])
logbook_bill_id = fields.Many2one('report.logbook.bill', string='Logbook Bill')
status_printed = fields.Selection([
('not_printed', 'Belum Print'),
diff --git a/indoteknik_custom/models/uangmuka_pembelian.py b/indoteknik_custom/models/uangmuka_pembelian.py
index ba41f814..13d51dcf 100644
--- a/indoteknik_custom/models/uangmuka_pembelian.py
+++ b/indoteknik_custom/models/uangmuka_pembelian.py
@@ -57,6 +57,8 @@ class UangmukaPembelian(models.TransientModel):
account_move = request.env['account.move'].create([param_header])
_logger.info('Success Create Uang Muka Pembelian %s' % account_move.name)
+ account_move.purchase_order_id = order.id # isi field purchase_order_id
+
if order.partner_id.parent_id:
partner_id = order.partner_id.parent_id.id
else:
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index 46737a40..9217cc2a 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -31,6 +31,7 @@
</field>
<field name="ref" position="after">
<field name="sale_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
+ <field name="purchase_order_id" context="{'form_view_ref': 'purchase.purchase_order_form'}" options="{'no_create': True}"/>
</field>
<field name="partner_shipping_id" position="before">
<field name="real_invoice_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/>
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 0fbbb5e7..99362798 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -65,6 +65,7 @@
<field name="total_cost_service" attrs="{'required': [('partner_id', 'in', [9688, 29712])]}"/>
<field name="total_delivery_amt" attrs="{'required': [('partner_id', 'in', [9688, 29712])]}"/>
<field name="product_bom_id"/>
+ <field name="move_id" domain="[('move_type','=','entry')]" context="{'form_view_ref': 'account.view_move_form'}" options="{'no_create': True}"/>
</field>
<field name="amount_total" position="after">
<field name="total_margin"/>