test: Unit test for round off entry dimensions
diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
index caa70d0..b22ec44 100644
--- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -1977,6 +1977,13 @@
self.assertEqual(expected_values[gle.account][2], gle.credit)
def test_rounding_adjustment_3(self):
+ from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import (
+ create_dimension,
+ disable_dimension,
+ )
+
+ create_dimension()
+
si = create_sales_invoice(do_not_save=True)
si.items = []
for d in [(1122, 2), (1122.01, 1), (1122.01, 1)]:
@@ -2004,6 +2011,10 @@
"included_in_print_rate": 1,
},
)
+
+ si.cost_center = "_Test Cost Center 2 - _TC"
+ si.location = "Block 1"
+
si.save()
si.submit()
self.assertEqual(si.net_total, 4007.16)
@@ -2039,6 +2050,18 @@
self.assertEqual(debit_credit_diff, 0)
+ round_off_gle = frappe.db.get_value(
+ "GL Entry",
+ {"voucher_type": "Sales Invoice", "voucher_no": si.name, "account": "Round Off - _TC"},
+ ["cost_center", "location"],
+ as_dict=1,
+ )
+
+ self.assertEqual(round_off_gle.cost_center, "_Test Cost Center 2 - _TC")
+ self.assertEqual(round_off_gle.location, "Block 1")
+
+ disable_dimension()
+
def test_sales_invoice_with_shipping_rule(self):
from erpnext.accounts.doctype.shipping_rule.test_shipping_rule import create_shipping_rule
diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py
index 56f84c2..89034eb 100644
--- a/erpnext/accounts/general_ledger.py
+++ b/erpnext/accounts/general_ledger.py
@@ -409,7 +409,7 @@
if dimensions and has_all_dimensions:
dimension_values = frappe.db.get_value(
- round_off_gle["voucher_type"], round_off_gle["voucher_no"], dimensions
+ round_off_gle["voucher_type"], round_off_gle["voucher_no"], dimensions, as_dict=1
)
for dimension in dimensions: