test: Unit test for round off entry dimensions
This commit is contained in:
parent
c312cd3725
commit
3fa1c63479
@ -1977,6 +1977,13 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
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 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
"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 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
|
||||
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
|
||||
|
||||
|
@ -409,7 +409,7 @@ def update_accounting_dimensions(round_off_gle):
|
||||
|
||||
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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user