I found the total amount in some of Journal Entry is 0 which should not be 0 before. It was caused by patches/v6_10/fix_jv_total_amount.py which invoked function set_print_format_fields to fix total amount.
In function set_print_format_fields, the logic is setting total_amount += (d.debit_in_account_currency or d.credit_in_account_currency) when account_type in [“Bank”, “Cash”] and party_type and party are null.
However, we got some data in Journal Entry Account like the following example:
Parent Party_type Party Account Debit Credit
JV-00094 Customer CUST-00069 Debtors - IAG 0.000000 182.600000
JV-00094 Null Null 3.1.Sales - IAG 166.000000 0.000000
JV-00094 Null Null GST Collected - IAG 16.600000 0.000000
The account type of 3.1.Sales - IAG and GST Collected - IAG are not in [“Bank”, “Cash”], so according to current logic in set_print_format_fields, the total_amount of JV-00094 in Journal Entry is set to 0, but I think the right total amount should be 182.6. Why doesn’t set total_amount= debit or credit under ‘if d.party_type and d.party’? Is this a bug?
If you have not mentioned the party then total amount becomes zero because total amount is used in the print format of credit note and payment receipt voucher which is related to party.
Thanks your reply @rohit_w.
Actually, we got one row in ‘Journal Entry Account’ which has party and party type as you can see in my example. But the function set_print_format_fields doesn’t set total_amount= debit or credit under ‘if d.party_type and d.party’.
Yes, you have mentioned the party type but in another rows the account type of ledger is not bank or cash, which is must be bank or cash. It’s not a bug because both print format is used for bank or cash transaction against the party.
Thanks @rohit_w, but I still have some question about this issue.
First the example data is one of credit note data.
And this total amount of same data in version 4 or version 5 were not 0.
I found another patch for total_amount: v5_0/recalculate_total_amount_in_jv.py
After implementing this patch, the total_amount will be not 0 because the logic is (which is different with v6_10):
for d in je_doc.get(“accounts”):
if (d.party_type and d.party) or d.account in bank_or_cash_accounts:
total_amount = d.debit or d.credit
total_amount_in_words = money_in_words(total_amount, company_currency.get(je_doc.company))
The following are the screenshots of my example:
So the total_amount=0 is right under this case?
Dose anyone have any advice?
@rohit_w There is a PR #5131 related to this issue. It is clear that it’s a bug, waiting for releasing.
Thanks for help.
Is this STILL a bug 2 years later? I’m facing the same issue…