Merge pull request #28385 from vorasmit/fix-hsn_wise

fix(regional): `hsn_wise` as false returns `item_code`
This commit is contained in:
Deepesh Garg 2021-11-29 18:08:34 +05:30 committed by GitHub
commit 641f033337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -569,17 +569,17 @@ def get_item_list(data, doc, hsn_wise=False):
}
item_data_attrs = ['sgstRate', 'cgstRate', 'igstRate', 'cessRate', 'cessNonAdvol']
hsn_wise_charges, hsn_taxable_amount = get_itemised_tax_breakup_data(doc, account_wise=True, hsn_wise=hsn_wise)
for hsn_code, taxable_amount in hsn_taxable_amount.items():
for item_or_hsn, taxable_amount in hsn_taxable_amount.items():
item_data = frappe._dict()
if not hsn_code:
if not item_or_hsn:
frappe.throw(_('GST HSN Code does not exist for one or more items'))
item_data.hsnCode = int(hsn_code)
item_data.hsnCode = int(item_or_hsn) if hsn_wise else item_or_hsn
item_data.taxableAmount = taxable_amount
item_data.qtyUnit = ""
for attr in item_data_attrs:
item_data[attr] = 0
for account, tax_detail in hsn_wise_charges.get(hsn_code, {}).items():
for account, tax_detail in hsn_wise_charges.get(item_or_hsn, {}).items():
account_type = gst_accounts.get(account, '')
for tax_acc, attrs in tax_map.items():
if account_type == tax_acc: