Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
6702 Näkymät

I want to update draft invoices unit price by script but in odoo 13 it always shows error-

Cannot create unbalanced journal entry. Ids: [XXXXX]
which method I need to call to auto update account move line debit and credit as per new unit price in invoice line. I tried with calling onchange and computed methods in script but it seems not working.

Please advice!

Avatar
Hylkää

Good evening dear. And if you want to calculate the debit, credit, and the rest of the line of imported products from an invoice; to get amount_untaxed. And you can get the entire invoice total

Good Morning. Niyas.
I was seeing this post, with which I solved the lines. I have tried using the events from account.move to update the prices. In other words, calculate the debit, credi, subtotal, total and the total of all lines (untaxed amount). I am importing invoices from an xml file, when trying to calculate the rest of the fields of the lines it does not allow updating them because they are calculated fields and the methods of the classes do not execute any changes

Paras vastaus

Hi,

Add this code and see,

self.with_context(check_move_validity=False)._recompute_dynamic_lines\
(recompute_all_taxes=True, recompute_tax_base_amount=True)

Thanks

Avatar
Hylkää
Tekijä

Thanks Niyas, Its working !

Thank you very much @Niyas Raphy.

I was searching solution for tax re-computation when we add/remove taxes from backend and it's works fine using above lines.

Paras vastaus

Thanks Niyas, Great contribution!

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
3
tammik. 20
6105
1
heinäk. 25
238
2
helmik. 23
3892
0
elok. 22
68
1
kesäk. 22
2389