diff options
| author | Indoteknik . <it@fixcomart.co.id> | 2025-06-10 14:00:00 +0700 |
|---|---|---|
| committer | Indoteknik . <it@fixcomart.co.id> | 2025-06-10 14:00:00 +0700 |
| commit | d89f6b21f0174d52b1efb7d54ec3443bbbe3fbcb (patch) | |
| tree | 9954a125c16f4d1379a25162a4addd2f2b1613f7 | |
| parent | c827294ee6dd613de089af846521cfdc76550e16 (diff) | |
(andri) penyesuaian munculnya field
| -rw-r--r-- | indoteknik_custom/models/invoice_reklas.py | 15 | ||||
| -rw-r--r-- | indoteknik_custom/views/account_move.xml | 4 |
2 files changed, 11 insertions, 8 deletions
diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py index b7d52371..5145e098 100644 --- a/indoteknik_custom/models/invoice_reklas.py +++ b/indoteknik_custom/models/invoice_reklas.py @@ -27,6 +27,7 @@ class InvoiceReklas(models.TransientModel): move = self.env['account.move'].browse(active_ids[0]) cab = False + # Deteksi dari mana asal CAB if move.move_type == 'entry': cab = move elif move.move_type == 'in_invoice': @@ -35,12 +36,14 @@ class InvoiceReklas(models.TransientModel): elif move.purchase_order_id and move.purchase_order_id.move_id: cab = move.purchase_order_id.move_id + # Isi field Nomor CAB jika ditemukan if cab: self.reklas_id = cab.id - # ✅ Selalu ambil nilai dari invoice yang direklas (bukan dari CAB) + # Nilai yang dibayarkan harus tetap ambil dari invoice/bill self.pay_amt = move.amount_total + @api.model def default_get(self, fields): res = super().default_get(fields) @@ -64,11 +67,11 @@ class InvoiceReklas(models.TransientModel): return res - @api.onchange('reklas_type') - def _onchange_reklas_type(self): - if self.reklas_type == 'penjualan': - invoices = self.env['account.move'].browse(self._context.get('active_ids', [])) - self.pay_amt = invoices.amount_total + # @api.onchange('reklas_type') + # def _onchange_reklas_type(self): + # if self.reklas_type == 'penjualan': + # invoices = self.env['account.move'].browse(self._context.get('active_ids', [])) + # self.pay_amt = invoices.amount_total def create_reklas(self): if not self.reklas_type: diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml index 3a620a6a..0c2f9a68 100644 --- a/indoteknik_custom/views/account_move.xml +++ b/indoteknik_custom/views/account_move.xml @@ -37,8 +37,8 @@ </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 name="bill_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 name="bill_id" readonly="1" attrs="{'invisible': ['|', ('move_type', '!=', 'entry'), ('purchase_order_id', '!=', False)]}"/> </field> <field name="partner_shipping_id" position="before"> <field name="real_invoice_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'out_invoice')]}"/> |
