summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fixco_custom/models/account_move.py1
-rw-r--r--fixco_custom/models/invoice_reklas.py4
-rw-r--r--fixco_custom/models/uangmuka_pembelian.py3
-rw-r--r--fixco_custom/views/account_move.xml1
4 files changed, 8 insertions, 1 deletions
diff --git a/fixco_custom/models/account_move.py b/fixco_custom/models/account_move.py
index 7886b71..e605f15 100644
--- a/fixco_custom/models/account_move.py
+++ b/fixco_custom/models/account_move.py
@@ -74,6 +74,7 @@ class AccountMove(models.Model):
copy=False,
tracking=True
)
+ reklas_id = fields.Many2one('account.move', string='Nomor CAB', domain="[('move_type','=','entry')]", copy=False)
def reject_refund(self):
if self.move_type == 'entry' and self.sale_id and self.ref.startswith('UANG MUKA PENJUALAN') and self.env.user.id in [9, 10, 15]:
diff --git a/fixco_custom/models/invoice_reklas.py b/fixco_custom/models/invoice_reklas.py
index 584d357..37fd4d7 100644
--- a/fixco_custom/models/invoice_reklas.py
+++ b/fixco_custom/models/invoice_reklas.py
@@ -102,6 +102,8 @@ class InvoiceReklas(models.TransientModel):
current_time = datetime.now()
for invoice in invoices:
+ if invoice.reklas_id:
+ raise UserError('Invoice {} sudah di reklas'.format(invoice.name))
# Ambil nama PO jika ada
po_name = invoice.purchase_id.name if invoice.purchase_id else ''
@@ -120,6 +122,7 @@ class InvoiceReklas(models.TransientModel):
'date': current_time,
'journal_id': 19,
'sale_id': invoice.sale_id.id,
+ 'purchase_order_id': invoice.purchase_order_id.id,
'reklas': True,
}
@@ -127,6 +130,7 @@ class InvoiceReklas(models.TransientModel):
parameters_header['purchase_id'] = invoice.purchase_id.id
account_move = request.env['account.move'].create([parameters_header])
+ invoice.reklas_id = account_move.id
_logger.info('Success Reklas with %s' % account_move.name)
# ✅ Set Bill asal sebagai source document
diff --git a/fixco_custom/models/uangmuka_pembelian.py b/fixco_custom/models/uangmuka_pembelian.py
index 5a680a3..6820c0d 100644
--- a/fixco_custom/models/uangmuka_pembelian.py
+++ b/fixco_custom/models/uangmuka_pembelian.py
@@ -51,7 +51,8 @@ class UangmukaPembelian(models.TransientModel):
'ref': ref_label,
'date': current_time,
'journal_id': 21,
- 'purchase_order_id': order.id
+ 'purchase_order_id': order.id,
+ 'uangmuka': True
}
account_move = request.env['account.move'].create([param_header])
diff --git a/fixco_custom/views/account_move.xml b/fixco_custom/views/account_move.xml
index abcb9fd..41ad966 100644
--- a/fixco_custom/views/account_move.xml
+++ b/fixco_custom/views/account_move.xml
@@ -72,6 +72,7 @@
</field>
<field name="reversed_entry_id" position="before">
+ <field name="reklas_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
<field name="uangmuka" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
<field name="reklas" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
<field name="reklas_used" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>