Skip to content

Commit

Permalink
fix: suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
DaizyModi committed Jul 24, 2023
1 parent 653117c commit c931e6d
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions erpnext/controllers/taxes_and_totals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1000,21 +1000,15 @@ def get_itemised_tax_breakup_header(item_doctype, tax_accounts):

@erpnext.allow_regional
def get_itemised_tax_breakup_data(doc):
return _get_itemised_tax_breakup_data(doc)


def _get_itemised_tax_breakup_data(doc, with_tax_account=False):
itemised_tax = get_itemised_tax(doc.taxes, with_tax_account=with_tax_account)
itemised_tax = get_itemised_tax(doc.taxes)

itemised_taxable_amount = get_itemised_taxable_amount(doc.items)

itemised_tax_data = []
for item_code, taxes in itemised_tax.items():
for _item_code, taxable_amount in itemised_taxable_amount.items():
if item_code == _item_code:
itemised_tax_data.append(
frappe._dict({"item": item_code, "taxable_amount": taxable_amount, **taxes})
)
itemised_tax_data.append(
frappe._dict({"item": item_code, "taxable_amount": itemised_taxable_amount.get(item_code), **taxes})
)

return itemised_tax_data

Expand Down Expand Up @@ -1061,10 +1055,10 @@ def get_itemised_taxable_amount(items):

def get_rounded_tax_amount(itemised_tax, precision, tax_accounts):
# Rounding based on tax_amount precision
for _itemised_tax in itemised_tax:
for key, value in _itemised_tax.items():
if key in tax_accounts:
value["tax_amount"] = flt(value["tax_amount"], precision)
for taxes in itemised_tax:
for row in taxes.values():
if isinstance(row, dict) and isinstance(row["tax_amount"], float):
row["tax_amount"] = flt(row["tax_amount"], precision)


class init_landed_taxes_and_totals(object):
Expand Down

0 comments on commit c931e6d

Please sign in to comment.