diff --git a/erpnext/accounts/doctype/sales_invoice/test_records.json b/erpnext/accounts/doctype/sales_invoice/test_records.json new file mode 100644 index 00000000000..9aee69cd053 --- /dev/null +++ b/erpnext/accounts/doctype/sales_invoice/test_records.json @@ -0,0 +1,772 @@ +[ + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "cost_center": "_Test Cost Center - _TC", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "items": [ + { + "amount": 500.0, + "base_amount": 500.0, + "base_rate": 500.0, + "cost_center": "_Test Cost Center - _TC", + "description": "138-CMS Shoe", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "138-CMS Shoe", + "item_name": "138-CMS Shoe", + "parentfield": "items", + "qty": 1.0, + "rate": 500.0, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "base_grand_total": 561.8, + "grand_total": 561.8, + "is_pos": 0, + "naming_series": "T-SINV-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 6 + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 6.36 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "amount": 500.0, + "base_amount": 500.0, + "base_rate": 500.0, + "cost_center": "_Test Cost Center - _TC", + "description": "_Test Item", + "doctype": "Sales Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "income_account": "Sales - _TC", + "item_code": "_Test Item", + "item_name": "_Test Item", + "parentfield": "items", + "price_list_rate": 500.0, + "qty": 1.0, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "base_grand_total": 630.0, + "grand_total": 630.0, + "is_pos": 0, + "naming_series": "T-SINV-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 16 + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 10 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "price_list_rate": 50, + "qty": 10, + "rate": 50, + "uom": "_Test UOM 1", + "conversion_factor": 1, + "stock_uom": "_Test UOM 1" + }, + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "price_list_rate": 150, + "qty": 5, + "uom": "_Test UOM", + "conversion_factor": 1, + "rate": 150, + "stock_uom": "_Test UOM" + } + ], + "grand_total": 0, + "is_pos": 0, + "naming_series": "T-SINV-", + "taxes": [ + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 1, + "row_id": 3 + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 5 + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": -10, + "row_id": 7 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "price_list_rate": 62.5, + "qty": 10, + "uom": "_Test UOM 1", + "conversion_factor": 1, + "stock_uom": "_Test UOM 1" + }, + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "price_list_rate": 190.66, + "qty": 5, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "grand_total": 0, + "is_pos": 0, + "naming_series": "T-SINV-", + "taxes": [ + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "idx": 1, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "idx": 2, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 2, + "row_id": 1 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "idx": 3, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 1, + "row_id": 1 + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "idx": 4, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "idx": 5, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "idx": 6, + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "idx": 7, + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "idx": 8, + "parentfield": "taxes", + "rate": -10, + "row_id": 7 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "cost_center": "_Test Cost Center - _TC", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "items": [ + { + "amount": 500.0, + "base_amount": 500.0, + "base_rate": 500.0, + "cost_center": "_Test Cost Center - _TC", + "description": "138-CMS Shoe", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "138-CMS Shoe", + "item_name": "138-CMS Shoe", + "parentfield": "items", + "qty": 1.0, + "rate": 500.0, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "base_grand_total": 561.8, + "grand_total": 561.8, + "is_pos": 0, + "naming_series": "T-SINV-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 6 + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 6.36 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "amount": 500.0, + "base_amount": 500.0, + "base_rate": 500.0, + "cost_center": "_Test Cost Center - _TC", + "description": "_Test Item", + "doctype": "Sales Invoice Item", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "income_account": "Sales - _TC", + "item_code": "_Test Item", + "item_name": "_Test Item", + "parentfield": "items", + "price_list_rate": 500.0, + "qty": 1.0, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "base_grand_total": 630.0, + "grand_total": 630.0, + "is_pos": 0, + "naming_series": "T-SINV-", + "base_net_total": 500.0, + "taxes": [ + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 16 + }, + { + "account_head": "_Test Account Service Tax - _TC", + "charge_type": "On Net Total", + "description": "Service Tax", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "cost_center": "_Test Cost Center - _TC", + "rate": 10 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "price_list_rate": 50, + "qty": 10, + "rate": 50, + "uom": "_Test UOM 1", + "conversion_factor": 1, + "stock_uom": "_Test UOM 1" + }, + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "price_list_rate": 150, + "qty": 5, + "uom": "_Test UOM", + "conversion_factor": 1, + "rate": 150, + "stock_uom": "_Test UOM" + } + ], + "grand_total": 0, + "is_pos": 0, + "naming_series": "T-SINV-", + "taxes": [ + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 1, + "row_id": 3 + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 2, + "row_id": 5 + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "parentfield": "taxes", + "rate": -10, + "row_id": 7 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + }, + { + "company": "_Test Company", + "conversion_rate": 1.0, + "currency": "INR", + "customer": "_Test Customer", + "customer_name": "_Test Customer", + "debit_to": "Debtors - _TC", + "doctype": "Sales Invoice", + "cost_center": "_Test Cost Center - _TC", + "items": [ + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 100", + "item_name": "_Test Item Home Desktop 100", + "item_tax_template": "_Test Account Excise Duty @ 10 - _TC", + "parentfield": "items", + "price_list_rate": 62.5, + "qty": 10, + "uom": "_Test UOM 1", + "conversion_factor": 1, + "stock_uom": "_Test UOM 1" + }, + { + "cost_center": "_Test Cost Center - _TC", + "doctype": "Sales Invoice Item", + "income_account": "Sales - _TC", + "expense_account": "_Test Account Cost for Goods Sold - _TC", + "item_code": "_Test Item Home Desktop 200", + "item_name": "_Test Item Home Desktop 200", + "parentfield": "items", + "price_list_rate": 190.66, + "qty": 5, + "uom": "_Test UOM", + "conversion_factor": 1, + "stock_uom": "_Test UOM" + } + ], + "grand_total": 0, + "is_pos": 0, + "naming_series": "T-SINV-", + "taxes": [ + { + "account_head": "_Test Account Excise Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Excise Duty", + "doctype": "Sales Taxes and Charges", + "idx": 1, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 12 + }, + { + "account_head": "_Test Account Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "Education Cess", + "doctype": "Sales Taxes and Charges", + "idx": 2, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 2, + "row_id": 1 + }, + { + "account_head": "_Test Account S&H Education Cess - _TC", + "charge_type": "On Previous Row Amount", + "cost_center": "_Test Cost Center - _TC", + "description": "S&H Education Cess", + "doctype": "Sales Taxes and Charges", + "idx": 3, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 1, + "row_id": 1 + }, + { + "account_head": "_Test Account CST - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "CST", + "doctype": "Sales Taxes and Charges", + "idx": 4, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 2, + "row_id": 3 + }, + { + "account_head": "_Test Account VAT - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "VAT", + "doctype": "Sales Taxes and Charges", + "idx": 5, + "included_in_print_rate": 1, + "parentfield": "taxes", + "rate": 12.5 + }, + { + "account_head": "_Test Account Customs Duty - _TC", + "charge_type": "On Net Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Customs Duty", + "doctype": "Sales Taxes and Charges", + "idx": 6, + "parentfield": "taxes", + "rate": 10 + }, + { + "account_head": "_Test Account Shipping Charges - _TC", + "charge_type": "Actual", + "cost_center": "_Test Cost Center - _TC", + "description": "Shipping Charges", + "doctype": "Sales Taxes and Charges", + "idx": 7, + "parentfield": "taxes", + "tax_amount": 100 + }, + { + "account_head": "_Test Account Discount - _TC", + "charge_type": "On Previous Row Total", + "cost_center": "_Test Cost Center - _TC", + "description": "Discount", + "doctype": "Sales Taxes and Charges", + "idx": 8, + "parentfield": "taxes", + "rate": -10, + "row_id": 7 + } + ], + "plc_conversion_rate": 1.0, + "price_list_currency": "INR", + "selling_price_list": "_Test Price List", + "territory": "_Test Territory" + } +] diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index dc4c76413e8..9fecd80e654 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -101,6 +101,9 @@ class TestSalesInvoice(ERPNextTestSuite): cls.enterClassContext(cls.change_settings("Selling Settings", validate_selling_price=0)) cls.make_employees() cls.make_sales_person() + cls.load_test_records("Journal Entry") + cls.load_test_records("Stock Entry") + cls.load_test_records("Sales Invoice") unlink_payment_on_cancel_of_invoice() @classmethod @@ -533,6 +536,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertTrue(gle) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_tax_calculation_with_multiple_items(self): si = create_sales_invoice(qty=84, rate=4.6, do_not_save=True) item_row = si.get("items")[0] @@ -561,6 +565,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(si.grand_total, 5474.0) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_tax_calculation_with_item_tax_template(self): si = create_sales_invoice(qty=84, rate=4.6, do_not_save=True) item_row = si.get("items")[0] @@ -627,6 +632,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(si.rounding_adjustment, 0.43) self.assertEqual(si.rounded_total, 5676.0) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_tax_calculation_with_multiple_items_and_discount(self): si = create_sales_invoice(qty=1, rate=75, do_not_save=True) item_row = si.get("items")[0] @@ -2183,6 +2189,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(expected_values[gle.account][1], gle.debit) self.assertEqual(expected_values[gle.account][2], gle.credit) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_rounding_adjustment_2(self): si = create_sales_invoice(rate=400, do_not_save=True) for rate in [400.25, 600.30, 100.65]: @@ -2240,6 +2247,7 @@ class TestSalesInvoice(ERPNextTestSuite): self.assertEqual(expected_account_values[0], gle.debit) self.assertEqual(expected_account_values[1], gle.credit) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_rounding_adjustment_3(self): from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import create_dimension @@ -3457,6 +3465,7 @@ class TestSalesInvoice(ERPNextTestSuite): frappe.db.set_value("Company", "_Test Company", "accounts_frozen_till_date", None) @ERPNextTestSuite.change_settings("Accounts Settings", {"over_billing_allowance": 0}) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": 1}) def test_over_billing_case_against_delivery_note(self): """ Test a case where duplicating the item with qty = 1 in the invoice @@ -4168,12 +4177,14 @@ class TestSalesInvoice(ERPNextTestSuite): si.save() return si + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_rounding_validation_for_opening_with_inclusive_tax(self): si = self._create_opening_invoice_with_inclusive_tax() # 'Round Off for Opening' not set in Company master # Ledger level validation must be thrown self.assertRaises(frappe.ValidationError, si.submit) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_ledger_entries_on_opening_invoice_with_rounding_loss_by_inclusive_tax(self): si = self._create_opening_invoice_with_inclusive_tax() # 'Round Off for Opening' is set in Company master @@ -4401,6 +4412,7 @@ class TestSalesInvoice(ERPNextTestSuite): doc = frappe.get_doc("Project", project.name) self.assertEqual(doc.total_billed_amount, si.grand_total) + @ERPNextTestSuite.change_settings("Selling Settings", {"allow_multiple_items": True}) def test_total_billed_amount_with_different_projects(self): # This test case is for checking the scenario where project is set at document level and for **some** child items only, not all from copy import copy diff --git a/erpnext/tests/utils.py b/erpnext/tests/utils.py index f5fadc0638e..5c19ff285a3 100644 --- a/erpnext/tests/utils.py +++ b/erpnext/tests/utils.py @@ -1669,6 +1669,7 @@ class ERPNextTestSuite(unittest.TestCase): "apply_warehouse_wise_reorder_level": 1, "opening_stock": 10, "valuation_rate": 100, + "allow_negative_stock": True, "item_defaults": [ { "company": "_Test Company",