diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-01-09 06:34:24 +0000 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2024-01-09 06:34:24 +0000 |
| commit | 6f62411bf3965fc27e24d8c997cc2bca771a0b8e (patch) | |
| tree | 3c0dc3837885ddf0e644558b46b598909b06d504 /indoteknik_custom/models/invoice_reklas.py | |
| parent | 5b607722945ac1b64eb3e6f2393a441064783342 (diff) | |
| parent | 7622354cbe00ca428d94469c6bd5ae3de5e73a76 (diff) | |
Merged in multiple-reklas (pull request #134)
Multiple reklas
Diffstat (limited to 'indoteknik_custom/models/invoice_reklas.py')
| -rw-r--r-- | indoteknik_custom/models/invoice_reklas.py | 48 |
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 + } |
