Skip to Content
Menu
This question has been flagged
4187 Rodiniai

Im Trying to Append 2 Journal Entry lines Regarding Bank charges(1 to Bank Charges(debit) and 2 to Bank(credit)) in the same Journal While Creating a  Register Payment, I've Done in the Odoo13 And its totally working but when i tried in Odoo14 The following error is coming,

Portretas
Atmesti
Autorius

_inherit = 'account.payment'

def _prepare_move_line_default_vals(self, write_off_line_vals=None):

res = super(AccountPaymentInherit, self)._prepare_move_line_default_vals()

debit_line = {'name': 'Test Journal Entry Creation',

'debit': 0.0, 'credit': 0.0, 'partner_id': 3,

'account_id': 7, 'payment_id': self.id}

credit_line = {'name': 'Test `Journal Entry Creation',

'debit': 0.0, 'credit': 0.0, 'partner_id': 3, 'account_id': 79, 'payment_id': self.id}

res.append(debit_line)

res.append(credit_line)

return res

I tried super the move_line preparation function and tried to append the lines ive created to it , But there is a condition in the account.payment as following

if len(liquidity_lines) != 1 or len(counterpart_lines) != 1:

raise UserError(_(

"The journal entry %s reached an invalid state relative to its payment.\n"

"To be consistent, the journal entry must always contains:\n"

"- one journal item involving the outstanding payment/receipts account.\n"

"- one journal item involving a receivable/payable account.\n"

"- optional journal items, all sharing the same account.\n\n"

) % move.display_name)

Related Posts Replies Rodiniai Veikla
3
geg. 24
4092
0
bal. 22
1654
2
rugp. 18
10996
1
geg. 25
163
0
rugs. 24
591