mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-15 03:01:22 +00:00
feat!: Item Wise Tax Details Table (#48692)
* fix: Add `Item Wise Tax Detail` Table and update related doctypes * fix: remove setting item_wise_tax_details in client side * fix: Remove redundant code for updating item_wise_tax_details after rename * fix: Add 'dont_recompute_tax' field to Item Wise Tax Detail * fix: update item_wise_tax_details after validations * chore: remove redundant code from payment_entry.js * fix: changes in POS for item_wise_tax_details * fix: handle merge taxes * fix: update test case and fix precision issue * chore: remove debugging statement * chore: remove redundant import * chore: linters * chore: remove redundant code and minor refactor * fix: correct function args * fix: fix test cases * fix: item wise sales register report * fix: remove dont recompute from item wise tax details and calculation for deduct * fix: do not retain old rows * fix: added validation for item wise tax details * fix: tax merging for pos * fix: vat audit report(regional report) * fix: query issue in item-wise sales register * fix: set other_charges using temp object * fix: precision issue in validation * fix: changes as per failing test cases * fix: tax merging * fix: set no_copy for item wise tax detail * fix: correct select field in query and other charged in item_wise_purchase_register * fix: do not include rows with missing item or tax in merge_taxes * fix: respect row wise rounding * chore: remove unused import * chore: incorrect tuple creation * fix: handle rounding adjustment * fix: currency option in item wise tax detail doctype * fix: patch to migrate item_wise tax_details to table * chore: remove item_wise_tax_detail from taxes table * fix: use base_tax_withholding_net_total instead of tax_withholding_net_total * fix: implemet item_wise_tax_detail for e-invoice (italy) * fix: fetch document by doctypes in migration patch * fix: fix multiple syntax errors and inconsistent variable usage * fix: remove deprecated settings and update item wise tax details flag * fix: enhance validation for item wise tax details and handle discrepancies * fix: increase chunk size for migration and improve item-wise tax detail calculations * fix: delete existing item-wise tax details to prevent duplicates during migration * fix: remove unnecessary docstatus filter from tax details query * fix: streamline validation checks in item wise tax details adjustment * fix: update additional fields to reference item and invoice attributes in tax detail queries * fix: Restrict tax query to the selected invoices in vat audit report * fix: use `base_tax_withholding_net_total` for calculation in patch * fix: set tax row_id and idx to None instead of empty strings * fix: remove unused precision parameter from rounding differences handler * fix: update docstatus in item_wise_tax_details as per doc * fix: remove empty on_update method from SalesOrder class * fix: remove empty on_update method from PurchaseOrder class * fix: incorporate zero cutoff in tax calculation logic * fix: increase threshold for rounding diff
This commit is contained in:
@@ -73,32 +73,54 @@ class TestTaxesAndTotals(FrappeTestCase):
|
||||
"taxes",
|
||||
{
|
||||
"charge_type": "On Item Quantity",
|
||||
"account_head": "_Test Account Shipping - _TC",
|
||||
"account_head": "_Test Account Shipping Charges - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"description": "Shipping",
|
||||
"rate": 50,
|
||||
},
|
||||
)
|
||||
self.doc.set_missing_item_details()
|
||||
calculate_taxes_and_totals(self.doc)
|
||||
self.doc.save()
|
||||
|
||||
expected_values = {
|
||||
"VAT": {"tax_rate": 10, "tax_amount": 10, "net_amount": 100},
|
||||
"Service Tax": {"tax_rate": 14, "tax_amount": 1.4, "net_amount": 10},
|
||||
"Customs Duty": {"tax_rate": 5, "tax_amount": 5.57, "net_amount": 111.4},
|
||||
"Shipping": {"tax_rate": 50, "tax_amount": 50, "net_amount": 0.0}, # net_amount: here qty
|
||||
}
|
||||
expected_values = [
|
||||
{
|
||||
"item_row": self.doc.items[0].name,
|
||||
"tax_row": self.doc.taxes[0].name,
|
||||
"rate": 10.0,
|
||||
"amount": 10.0,
|
||||
"taxable_amount": 100.0,
|
||||
},
|
||||
{
|
||||
"item_row": self.doc.items[0].name,
|
||||
"tax_row": self.doc.taxes[1].name,
|
||||
"rate": 14.0,
|
||||
"amount": 1.4,
|
||||
"taxable_amount": 10.0,
|
||||
},
|
||||
{
|
||||
"item_row": self.doc.items[0].name,
|
||||
"tax_row": self.doc.taxes[2].name,
|
||||
"rate": 5.0,
|
||||
"amount": 5.57,
|
||||
"taxable_amount": 111.4,
|
||||
},
|
||||
{
|
||||
"item_row": self.doc.items[0].name,
|
||||
"tax_row": self.doc.taxes[3].name,
|
||||
"rate": 50.0,
|
||||
"amount": 50.0,
|
||||
"taxable_amount": 0.0,
|
||||
},
|
||||
]
|
||||
|
||||
for tax in self.doc.taxes:
|
||||
self.assertIn(tax.description, expected_values)
|
||||
item_wise_tax_detail = json.loads(tax.item_wise_tax_detail)
|
||||
tax_detail = item_wise_tax_detail[self.doc.items[0].item_code]
|
||||
self.assertAlmostEqual(tax_detail.get("tax_rate"), expected_values[tax.description]["tax_rate"])
|
||||
self.assertAlmostEqual(
|
||||
tax_detail.get("tax_amount"), expected_values[tax.description]["tax_amount"]
|
||||
)
|
||||
self.assertAlmostEqual(
|
||||
tax_detail.get("net_amount"), expected_values[tax.description]["net_amount"]
|
||||
)
|
||||
# Check if net_total is set for each tax
|
||||
self.assertEqual(tax.net_amount, expected_values[tax.description]["net_amount"])
|
||||
actual_values = [
|
||||
{
|
||||
"item_row": row.item_row,
|
||||
"tax_row": row.tax_row,
|
||||
"rate": row.rate,
|
||||
"amount": row.amount,
|
||||
"taxable_amount": row.taxable_amount,
|
||||
}
|
||||
for row in self.doc.item_wise_tax_details
|
||||
]
|
||||
|
||||
self.assertEqual(actual_values, expected_values)
|
||||
|
||||
Reference in New Issue
Block a user