diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2025-02-25 14:01:15 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2025-02-25 14:01:15 +0700 |
| commit | 6a5a2a2666c33ffafd610df882491d86918468bb (patch) | |
| tree | b61d4672169aa78a0bee9aae319af68768a2b6ee /indoteknik_custom/models/account_payment_register.py | |
| parent | 141bfb3a32e73d5b8557a70867d957d5ed3d485b (diff) | |
| parent | a24d7b2a21ff24e31eef77e2032a861b7eb13e31 (diff) | |
Merge branch 'odoo-production' into CR/renca-commision
# Conflicts:
# indoteknik_custom/models/commision.py
# indoteknik_custom/views/customer_commision.xml
Diffstat (limited to 'indoteknik_custom/models/account_payment_register.py')
| -rw-r--r-- | indoteknik_custom/models/account_payment_register.py | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_payment_register.py b/indoteknik_custom/models/account_payment_register.py new file mode 100644 index 00000000..4ebb7e4e --- /dev/null +++ b/indoteknik_custom/models/account_payment_register.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- + +from odoo import models, fields, api, _ +from odoo.exceptions import UserError + + +class AccountPaymentRegister(models.TransientModel): + _inherit = 'account.payment.register' + def _create_payment_vals_from_wizard(self): + payment_vals = { + 'date': self.payment_date, + 'amount': self.amount, + 'payment_type': self.payment_type, + 'partner_type': self.partner_type, + 'ref': self.communication, + 'journal_id': self.journal_id.id, + 'is_hr': True, + 'currency_id': self.currency_id.id, + 'partner_id': self.partner_id.id, + 'partner_bank_id': self.partner_bank_id.id, + 'payment_method_id': self.payment_method_id.id, + 'destination_account_id': self.line_ids[0].account_id.id + } + + if not self.currency_id.is_zero(self.payment_difference) and self.payment_difference_handling == 'reconcile': + payment_vals['write_off_line_vals'] = { + 'name': self.writeoff_label, + 'amount': self.payment_difference, + 'account_id': self.writeoff_account_id.id, + } + return payment_vals + + def _create_payment_vals_from_batch(self, batch_result): + batch_values = self._get_wizard_values_from_batch(batch_result) + return { + 'date': self.payment_date, + 'amount': batch_values['source_amount_currency'], + 'payment_type': batch_values['payment_type'], + 'partner_type': batch_values['partner_type'], + 'ref': self._get_batch_communication(batch_result), + 'journal_id': self.journal_id.id, + 'is_hr': True, + 'currency_id': batch_values['source_currency_id'], + 'partner_id': batch_values['partner_id'], + 'partner_bank_id': batch_result['key_values']['partner_bank_id'], + 'payment_method_id': self.payment_method_id.id, + 'destination_account_id': batch_result['lines'][0].account_id.id + } |
