mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 16:34:46 +00:00
test: Use name instead of doc
Previous filters implicitly returned last document.
This commit is contained in:
@@ -146,7 +146,7 @@ def make_payment_entry():
|
|||||||
|
|
||||||
supplier = create_supplier(supplier_name="_Test Supplier")
|
supplier = create_supplier(supplier_name="_Test Supplier")
|
||||||
pi = make_purchase_invoice(
|
pi = make_purchase_invoice(
|
||||||
supplier=supplier,
|
supplier=supplier.name,
|
||||||
supplier_warehouse="_Test Warehouse - _TC",
|
supplier_warehouse="_Test Warehouse - _TC",
|
||||||
expense_account="Cost of Goods Sold - _TC",
|
expense_account="Cost of Goods Sold - _TC",
|
||||||
uom="Nos",
|
uom="Nos",
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class TestBankReconciliationTool(AccountsTestMixin, IntegrationTestCase):
|
|||||||
{
|
{
|
||||||
"doctype": "Bank Account",
|
"doctype": "Bank Account",
|
||||||
"account_name": "HDFC _current_",
|
"account_name": "HDFC _current_",
|
||||||
"bank": bank,
|
"bank": bank.name,
|
||||||
"is_company_account": True,
|
"is_company_account": True,
|
||||||
"account": self.bank, # account from Chart of Accounts
|
"account": self.bank, # account from Chart of Accounts
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class TestPOSInvoice(IntegrationTestCase):
|
|||||||
from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry
|
from erpnext.accounts.doctype.pos_opening_entry.test_pos_opening_entry import create_opening_entry
|
||||||
|
|
||||||
cls.test_user, cls.pos_profile = init_user_and_profile()
|
cls.test_user, cls.pos_profile = init_user_and_profile()
|
||||||
create_opening_entry(cls.pos_profile, cls.test_user)
|
create_opening_entry(cls.pos_profile, cls.test_user.name)
|
||||||
mode_of_payment = frappe.get_doc("Mode of Payment", "Bank Draft")
|
mode_of_payment = frappe.get_doc("Mode of Payment", "Bank Draft")
|
||||||
set_default_account_for_mode_of_payment(mode_of_payment, "_Test Company", "_Test Bank - _TC")
|
set_default_account_for_mode_of_payment(mode_of_payment, "_Test Company", "_Test Bank - _TC")
|
||||||
|
|
||||||
|
|||||||
@@ -2051,7 +2051,7 @@ class TestPurchaseInvoice(IntegrationTestCase, StockTestMixin):
|
|||||||
def test_gl_entries_for_standalone_debit_note(self):
|
def test_gl_entries_for_standalone_debit_note(self):
|
||||||
from erpnext.stock.doctype.item.test_item import make_item
|
from erpnext.stock.doctype.item.test_item import make_item
|
||||||
|
|
||||||
item_code = make_item(properties={"is_stock_item": 1})
|
item_code = make_item(properties={"is_stock_item": 1}).name
|
||||||
make_purchase_invoice(item_code=item_code, qty=5, rate=500, update_stock=True)
|
make_purchase_invoice(item_code=item_code, qty=5, rate=500, update_stock=True)
|
||||||
|
|
||||||
returned_inv = make_purchase_invoice(
|
returned_inv = make_purchase_invoice(
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class TestSalesInvoice(ERPNextTestSuite):
|
|||||||
si = create_sales_invoice(
|
si = create_sales_invoice(
|
||||||
customer="_Test Internal Customer 3", company="_Test Company", is_internal_customer=1, rate=100
|
customer="_Test Internal Customer 3", company="_Test Company", is_internal_customer=1, rate=100
|
||||||
)
|
)
|
||||||
pi = make_inter_company_purchase_invoice(si)
|
pi = make_inter_company_purchase_invoice(si.name)
|
||||||
pi.items[0].rate = 120
|
pi.items[0].rate = 120
|
||||||
|
|
||||||
with self.assertRaises(ValidationError) as e:
|
with self.assertRaises(ValidationError) as e:
|
||||||
|
|||||||
@@ -712,7 +712,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase):
|
|||||||
|
|
||||||
si2 = self.create_sales_invoice(do_not_submit=True)
|
si2 = self.create_sales_invoice(do_not_submit=True)
|
||||||
si2.posting_date = add_days(today(), -1)
|
si2.posting_date = add_days(today(), -1)
|
||||||
si2.customer = self.customer2
|
si2.customer = self.customer2.name
|
||||||
si2.currency = "USD"
|
si2.currency = "USD"
|
||||||
si2.conversion_rate = 80
|
si2.conversion_rate = 80
|
||||||
si2.debit_to = self.debtors_usd
|
si2.debit_to = self.debtors_usd
|
||||||
@@ -935,7 +935,7 @@ class TestAccountsReceivable(AccountsTestMixin, IntegrationTestCase):
|
|||||||
|
|
||||||
si = self.create_sales_invoice(do_not_submit=True)
|
si = self.create_sales_invoice(do_not_submit=True)
|
||||||
si.posting_date = add_days(today(), -1)
|
si.posting_date = add_days(today(), -1)
|
||||||
si.customer = self.customer2
|
si.customer = self.customer2.name
|
||||||
si.currency = "USD"
|
si.currency = "USD"
|
||||||
si.conversion_rate = 80
|
si.conversion_rate = 80
|
||||||
si.debit_to = self.debtors_usd
|
si.debit_to = self.debtors_usd
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
|||||||
pda.submit()
|
pda.submit()
|
||||||
|
|
||||||
# execute report
|
# execute report
|
||||||
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01"))
|
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01")[0])
|
||||||
self.filters = frappe._dict(
|
self.filters = frappe._dict(
|
||||||
{
|
{
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
@@ -186,7 +186,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
|||||||
pda.submit()
|
pda.submit()
|
||||||
|
|
||||||
# execute report
|
# execute report
|
||||||
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01"))
|
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01")[0])
|
||||||
self.filters = frappe._dict(
|
self.filters = frappe._dict(
|
||||||
{
|
{
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
@@ -253,7 +253,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
|||||||
pda.submit()
|
pda.submit()
|
||||||
|
|
||||||
# execute report
|
# execute report
|
||||||
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01"))
|
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2021-05-01")[0])
|
||||||
self.filters = frappe._dict(
|
self.filters = frappe._dict(
|
||||||
{
|
{
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
@@ -326,7 +326,7 @@ class TestDeferredRevenueAndExpense(IntegrationTestCase, AccountsTestMixin):
|
|||||||
pda.submit()
|
pda.submit()
|
||||||
|
|
||||||
# execute report
|
# execute report
|
||||||
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2022-01-31"))
|
fiscal_year = frappe.get_doc("Fiscal Year", get_fiscal_year(date="2022-01-31")[0])
|
||||||
self.filters = frappe._dict(
|
self.filters = frappe._dict(
|
||||||
{
|
{
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
|
|||||||
@@ -774,7 +774,7 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
|||||||
|
|
||||||
current_asset_value = asset.finance_books[0].value_after_depreciation
|
current_asset_value = asset.finance_books[0].value_after_depreciation
|
||||||
asset_value_adjustment = make_asset_value_adjustment(
|
asset_value_adjustment = make_asset_value_adjustment(
|
||||||
asset=asset,
|
asset=asset.name,
|
||||||
date="2023-04-01",
|
date="2023-04-01",
|
||||||
current_asset_value=current_asset_value,
|
current_asset_value=current_asset_value,
|
||||||
new_asset_value=1200,
|
new_asset_value=1200,
|
||||||
@@ -879,7 +879,7 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
|||||||
|
|
||||||
current_asset_value = asset.finance_books[0].value_after_depreciation
|
current_asset_value = asset.finance_books[0].value_after_depreciation
|
||||||
asset_value_adjustment = make_asset_value_adjustment(
|
asset_value_adjustment = make_asset_value_adjustment(
|
||||||
asset=asset,
|
asset=asset.name,
|
||||||
date="2023-04-01",
|
date="2023-04-01",
|
||||||
current_asset_value=current_asset_value,
|
current_asset_value=current_asset_value,
|
||||||
new_asset_value=600,
|
new_asset_value=600,
|
||||||
@@ -945,7 +945,7 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
|||||||
|
|
||||||
current_asset_value = asset.finance_books[0].value_after_depreciation
|
current_asset_value = asset.finance_books[0].value_after_depreciation
|
||||||
asset_value_adjustment = make_asset_value_adjustment(
|
asset_value_adjustment = make_asset_value_adjustment(
|
||||||
asset=asset,
|
asset=asset.name,
|
||||||
date="2022-01-15",
|
date="2022-01-15",
|
||||||
current_asset_value=current_asset_value,
|
current_asset_value=current_asset_value,
|
||||||
new_asset_value=500,
|
new_asset_value=500,
|
||||||
@@ -1034,7 +1034,7 @@ class TestAssetDepreciationSchedule(IntegrationTestCase):
|
|||||||
|
|
||||||
current_asset_value = asset.finance_books[0].value_after_depreciation
|
current_asset_value = asset.finance_books[0].value_after_depreciation
|
||||||
asset_value_adjustment = make_asset_value_adjustment(
|
asset_value_adjustment = make_asset_value_adjustment(
|
||||||
asset=asset,
|
asset=asset.name,
|
||||||
date="2022-01-15",
|
date="2022-01-15",
|
||||||
current_asset_value=current_asset_value,
|
current_asset_value=current_asset_value,
|
||||||
new_asset_value=500,
|
new_asset_value=500,
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class TestSalesPartnerTargetVarianceBasedOnItemGroup(IntegrationTestCase):
|
|||||||
qty=20,
|
qty=20,
|
||||||
do_not_submit=True,
|
do_not_submit=True,
|
||||||
)
|
)
|
||||||
si.sales_partner = sales_partner
|
si.sales_partner = sales_partner.name
|
||||||
si.commission_rate = 5
|
si.commission_rate = 5
|
||||||
si.submit()
|
si.submit()
|
||||||
|
|
||||||
|
|||||||
@@ -1131,7 +1131,7 @@ class TestDeliveryNote(IntegrationTestCase):
|
|||||||
dn = create_delivery_note(do_not_submit=True)
|
dn = create_delivery_note(do_not_submit=True)
|
||||||
dt = make_delivery_trip(dn.name)
|
dt = make_delivery_trip(dn.name)
|
||||||
self.assertEqual(dn.name, dt.delivery_stops[0].delivery_note)
|
self.assertEqual(dn.name, dt.delivery_stops[0].delivery_note)
|
||||||
dt.driver = create_driver()
|
dt.driver = create_driver().name
|
||||||
self.assertRaisesRegex(
|
self.assertRaisesRegex(
|
||||||
frappe.exceptions.ValidationError,
|
frappe.exceptions.ValidationError,
|
||||||
r"^Delivery Notes should not be in draft state when submitting a Delivery Trip.*",
|
r"^Delivery Notes should not be in draft state when submitting a Delivery Trip.*",
|
||||||
@@ -2468,7 +2468,7 @@ class TestDeliveryNote(IntegrationTestCase):
|
|||||||
make_stock_entry(item_code=item.name, target="_Test Warehouse - _TC", qty=5, basic_rate=100)
|
make_stock_entry(item_code=item.name, target="_Test Warehouse - _TC", qty=5, basic_rate=100)
|
||||||
|
|
||||||
dn = create_delivery_note(
|
dn = create_delivery_note(
|
||||||
item_code=batch_item,
|
item_code=batch_item.name,
|
||||||
qty=5,
|
qty=5,
|
||||||
rate=500,
|
rate=500,
|
||||||
use_serial_batch_fields=1,
|
use_serial_batch_fields=1,
|
||||||
|
|||||||
@@ -1773,7 +1773,7 @@ class TestPurchaseReceipt(IntegrationTestCase):
|
|||||||
|
|
||||||
# Step - 3: Create back-date Stock Reconciliation [After DN and Before PR]
|
# Step - 3: Create back-date Stock Reconciliation [After DN and Before PR]
|
||||||
create_stock_reconciliation(
|
create_stock_reconciliation(
|
||||||
item_code=item,
|
item_code=item.name,
|
||||||
warehouse=target_warehouse,
|
warehouse=target_warehouse,
|
||||||
qty=10,
|
qty=10,
|
||||||
rate=50,
|
rate=50,
|
||||||
|
|||||||
@@ -425,13 +425,13 @@ class TestRepostItemValuation(IntegrationTestCase, StockTestMixin):
|
|||||||
item_code = make_item("_Test Remove Attached File Item", properties={"is_stock_item": 1})
|
item_code = make_item("_Test Remove Attached File Item", properties={"is_stock_item": 1})
|
||||||
|
|
||||||
make_purchase_receipt(
|
make_purchase_receipt(
|
||||||
item_code=item_code,
|
item_code=item_code.name,
|
||||||
qty=1,
|
qty=1,
|
||||||
rate=100,
|
rate=100,
|
||||||
)
|
)
|
||||||
|
|
||||||
pr1 = make_purchase_receipt(
|
pr1 = make_purchase_receipt(
|
||||||
item_code=item_code,
|
item_code=item_code.name,
|
||||||
qty=1,
|
qty=1,
|
||||||
rate=100,
|
rate=100,
|
||||||
posting_date=add_days(today(), days=-1),
|
posting_date=add_days(today(), days=-1),
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class TestStockEntry(IntegrationTestCase):
|
|||||||
def test_barcode_item_stock_entry(self):
|
def test_barcode_item_stock_entry(self):
|
||||||
item_code = make_item("_Test Item Stock Entry For Barcode", barcode="BDD-1234567890")
|
item_code = make_item("_Test Item Stock Entry For Barcode", barcode="BDD-1234567890")
|
||||||
|
|
||||||
se = make_stock_entry(item_code=item_code, target="_Test Warehouse - _TC", qty=1, basic_rate=100)
|
se = make_stock_entry(item_code=item_code.name, target="_Test Warehouse - _TC", qty=1, basic_rate=100)
|
||||||
self.assertEqual(se.items[0].barcode, "BDD-1234567890")
|
self.assertEqual(se.items[0].barcode, "BDD-1234567890")
|
||||||
|
|
||||||
def test_auto_material_request_for_variant(self):
|
def test_auto_material_request_for_variant(self):
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class TestGetItemDetail(IntegrationTestCase):
|
|||||||
{
|
{
|
||||||
"doctype": "Batch",
|
"doctype": "Batch",
|
||||||
"batch_id": "BATCH01",
|
"batch_id": "BATCH01",
|
||||||
"item": item,
|
"item": item.name,
|
||||||
}
|
}
|
||||||
).insert()
|
).insert()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user