summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/account_payment_register.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2025-02-19 14:01:44 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2025-02-19 14:01:44 +0700
commit66901cd03a1494e6c84893e14083dcd1fbe737a5 (patch)
treea77fd0004f8e01834ade12d4508edbf76be1e6ff /indoteknik_custom/models/account_payment_register.py
parent62636c80dcc2078eed18810e7958f41fd5b13fdc (diff)
fix bug account move
Diffstat (limited to 'indoteknik_custom/models/account_payment_register.py')
-rw-r--r--indoteknik_custom/models/account_payment_register.py48
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
+ }