summaryrefslogtreecommitdiff
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
parent62636c80dcc2078eed18810e7958f41fd5b13fdc (diff)
fix bug account move
-rwxr-xr-xindoteknik_custom/models/__init__.py1
-rw-r--r--indoteknik_custom/models/account_move.py3
-rw-r--r--indoteknik_custom/models/account_move_line.py2
-rw-r--r--indoteknik_custom/models/account_payment_register.py48
-rwxr-xr-xindoteknik_custom/security/ir.model.access.csv3
5 files changed, 54 insertions, 3 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index ddbe16f1..dea3eeea 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -142,3 +142,4 @@ from . import stock_immediate_transfer
from . import coretax_fatur
from . import ir_actions_report
from . import barcoding_product
+from . import account_payment_register
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 7760c69d..b2ac47c2 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -64,6 +64,7 @@ class AccountMove(models.Model):
nomor_kwitansi = fields.Char(string="Nomor Kwitansi")
other_subtotal = fields.Float(string="Other Subtotal", compute='compute_other_subtotal')
other_taxes = fields.Float(string="Other Taxes", compute='compute_other_taxes')
+ is_hr = fields.Boolean(string="Is HR?", default=False)
def _update_line_name_from_ref(self):
"""Update all account.move.line name fields with ref from account.move"""
@@ -114,7 +115,7 @@ class AccountMove(models.Model):
def create(self, vals):
vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0'
result = super(AccountMove, self).create(vals)
- result._update_line_name_from_ref()
+ # result._update_line_name_from_ref()
return result
def compute_so_shipping_paid_by(self):
diff --git a/indoteknik_custom/models/account_move_line.py b/indoteknik_custom/models/account_move_line.py
index 6b394da3..7c95d4ef 100644
--- a/indoteknik_custom/models/account_move_line.py
+++ b/indoteknik_custom/models/account_move_line.py
@@ -28,6 +28,6 @@ class AccountMoveLine(models.Model):
for vals in vals_list:
if 'move_id' in vals:
move = self.env['account.move'].browse(vals['move_id'])
- if move.move_type == 'entry':
+ if move.move_type == 'entry' and move.is_hr == True:
vals['name'] = move.ref
return super().create(vals_list) \ No newline at end of file
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
+ }
diff --git a/indoteknik_custom/security/ir.model.access.csv b/indoteknik_custom/security/ir.model.access.csv
index d4b79cd9..de29468d 100755
--- a/indoteknik_custom/security/ir.model.access.csv
+++ b/indoteknik_custom/security/ir.model.access.csv
@@ -161,4 +161,5 @@ access_reject_reason_wizard,reject.reason.wizard,model_reject_reason_wizard,,1,1
access_confirm_approval_wizard,confirm.approval.wizard,model_confirm_approval_wizard,,1,1,1,0
access_barcode_product,access.barcode.product,model_barcode_product,,1,1,1,1
access_barcoding_product,access.barcoding.product,model_barcoding_product,,1,1,1,1
-access_barcoding_product_line,access.barcoding.product.line,model_barcoding_product_line,,1,1,1,1 \ No newline at end of file
+access_barcoding_product_line,access.barcoding.product.line,model_barcoding_product_line,,1,1,1,1
+access_account_payment_register,access.account.payment.register,model_account_payment_register,,1,1,1,1 \ No newline at end of file