summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/invoice_reklas.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-01-06 13:12:51 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-01-06 13:12:51 +0700
commit38b28cfb316a1abf62f192ce03f938c70f21f1fb (patch)
tree2be84b9182aeb4e18e943b2eac75c0cdd9598a06 /indoteknik_custom/models/invoice_reklas.py
parent89d4e9c8df4babbaa8daccdf4a6f77fee8a06123 (diff)
multiple reklas
Diffstat (limited to 'indoteknik_custom/models/invoice_reklas.py')
-rw-r--r--indoteknik_custom/models/invoice_reklas.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/indoteknik_custom/models/invoice_reklas.py b/indoteknik_custom/models/invoice_reklas.py
index c2ee7e3d..b1ba49e8 100644
--- a/indoteknik_custom/models/invoice_reklas.py
+++ b/indoteknik_custom/models/invoice_reklas.py
@@ -94,3 +94,51 @@ class InvoiceReklas(models.TransientModel):
'type': 'ir.actions.act_window',
'res_id': account_move.id
}
+
+
+ def create_reklas_penjualan(self):
+ if not self.pay_amt:
+ raise UserError('Yang dibayarkan harus diisi')
+
+ account_ids = self._context['account_ids']
+ invoices = self.env['account.move'].browse(account_ids)
+ current_time = datetime.now()
+ for invoice in invoices:
+ ref_name = 'REKLAS '+invoice.reklas_id.name+" UANG MUKA PENJUALAN "+invoice.name+" "+invoice.partner_id.name
+ parameters_header = {
+ 'ref': ref_name,
+ 'date': current_time,
+ 'journal_id': 13
+ }
+
+ account_move = request.env['account.move'].create([parameters_header])
+ _logger.info('Success Reklas with %s' % account_move.name)
+
+ parameter_debit = {
+ 'move_id': account_move.id,
+ 'account_id': 449, # uang muka penjualan
+ 'partner_id': invoice.partner_id.id,
+ 'currency_id': 12,
+ 'debit': self.pay_amt,
+ 'credit': 0,
+ 'name': ref_name
+ }
+ parameter_credit = {
+ 'move_id': account_move.id,
+ 'account_id': 395,
+ 'partner_id': invoice.partner_id.id,
+ 'currency_id': 12,
+ 'debit': 0,
+ 'credit': self.pay_amt,
+ 'name': ref_name
+ }
+ request.env['account.move.line'].create([parameter_debit, parameter_credit])
+ return {
+ 'name': _('Journal Entries'),
+ 'view_mode': 'form',
+ 'res_model': 'account.move',
+ 'target': 'current',
+ 'view_id': False,
+ 'type': 'ir.actions.act_window',
+ 'res_id': account_move.id
+ }