Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
4178 Visualizações

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,

Avatar
Cancelar
Autor

_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)

Publicações relacionadas Respostas Visualizações Atividade
3
mai. 24
4086
0
abr. 22
1651
2
ago. 18
10989
1
mai. 25
161
0
set. 24
583