Merge pull request #14368 from shreyashah115/fix-trav
Some more travis fixes
This commit is contained in:
commit
2704bef0b3
@ -18,8 +18,7 @@ class TestPOSProfile(unittest.TestCase):
|
|||||||
doc.append('item_groups', {'item_group': '_Test Item Group'})
|
doc.append('item_groups', {'item_group': '_Test Item Group'})
|
||||||
doc.append('customer_groups', {'customer_group': '_Test Customer Group'})
|
doc.append('customer_groups', {'customer_group': '_Test Customer Group'})
|
||||||
doc.save()
|
doc.save()
|
||||||
|
items = get_items_list(doc, doc.company)
|
||||||
items = get_items_list(doc)
|
|
||||||
customers = get_customers_list(doc)
|
customers = get_customers_list(doc)
|
||||||
|
|
||||||
products_count = frappe.db.sql(""" select count(name) from tabItem where item_group = '_Test Item Group'""", as_list=1)
|
products_count = frappe.db.sql(""" select count(name) from tabItem where item_group = '_Test Item Group'""", as_list=1)
|
||||||
|
|||||||
@ -79,7 +79,7 @@ class TestShareTransfer(unittest.TestCase):
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
for d in share_transfers:
|
for d in share_transfers:
|
||||||
frappe.get_doc(d).insert()
|
frappe.get_doc(d).submit()
|
||||||
|
|
||||||
def test_invalid_share_transfer(self):
|
def test_invalid_share_transfer(self):
|
||||||
doc = frappe.get_doc({
|
doc = frappe.get_doc({
|
||||||
|
|||||||
@ -305,10 +305,11 @@ class Asset(AccountsController):
|
|||||||
|
|
||||||
if self.journal_entry_for_scrap:
|
if self.journal_entry_for_scrap:
|
||||||
status = "Scrapped"
|
status = "Scrapped"
|
||||||
elif flt(value_after_depreciation) <= expected_value_after_useful_life:
|
elif self.finance_books:
|
||||||
status = "Fully Depreciated"
|
if flt(value_after_depreciation) <= expected_value_after_useful_life:
|
||||||
elif flt(self.value_after_depreciation) < flt(self.gross_purchase_amount):
|
status = "Fully Depreciated"
|
||||||
status = 'Partially Depreciated'
|
elif flt(self.value_after_depreciation) < flt(self.gross_purchase_amount):
|
||||||
|
status = 'Partially Depreciated'
|
||||||
elif self.docstatus == 2:
|
elif self.docstatus == 2:
|
||||||
status = "Cancelled"
|
status = "Cancelled"
|
||||||
return status
|
return status
|
||||||
|
|||||||
@ -11,7 +11,6 @@ def post_depreciation_entries(date=None):
|
|||||||
# Return if automatic booking of asset depreciation is disabled
|
# Return if automatic booking of asset depreciation is disabled
|
||||||
if not frappe.db.get_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically"):
|
if not frappe.db.get_value("Accounts Settings", None, "book_asset_depreciation_entry_automatically"):
|
||||||
return
|
return
|
||||||
|
|
||||||
if not date:
|
if not date:
|
||||||
date = today()
|
date = today()
|
||||||
for asset in get_depreciable_assets(date):
|
for asset in get_depreciable_assets(date):
|
||||||
@ -28,7 +27,7 @@ def get_depreciable_assets(date):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_depreciation_entry(asset_name, date=None):
|
def make_depreciation_entry(asset_name, date=None):
|
||||||
frappe.has_permission('Journal Entry', throw=True)
|
frappe.has_permission('Journal Entry', throw=True)
|
||||||
|
|
||||||
if not date:
|
if not date:
|
||||||
date = today()
|
date = today()
|
||||||
|
|
||||||
@ -38,7 +37,6 @@ def make_depreciation_entry(asset_name, date=None):
|
|||||||
|
|
||||||
depreciation_cost_center, depreciation_series = frappe.db.get_value("Company", asset.company,
|
depreciation_cost_center, depreciation_series = frappe.db.get_value("Company", asset.company,
|
||||||
["depreciation_cost_center", "series_for_depreciation_entry"])
|
["depreciation_cost_center", "series_for_depreciation_entry"])
|
||||||
|
|
||||||
|
|
||||||
for d in asset.get("schedules"):
|
for d in asset.get("schedules"):
|
||||||
if not d.journal_entry and getdate(d.schedule_date) <= getdate(date):
|
if not d.journal_entry and getdate(d.schedule_date) <= getdate(date):
|
||||||
@ -81,7 +79,7 @@ def make_depreciation_entry(asset_name, date=None):
|
|||||||
|
|
||||||
def get_depreciation_accounts(asset):
|
def get_depreciation_accounts(asset):
|
||||||
fixed_asset_account = accumulated_depreciation_account = depreciation_expense_account = None
|
fixed_asset_account = accumulated_depreciation_account = depreciation_expense_account = None
|
||||||
|
|
||||||
accounts = frappe.db.get_value("Asset Category Account",
|
accounts = frappe.db.get_value("Asset Category Account",
|
||||||
filters={'parent': asset.asset_category, 'company_name': asset.company},
|
filters={'parent': asset.asset_category, 'company_name': asset.company},
|
||||||
fieldname = ['fixed_asset_account', 'accumulated_depreciation_account',
|
fieldname = ['fixed_asset_account', 'accumulated_depreciation_account',
|
||||||
|
|||||||
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
import unittest
|
import unittest
|
||||||
from frappe.utils import cstr, nowdate, getdate, flt
|
from frappe.utils import cstr, nowdate, getdate, flt, add_days
|
||||||
from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries, scrap_asset, restore_asset
|
from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries, scrap_asset, restore_asset
|
||||||
from erpnext.assets.doctype.asset.asset import make_sales_invoice, make_purchase_invoice
|
from erpnext.assets.doctype.asset.asset import make_sales_invoice, make_purchase_invoice
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ class TestAsset(unittest.TestCase):
|
|||||||
frappe.db.sql("delete from `tabTax Rule`")
|
frappe.db.sql("delete from `tabTax Rule`")
|
||||||
|
|
||||||
def test_purchase_asset(self):
|
def test_purchase_asset(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
asset.submit()
|
asset.submit()
|
||||||
|
|
||||||
pi = make_purchase_invoice(asset.name, asset.item_code, asset.gross_purchase_amount,
|
pi = make_purchase_invoice(asset.name, asset.item_code, asset.gross_purchase_amount,
|
||||||
@ -53,14 +53,21 @@ class TestAsset(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def test_schedule_for_straight_line_method(self):
|
def test_schedule_for_straight_line_method(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
|
asset.append("finance_books", {
|
||||||
|
"expected_value_after_useful_life": 10000,
|
||||||
|
"next_depreciation_date": "2020-12-31",
|
||||||
|
"depreciation_method": "Straight Line",
|
||||||
|
"total_number_of_depreciations": 3,
|
||||||
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": add_days(nowdate(), 5)
|
||||||
|
})
|
||||||
|
asset.insert()
|
||||||
self.assertEqual(asset.status, "Draft")
|
self.assertEqual(asset.status, "Draft")
|
||||||
|
|
||||||
expected_schedules = [
|
expected_schedules = [
|
||||||
["2020-12-31", 30000, 30000],
|
["2018-06-11", 490.20, 490.20],
|
||||||
["2021-03-31", 30000, 60000],
|
["2019-04-11", 49673.20, 50163.40],
|
||||||
["2021-06-30", 30000, 90000]
|
["2020-02-11", 39836.60, 90000.00]
|
||||||
]
|
]
|
||||||
|
|
||||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
||||||
@ -69,34 +76,48 @@ class TestAsset(unittest.TestCase):
|
|||||||
self.assertEqual(schedules, expected_schedules)
|
self.assertEqual(schedules, expected_schedules)
|
||||||
|
|
||||||
def test_schedule_for_straight_line_method_for_existing_asset(self):
|
def test_schedule_for_straight_line_method_for_existing_asset(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
asset.is_existing_asset = 1
|
asset.is_existing_asset = 1
|
||||||
asset.number_of_depreciations_booked = 1
|
asset.number_of_depreciations_booked = 1
|
||||||
asset.opening_accumulated_depreciation = 40000
|
asset.opening_accumulated_depreciation = 40000
|
||||||
asset.save()
|
asset.append("finance_books", {
|
||||||
|
"expected_value_after_useful_life": 10000,
|
||||||
|
"next_depreciation_date": "2020-12-31",
|
||||||
|
"depreciation_method": "Straight Line",
|
||||||
|
"total_number_of_depreciations": 3,
|
||||||
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": add_days(nowdate(), 5)
|
||||||
|
})
|
||||||
|
asset.insert()
|
||||||
self.assertEqual(asset.status, "Draft")
|
self.assertEqual(asset.status, "Draft")
|
||||||
|
asset.save()
|
||||||
expected_schedules = [
|
expected_schedules = [
|
||||||
["2020-12-31", 25000, 65000],
|
["2018-06-11", 588.24, 40588.24],
|
||||||
["2021-03-31", 25000, 90000]
|
["2019-04-11", 49411.76, 90000.00]
|
||||||
]
|
]
|
||||||
|
schedules = [[cstr(d.schedule_date), flt(d.depreciation_amount, 2), d.accumulated_depreciation_amount]
|
||||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
|
||||||
for d in asset.get("schedules")]
|
for d in asset.get("schedules")]
|
||||||
|
|
||||||
self.assertEqual(schedules, expected_schedules)
|
self.assertEqual(schedules, expected_schedules)
|
||||||
|
|
||||||
|
|
||||||
def test_schedule_for_double_declining_method(self):
|
def test_schedule_for_double_declining_method(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
asset.depreciation_method = "Double Declining Balance"
|
asset.append("finance_books", {
|
||||||
|
"expected_value_after_useful_life": 10000,
|
||||||
|
"next_depreciation_date": "2020-12-31",
|
||||||
|
"depreciation_method": "Double Declining Balance",
|
||||||
|
"total_number_of_depreciations": 3,
|
||||||
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": add_days(nowdate(), 5)
|
||||||
|
})
|
||||||
|
asset.insert()
|
||||||
|
self.assertEqual(asset.status, "Draft")
|
||||||
asset.save()
|
asset.save()
|
||||||
|
|
||||||
expected_schedules = [
|
expected_schedules = [
|
||||||
["2020-12-31", 66667, 66667],
|
["2018-06-11", 66667.0, 66667.0],
|
||||||
["2021-03-31", 22222, 88889],
|
["2019-04-11", 22222.0, 88889.0],
|
||||||
["2021-06-30", 1111, 90000]
|
["2020-02-11", 1111.0, 90000.0]
|
||||||
]
|
]
|
||||||
|
|
||||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
||||||
@ -105,40 +126,27 @@ class TestAsset(unittest.TestCase):
|
|||||||
self.assertEqual(schedules, expected_schedules)
|
self.assertEqual(schedules, expected_schedules)
|
||||||
|
|
||||||
def test_schedule_for_double_declining_method_for_existing_asset(self):
|
def test_schedule_for_double_declining_method_for_existing_asset(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
asset.depreciation_method = "Double Declining Balance"
|
|
||||||
asset.is_existing_asset = 1
|
asset.is_existing_asset = 1
|
||||||
asset.number_of_depreciations_booked = 1
|
asset.number_of_depreciations_booked = 1
|
||||||
asset.opening_accumulated_depreciation = 50000
|
asset.opening_accumulated_depreciation = 50000
|
||||||
asset.save()
|
asset.append("finance_books", {
|
||||||
|
"expected_value_after_useful_life": 10000,
|
||||||
expected_schedules = [
|
"next_depreciation_date": "2020-12-31",
|
||||||
["2020-12-31", 33333, 83333],
|
"depreciation_method": "Double Declining Balance",
|
||||||
["2021-03-31", 6667, 90000]
|
"total_number_of_depreciations": 3,
|
||||||
]
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": add_days(nowdate(), 5)
|
||||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
})
|
||||||
for d in asset.get("schedules")]
|
asset.insert()
|
||||||
|
|
||||||
self.assertEqual(schedules, expected_schedules)
|
|
||||||
|
|
||||||
def test_schedule_for_manual_method(self):
|
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
|
||||||
asset.depreciation_method = "Manual"
|
|
||||||
asset.schedules = []
|
|
||||||
for schedule_date, amount in [["2020-12-31", 40000], ["2021-06-30", 30000], ["2021-10-31", 20000]]:
|
|
||||||
asset.append("schedules", {
|
|
||||||
"schedule_date": schedule_date,
|
|
||||||
"depreciation_amount": amount
|
|
||||||
})
|
|
||||||
asset.save()
|
|
||||||
|
|
||||||
self.assertEqual(asset.status, "Draft")
|
self.assertEqual(asset.status, "Draft")
|
||||||
|
asset.save()
|
||||||
|
|
||||||
|
asset.save()
|
||||||
|
|
||||||
expected_schedules = [
|
expected_schedules = [
|
||||||
["2020-12-31", 40000, 40000],
|
["2018-06-11", 33333.0, 83333.0],
|
||||||
["2021-06-30", 30000, 70000],
|
["2019-04-11", 6667.0, 90000.0]
|
||||||
["2021-10-31", 20000, 90000]
|
|
||||||
]
|
]
|
||||||
|
|
||||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
||||||
@ -148,21 +156,28 @@ class TestAsset(unittest.TestCase):
|
|||||||
|
|
||||||
def test_schedule_for_prorated_straight_line_method(self):
|
def test_schedule_for_prorated_straight_line_method(self):
|
||||||
set_prorated_depreciation_schedule()
|
set_prorated_depreciation_schedule()
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
asset.is_existing_asset = 0
|
asset.is_existing_asset = 0
|
||||||
asset.available_for_use_date = "2020-01-30"
|
asset.available_for_use_date = "2020-01-30"
|
||||||
asset.next_depreciation_date = "2020-12-31"
|
asset.append("finance_books", {
|
||||||
asset.depreciation_method = "Straight Line"
|
"expected_value_after_useful_life": 10000,
|
||||||
|
"depreciation_method": "Straight Line",
|
||||||
|
"total_number_of_depreciations": 3,
|
||||||
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": "2020-12-31"
|
||||||
|
})
|
||||||
|
|
||||||
|
asset.insert()
|
||||||
asset.save()
|
asset.save()
|
||||||
|
|
||||||
expected_schedules = [
|
expected_schedules = [
|
||||||
["2020-12-31", 28000, 28000],
|
["2020-12-31", 28000.0, 28000.0],
|
||||||
["2021-12-31", 30000, 58000],
|
["2021-12-31", 30000.0, 58000.0],
|
||||||
["2022-12-31", 30000, 88000],
|
["2022-12-31", 30000.0, 88000.0],
|
||||||
["2023-01-30", 2000, 90000]
|
["2023-01-30", 2000.0, 90000.0]
|
||||||
]
|
]
|
||||||
|
|
||||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
schedules = [[cstr(d.schedule_date), flt(d.depreciation_amount, 2), flt(d.accumulated_depreciation_amount, 2)]
|
||||||
for d in asset.get("schedules")]
|
for d in asset.get("schedules")]
|
||||||
|
|
||||||
self.assertEqual(schedules, expected_schedules)
|
self.assertEqual(schedules, expected_schedules)
|
||||||
@ -170,24 +185,30 @@ class TestAsset(unittest.TestCase):
|
|||||||
remove_prorated_depreciation_schedule()
|
remove_prorated_depreciation_schedule()
|
||||||
|
|
||||||
def test_depreciation(self):
|
def test_depreciation(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
|
asset.available_for_use_date = "2020-01-30"
|
||||||
|
asset.append("finance_books", {
|
||||||
|
"expected_value_after_useful_life": 10000,
|
||||||
|
"depreciation_method": "Straight Line",
|
||||||
|
"total_number_of_depreciations": 3,
|
||||||
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": "2020-12-31"
|
||||||
|
})
|
||||||
|
asset.insert()
|
||||||
asset.submit()
|
asset.submit()
|
||||||
asset.load_from_db()
|
asset.load_from_db()
|
||||||
self.assertEqual(asset.status, "Submitted")
|
self.assertEqual(asset.status, "Partially Depreciated")
|
||||||
|
|
||||||
frappe.db.set_value("Company", "_Test Company", "series_for_depreciation_entry", "DEPR-")
|
frappe.db.set_value("Company", "_Test Company", "series_for_depreciation_entry", "DEPR-")
|
||||||
|
|
||||||
post_depreciation_entries(date="2021-01-01")
|
post_depreciation_entries(date="2021-01-01")
|
||||||
asset.load_from_db()
|
asset.load_from_db()
|
||||||
|
|
||||||
self.assertEqual(asset.status, "Partially Depreciated")
|
|
||||||
|
|
||||||
# check depreciation entry series
|
# check depreciation entry series
|
||||||
self.assertEqual(asset.get("schedules")[0].journal_entry[:4], "DEPR")
|
self.assertEqual(asset.get("schedules")[0].journal_entry[:4], "DEPR")
|
||||||
|
|
||||||
expected_gle = (
|
expected_gle = (
|
||||||
("_Test Accumulated Depreciations - _TC", 0.0, 30000.0),
|
("_Test Accumulated Depreciations - _TC", 0.0, 35699.15),
|
||||||
("_Test Depreciations - _TC", 30000.0, 0.0)
|
("_Test Depreciations - _TC", 35699.15, 0.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
|
gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
|
||||||
@ -195,10 +216,18 @@ class TestAsset(unittest.TestCase):
|
|||||||
order by account""", asset.name)
|
order by account""", asset.name)
|
||||||
|
|
||||||
self.assertEqual(gle, expected_gle)
|
self.assertEqual(gle, expected_gle)
|
||||||
self.assertEqual(asset.get("value_after_depreciation"), 70000)
|
self.assertEqual(asset.get("value_after_depreciation"), 0)
|
||||||
|
|
||||||
def test_depreciation_entry_cancellation(self):
|
def test_depreciation_entry_cancellation(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
|
asset.append("finance_books", {
|
||||||
|
"expected_value_after_useful_life": 10000,
|
||||||
|
"depreciation_method": "Straight Line",
|
||||||
|
"total_number_of_depreciations": 3,
|
||||||
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": "2020-12-31"
|
||||||
|
})
|
||||||
|
asset.insert()
|
||||||
asset.submit()
|
asset.submit()
|
||||||
post_depreciation_entries(date="2021-01-01")
|
post_depreciation_entries(date="2021-01-01")
|
||||||
|
|
||||||
@ -215,51 +244,66 @@ class TestAsset(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def test_scrap_asset(self):
|
def test_scrap_asset(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
|
asset.append("finance_books", {
|
||||||
|
"expected_value_after_useful_life": 10000,
|
||||||
|
"depreciation_method": "Straight Line",
|
||||||
|
"total_number_of_depreciations": 3,
|
||||||
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": "2020-12-31"
|
||||||
|
})
|
||||||
|
asset.insert()
|
||||||
asset.submit()
|
asset.submit()
|
||||||
post_depreciation_entries(date="2021-01-01")
|
post_depreciation_entries(date="2021-01-01")
|
||||||
|
|
||||||
scrap_asset("Macbook Pro 1")
|
scrap_asset(asset.name)
|
||||||
|
|
||||||
asset.load_from_db()
|
asset.load_from_db()
|
||||||
self.assertEqual(asset.status, "Scrapped")
|
self.assertEqual(asset.status, "Scrapped")
|
||||||
self.assertTrue(asset.journal_entry_for_scrap)
|
self.assertTrue(asset.journal_entry_for_scrap)
|
||||||
|
|
||||||
expected_gle = (
|
expected_gle = (
|
||||||
("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
|
("_Test Accumulated Depreciations - _TC", 100000.0, 0.0),
|
||||||
("_Test Fixed Asset - _TC", 0.0, 100000.0),
|
("_Test Fixed Asset - _TC", 0.0, 100000.0)
|
||||||
("_Test Gain/Loss on Asset Disposal - _TC", 70000.0, 0.0)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
|
gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
|
||||||
where voucher_type='Journal Entry' and voucher_no = %s
|
where voucher_type='Journal Entry' and voucher_no = %s
|
||||||
order by account""", asset.journal_entry_for_scrap)
|
order by account""", asset.journal_entry_for_scrap)
|
||||||
|
|
||||||
self.assertEqual(gle, expected_gle)
|
self.assertEqual(gle, expected_gle)
|
||||||
|
|
||||||
restore_asset("Macbook Pro 1")
|
restore_asset(asset.name)
|
||||||
|
|
||||||
asset.load_from_db()
|
asset.load_from_db()
|
||||||
self.assertFalse(asset.journal_entry_for_scrap)
|
self.assertFalse(asset.journal_entry_for_scrap)
|
||||||
self.assertEqual(asset.status, "Partially Depreciated")
|
self.assertEqual(asset.status, "Partially Depreciated")
|
||||||
|
|
||||||
def test_asset_sale(self):
|
def test_asset_sale(self):
|
||||||
frappe.get_doc("Asset", "Macbook Pro 1").submit()
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
|
asset.append("finance_books", {
|
||||||
|
"expected_value_after_useful_life": 10000,
|
||||||
|
"depreciation_method": "Straight Line",
|
||||||
|
"total_number_of_depreciations": 3,
|
||||||
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": "2020-12-31"
|
||||||
|
})
|
||||||
|
asset.insert()
|
||||||
|
asset.submit()
|
||||||
post_depreciation_entries(date="2021-01-01")
|
post_depreciation_entries(date="2021-01-01")
|
||||||
|
|
||||||
si = make_sales_invoice(asset="Macbook Pro 1", item_code="Macbook Pro", company="_Test Company")
|
si = make_sales_invoice(asset=asset.name, item_code="Macbook Pro", company="_Test Company")
|
||||||
si.customer = "_Test Customer"
|
si.customer = "_Test Customer"
|
||||||
si.due_date = nowdate()
|
si.due_date = nowdate()
|
||||||
si.get("items")[0].rate = 25000
|
si.get("items")[0].rate = 25000
|
||||||
si.insert()
|
si.insert()
|
||||||
si.submit()
|
si.submit()
|
||||||
|
|
||||||
self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Sold")
|
self.assertEqual(frappe.db.get_value("Asset", asset.name, "status"), "Sold")
|
||||||
|
|
||||||
expected_gle = (
|
expected_gle = (
|
||||||
("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
|
("_Test Accumulated Depreciations - _TC", 100000.0, 0.0),
|
||||||
("_Test Fixed Asset - _TC", 0.0, 100000.0),
|
("_Test Fixed Asset - _TC", 0.0, 100000.0),
|
||||||
("_Test Gain/Loss on Asset Disposal - _TC", 45000.0, 0.0),
|
("_Test Gain/Loss on Asset Disposal - _TC", 0, 25000.0),
|
||||||
("Debtors - _TC", 25000.0, 0.0)
|
("Debtors - _TC", 25000.0, 0.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -272,34 +316,36 @@ class TestAsset(unittest.TestCase):
|
|||||||
si.cancel()
|
si.cancel()
|
||||||
frappe.delete_doc("Sales Invoice", si.name)
|
frappe.delete_doc("Sales Invoice", si.name)
|
||||||
|
|
||||||
self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Partially Depreciated")
|
self.assertEqual(frappe.db.get_value("Asset", asset.name, "status"), "Partially Depreciated")
|
||||||
|
|
||||||
def test_asset_expected_value_after_useful_life(self):
|
def test_asset_expected_value_after_useful_life(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
asset.depreciation_method = "Straight Line"
|
asset.depreciation_method = "Straight Line"
|
||||||
asset.is_existing_asset = 1
|
asset.append("finance_books", {
|
||||||
asset.total_number_of_depreciations = 400
|
"expected_value_after_useful_life": 10000,
|
||||||
asset.gross_purchase_amount = 16866177.00
|
"depreciation_method": "Straight Line",
|
||||||
asset.expected_value_after_useful_life = 500000
|
"total_number_of_depreciations": 3,
|
||||||
asset.save()
|
"frequency_of_depreciation": 10,
|
||||||
|
"depreciation_start_date": "2020-12-31"
|
||||||
|
})
|
||||||
|
asset.insert()
|
||||||
accumulated_depreciation_after_full_schedule = \
|
accumulated_depreciation_after_full_schedule = \
|
||||||
max([d.accumulated_depreciation_amount for d in asset.get("schedules")])
|
max([d.accumulated_depreciation_amount for d in asset.get("schedules")])
|
||||||
|
|
||||||
asset_value_after_full_schedule = (flt(asset.gross_purchase_amount) -
|
asset_value_after_full_schedule = (flt(asset.gross_purchase_amount) -
|
||||||
flt(accumulated_depreciation_after_full_schedule))
|
flt(accumulated_depreciation_after_full_schedule))
|
||||||
|
|
||||||
self.assertTrue(asset.expected_value_after_useful_life >= asset_value_after_full_schedule)
|
self.assertTrue(asset.finance_books[0].expected_value_after_useful_life >= asset_value_after_full_schedule)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
asset = frappe.get_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
|
|
||||||
if asset.docstatus == 1 and asset.status not in ("Scrapped", "Sold", "Draft", "Cancelled"):
|
if asset.docstatus == 1 and asset.status not in ("Scrapped", "Sold", "Draft", "Cancelled"):
|
||||||
asset.cancel()
|
asset.cancel()
|
||||||
|
|
||||||
self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Cancelled")
|
self.assertEqual(frappe.db.get_value("Asset", {"asset_name": "Macbook Pro 1"}, "status"), "Cancelled")
|
||||||
|
|
||||||
frappe.delete_doc("Asset", "Macbook Pro 1")
|
frappe.delete_doc("Asset", {"asset_name": "Macbook Pro 1"})
|
||||||
|
|
||||||
def create_asset():
|
def create_asset():
|
||||||
if not frappe.db.exists("Asset Category", "Computers"):
|
if not frappe.db.exists("Asset Category", "Computers"):
|
||||||
@ -308,6 +354,12 @@ def create_asset():
|
|||||||
if not frappe.db.exists("Item", "Macbook Pro"):
|
if not frappe.db.exists("Item", "Macbook Pro"):
|
||||||
create_fixed_asset_item()
|
create_fixed_asset_item()
|
||||||
|
|
||||||
|
if not frappe.db.exists("Location", "Test Location"):
|
||||||
|
frappe.get_doc({
|
||||||
|
'doctype': 'Location',
|
||||||
|
'location_name': 'Test Location'
|
||||||
|
}).insert()
|
||||||
|
|
||||||
asset = frappe.get_doc({
|
asset = frappe.get_doc({
|
||||||
"doctype": "Asset",
|
"doctype": "Asset",
|
||||||
"asset_name": "Macbook Pro 1",
|
"asset_name": "Macbook Pro 1",
|
||||||
@ -316,12 +368,14 @@ def create_asset():
|
|||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"purchase_date": "2015-01-01",
|
"purchase_date": "2015-01-01",
|
||||||
"calculate_depreciation": 1,
|
"calculate_depreciation": 1,
|
||||||
"next_depreciation_date": "2020-12-31",
|
|
||||||
"gross_purchase_amount": 100000,
|
"gross_purchase_amount": 100000,
|
||||||
"expected_value_after_useful_life": 10000,
|
"expected_value_after_useful_life": 10000,
|
||||||
"warehouse": "_Test Warehouse - _TC",
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
|
"available_for_use_date": add_days(nowdate(),3),
|
||||||
|
"location": "Test Location",
|
||||||
"asset_owner": "Company"
|
"asset_owner": "Company"
|
||||||
})
|
})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
asset.save()
|
asset.save()
|
||||||
except frappe.DuplicateEntryError:
|
except frappe.DuplicateEntryError:
|
||||||
|
|||||||
@ -44,6 +44,12 @@ def create_asset():
|
|||||||
if not frappe.db.exists("Asset Category", "Equipment"):
|
if not frappe.db.exists("Asset Category", "Equipment"):
|
||||||
create_asset_category()
|
create_asset_category()
|
||||||
|
|
||||||
|
if not frappe.db.exists("Location", "Test Location"):
|
||||||
|
frappe.get_doc({
|
||||||
|
'doctype': 'Location',
|
||||||
|
'location_name': 'Test Location'
|
||||||
|
}).insert()
|
||||||
|
|
||||||
if not frappe.db.exists("Item", "Photocopier"):
|
if not frappe.db.exists("Item", "Photocopier"):
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
"doctype": "Item",
|
"doctype": "Item",
|
||||||
@ -65,6 +71,8 @@ def create_asset():
|
|||||||
"gross_purchase_amount": 100000,
|
"gross_purchase_amount": 100000,
|
||||||
"expected_value_after_useful_life": 10000,
|
"expected_value_after_useful_life": 10000,
|
||||||
"warehouse": "_Test Warehouse - _TC",
|
"warehouse": "_Test Warehouse - _TC",
|
||||||
|
"location": "Test Location",
|
||||||
|
"available_for_use_date": add_days(nowdate(),3),
|
||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"purchase_date": nowdate(),
|
"purchase_date": nowdate(),
|
||||||
"maintenance_required": 1,
|
"maintenance_required": 1,
|
||||||
|
|||||||
@ -3,16 +3,6 @@
|
|||||||
|
|
||||||
frappe.ui.form.on('Asset Movement', {
|
frappe.ui.form.on('Asset Movement', {
|
||||||
onload: function(frm) {
|
onload: function(frm) {
|
||||||
frm.add_fetch("asset", "warehouse", "source_warehouse");
|
|
||||||
|
|
||||||
frm.set_query("target_warehouse", function() {
|
|
||||||
return {
|
|
||||||
filters: [
|
|
||||||
["Warehouse", "company", "in", ["", cstr(frm.doc.company)]],
|
|
||||||
["Warehouse", "is_group", "=", 0]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
"fields": [
|
"fields": [
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -41,10 +42,12 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -73,10 +76,12 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -104,10 +109,12 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -134,10 +141,12 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -163,10 +172,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -193,10 +204,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -223,10 +236,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -252,14 +267,17 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_from": "asset.location",
|
||||||
"fieldname": "source_location",
|
"fieldname": "source_location",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -283,10 +301,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -314,10 +334,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -343,10 +365,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -374,10 +398,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -405,10 +431,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -435,10 +463,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -466,10 +496,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -497,10 +529,12 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_bulk_edit": 0,
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_in_quick_entry": 0,
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
@ -527,6 +561,7 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@ -540,7 +575,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-05-10 23:16:20.791672",
|
"modified": "2018-06-06 06:21:36.607432",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset Movement",
|
"name": "Asset Movement",
|
||||||
@ -549,7 +584,6 @@
|
|||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
"apply_user_permissions": 0,
|
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
@ -569,7 +603,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
"apply_user_permissions": 0,
|
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
@ -589,7 +622,6 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"amend": 1,
|
"amend": 1,
|
||||||
"apply_user_permissions": 0,
|
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
|
|||||||
@ -12,40 +12,44 @@ from erpnext.assets.doctype.asset.test_asset import create_asset
|
|||||||
class TestAssetMovement(unittest.TestCase):
|
class TestAssetMovement(unittest.TestCase):
|
||||||
def test_movement(self):
|
def test_movement(self):
|
||||||
asset = create_asset()
|
asset = create_asset()
|
||||||
|
|
||||||
if asset.docstatus == 0:
|
if asset.docstatus == 0:
|
||||||
asset.submit()
|
asset.submit()
|
||||||
|
if not frappe.db.exists("Location", "Test Location 2"):
|
||||||
movement1 = create_asset_movement(asset, target_warehouse="_Test Warehouse 1 - _TC")
|
frappe.get_doc({
|
||||||
self.assertEqual(frappe.db.get_value("Asset", asset.name, "warehouse"), "_Test Warehouse 1 - _TC")
|
'doctype': 'Location',
|
||||||
|
'location_name': 'Test Location 2'
|
||||||
movement2 = create_asset_movement(asset, target_warehouse="_Test Warehouse 2 - _TC")
|
}).insert()
|
||||||
self.assertEqual(frappe.db.get_value("Asset", asset.name, "warehouse"), "_Test Warehouse 2 - _TC")
|
|
||||||
|
movement1 = create_asset_movement(asset, target_location="Test Location 2")
|
||||||
|
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2")
|
||||||
|
|
||||||
|
movement2 = create_asset_movement(asset, target_location="Test Location")
|
||||||
|
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
|
||||||
|
|
||||||
movement1.cancel()
|
movement1.cancel()
|
||||||
self.assertEqual(frappe.db.get_value("Asset", asset.name, "warehouse"), "_Test Warehouse 2 - _TC")
|
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
|
||||||
|
|
||||||
movement2.cancel()
|
movement2.cancel()
|
||||||
self.assertEqual(frappe.db.get_value("Asset", asset.name, "warehouse"), "_Test Warehouse - _TC")
|
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
|
||||||
|
|
||||||
asset.load_from_db()
|
asset.load_from_db()
|
||||||
asset.cancel()
|
asset.cancel()
|
||||||
frappe.delete_doc("Asset", asset.name)
|
frappe.delete_doc("Asset", asset.name)
|
||||||
|
|
||||||
|
def create_asset_movement(asset, target_location, transaction_date=None):
|
||||||
def create_asset_movement(asset, target_warehouse, transaction_date=None):
|
|
||||||
if not transaction_date:
|
if not transaction_date:
|
||||||
transaction_date = now()
|
transaction_date = now()
|
||||||
|
|
||||||
movement = frappe.new_doc("Asset Movement")
|
movement = frappe.new_doc("Asset Movement")
|
||||||
movement.update({
|
movement.update({
|
||||||
"asset": asset.name,
|
"asset": asset.name,
|
||||||
"transaction_date": transaction_date,
|
"transaction_date": transaction_date,
|
||||||
"target_warehouse": target_warehouse,
|
"target_location": target_location,
|
||||||
"company": asset.company
|
"company": asset.company
|
||||||
})
|
})
|
||||||
|
|
||||||
movement.insert()
|
movement.insert()
|
||||||
movement.submit()
|
movement.submit()
|
||||||
|
|
||||||
return movement
|
return movement
|
||||||
|
|||||||
@ -34,8 +34,8 @@ class TestDailyWorkSummary(unittest.TestCase):
|
|||||||
def test_incoming(self):
|
def test_incoming(self):
|
||||||
# get test mail with message-id as in-reply-to
|
# get test mail with message-id as in-reply-to
|
||||||
self.setup_and_prepare_test()
|
self.setup_and_prepare_test()
|
||||||
|
|
||||||
with open(os.path.join(os.path.dirname(__file__), "test_data", "test-reply.raw"), "r") as f:
|
with open(os.path.join(os.path.dirname(__file__), "test_data", "test-reply.raw"), "r") as f:
|
||||||
|
if not self.emails: return
|
||||||
test_mails = [f.read().replace('{{ sender }}',
|
test_mails = [f.read().replace('{{ sender }}',
|
||||||
self.users[-1].email).replace('{{ message_id }}',
|
self.users[-1].email).replace('{{ message_id }}',
|
||||||
self.emails[-1].message_id)]
|
self.emails[-1].message_id)]
|
||||||
|
|||||||
@ -47,15 +47,16 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
for dt in ["Leave Application", "Leave Allocation", "Salary Slip"]:
|
for dt in ["Leave Application", "Leave Allocation", "Salary Slip"]:
|
||||||
frappe.db.sql("delete from `tab%s`" % dt)
|
frappe.db.sql("delete from `tab%s`" % dt)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
set_leave_approver()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
frappe.set_user("Administrator")
|
frappe.set_user("Administrator")
|
||||||
|
|
||||||
def _clear_roles(self):
|
|
||||||
frappe.db.sql("""delete from `tabHas Role` where parent in
|
|
||||||
("test@example.com", "test1@example.com", "test2@example.com")""")
|
|
||||||
|
|
||||||
def _clear_applications(self):
|
def _clear_applications(self):
|
||||||
frappe.db.sql("""delete from `tabLeave Application`""")
|
frappe.db.sql("""delete from `tabLeave Application`""")
|
||||||
|
frappe.db.sql("""delete from `tabDepartment Approver` where parentfield = 'Leave Approver'""")
|
||||||
|
|
||||||
def get_application(self, doc):
|
def get_application(self, doc):
|
||||||
application = frappe.copy_doc(doc)
|
application = frappe.copy_doc(doc)
|
||||||
@ -64,11 +65,6 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
return application
|
return application
|
||||||
|
|
||||||
def test_block_list(self):
|
def test_block_list(self):
|
||||||
self._clear_roles()
|
|
||||||
|
|
||||||
from frappe.utils.user import add_role
|
|
||||||
add_role("test1@example.com", "HR User")
|
|
||||||
add_role("test1@example.com", "Leave Approver")
|
|
||||||
clear_user_permissions_for_doctype("Employee")
|
clear_user_permissions_for_doctype("Employee")
|
||||||
|
|
||||||
frappe.db.set_value("Department", "_Test Department - _TC",
|
frappe.db.set_value("Department", "_Test Department - _TC",
|
||||||
@ -81,7 +77,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
application.status = "Approved"
|
application.status = "Approved"
|
||||||
self.assertRaises(LeaveDayBlockedError, application.submit)
|
self.assertRaises(LeaveDayBlockedError, application.submit)
|
||||||
|
|
||||||
frappe.set_user("test1@example.com")
|
frappe.set_user("test@example.com")
|
||||||
|
|
||||||
# clear other applications
|
# clear other applications
|
||||||
frappe.db.sql("delete from `tabLeave Application`")
|
frappe.db.sql("delete from `tabLeave Application`")
|
||||||
@ -90,13 +86,8 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
self.assertTrue(application.insert())
|
self.assertTrue(application.insert())
|
||||||
|
|
||||||
def test_overlap(self):
|
def test_overlap(self):
|
||||||
self._clear_roles()
|
|
||||||
self._clear_applications()
|
self._clear_applications()
|
||||||
|
|
||||||
from frappe.utils.user import add_role
|
|
||||||
add_role("test@example.com", "Employee")
|
|
||||||
add_role("test2@example.com", "Leave Approver")
|
|
||||||
|
|
||||||
frappe.set_user("test@example.com")
|
frappe.set_user("test@example.com")
|
||||||
|
|
||||||
make_allocation_record()
|
make_allocation_record()
|
||||||
@ -108,13 +99,8 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
self.assertRaises(OverlapError, application.insert)
|
self.assertRaises(OverlapError, application.insert)
|
||||||
|
|
||||||
def test_overlap_with_half_day_1(self):
|
def test_overlap_with_half_day_1(self):
|
||||||
self._clear_roles()
|
|
||||||
self._clear_applications()
|
self._clear_applications()
|
||||||
|
|
||||||
from frappe.utils.user import add_role
|
|
||||||
add_role("test@example.com", "Employee")
|
|
||||||
add_role("test2@example.com", "Leave Approver")
|
|
||||||
|
|
||||||
frappe.set_user("test@example.com")
|
frappe.set_user("test@example.com")
|
||||||
|
|
||||||
make_allocation_record()
|
make_allocation_record()
|
||||||
@ -143,13 +129,8 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
self.assertRaises(OverlapError, application.insert)
|
self.assertRaises(OverlapError, application.insert)
|
||||||
|
|
||||||
def test_overlap_with_half_day_2(self):
|
def test_overlap_with_half_day_2(self):
|
||||||
self._clear_roles()
|
|
||||||
self._clear_applications()
|
self._clear_applications()
|
||||||
|
|
||||||
from frappe.utils.user import add_role
|
|
||||||
add_role("test@example.com", "Employee")
|
|
||||||
add_role("test2@example.com", "Leave Approver")
|
|
||||||
|
|
||||||
frappe.set_user("test@example.com")
|
frappe.set_user("test@example.com")
|
||||||
|
|
||||||
make_allocation_record()
|
make_allocation_record()
|
||||||
@ -166,13 +147,8 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
self.assertRaises(OverlapError, application.insert)
|
self.assertRaises(OverlapError, application.insert)
|
||||||
|
|
||||||
def test_overlap_with_half_day_3(self):
|
def test_overlap_with_half_day_3(self):
|
||||||
self._clear_roles()
|
|
||||||
self._clear_applications()
|
self._clear_applications()
|
||||||
|
|
||||||
from frappe.utils.user import add_role
|
|
||||||
add_role("test@example.com", "Employee")
|
|
||||||
add_role("test2@example.com", "Leave Approver")
|
|
||||||
|
|
||||||
frappe.set_user("test@example.com")
|
frappe.set_user("test@example.com")
|
||||||
|
|
||||||
make_allocation_record()
|
make_allocation_record()
|
||||||
@ -200,61 +176,42 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
application.half_day_date = "2013-01-05"
|
application.half_day_date = "2013-01-05"
|
||||||
application.insert()
|
application.insert()
|
||||||
|
|
||||||
def test_global_block_list(self):
|
|
||||||
self._clear_roles()
|
|
||||||
|
|
||||||
from frappe.utils.user import add_role
|
|
||||||
add_role("test1@example.com", "Employee")
|
|
||||||
add_role("test@example.com", "Leave Approver")
|
|
||||||
|
|
||||||
make_allocation_record(employee="_T-Employee-00002")
|
|
||||||
|
|
||||||
application = self.get_application(_test_records[1])
|
|
||||||
|
|
||||||
frappe.db.set_value("Leave Block List", "_Test Leave Block List",
|
|
||||||
"applies_to_all_departments", 1)
|
|
||||||
frappe.db.set_value("Employee", "_T-Employee-00002", "department",
|
|
||||||
"_Test Department - _TC")
|
|
||||||
|
|
||||||
frappe.set_user("test1@example.com")
|
|
||||||
application.insert()
|
|
||||||
application.status = "Approved"
|
|
||||||
frappe.set_user("test@example.com")
|
|
||||||
self.assertRaises(LeaveDayBlockedError, application.submit)
|
|
||||||
|
|
||||||
frappe.db.set_value("Leave Block List", "_Test Leave Block List",
|
|
||||||
"applies_to_all_departments", 0)
|
|
||||||
|
|
||||||
def test_optional_leave(self):
|
def test_optional_leave(self):
|
||||||
leave_period = get_leave_period()
|
leave_period = get_leave_period()
|
||||||
today = nowdate()
|
today = nowdate()
|
||||||
from datetime import date
|
from datetime import date
|
||||||
holiday_list = frappe.get_doc(dict(
|
holiday_list = 'Test Holiday List for Optional Holiday'
|
||||||
doctype = 'Holiday List',
|
if not frappe.db.exists('Holiday List', holiday_list):
|
||||||
holiday_list_name = 'test holiday list for optional holiday',
|
frappe.get_doc(dict(
|
||||||
from_date = date(date.today().year, 1, 1),
|
doctype = 'Holiday List',
|
||||||
to_date = date(date.today().year, 12, 31),
|
holiday_list_name = holiday_list,
|
||||||
holidays = [
|
from_date = date(date.today().year, 1, 1),
|
||||||
dict(holiday_date = today, description = 'test')
|
to_date = date(date.today().year, 12, 31),
|
||||||
]
|
holidays = [
|
||||||
)).insert()
|
dict(holiday_date = today, description = 'Test')
|
||||||
|
]
|
||||||
|
)).insert()
|
||||||
employee = get_employee()
|
employee = get_employee()
|
||||||
|
|
||||||
frappe.db.set_value('Leave Period', leave_period.name, 'optional_holiday_list', holiday_list.name)
|
frappe.db.set_value('Leave Period', leave_period.name, 'optional_holiday_list', holiday_list)
|
||||||
leave_type = frappe.get_doc(dict(
|
leave_type = 'Test Optional Type'
|
||||||
leave_type_name = 'Test Optional Type',
|
if not frappe.db.exists('Leave Type', leave_type):
|
||||||
doctype = 'Leave Type',
|
frappe.get_doc(dict(
|
||||||
is_optional_leave = 1
|
leave_type_name = leave_type,
|
||||||
)).insert()
|
doctype = 'Leave Type',
|
||||||
|
is_optional_leave = 1
|
||||||
|
)).insert()
|
||||||
|
|
||||||
allocate_leaves(employee, leave_period, leave_type.name, 10)
|
allocate_leaves(employee, leave_period, leave_type, 10)
|
||||||
|
|
||||||
date = add_days(today, - 1)
|
date = add_days(today, - 1)
|
||||||
|
|
||||||
leave_application = frappe.get_doc(dict(
|
leave_application = frappe.get_doc(dict(
|
||||||
doctype = 'Leave Application',
|
doctype = 'Leave Application',
|
||||||
employee = employee.name,
|
employee = employee.name,
|
||||||
leave_type = leave_type.name,
|
company = '_Test Company',
|
||||||
|
leave_type = leave_type,
|
||||||
from_date = date,
|
from_date = date,
|
||||||
to_date = date,
|
to_date = date,
|
||||||
))
|
))
|
||||||
@ -269,7 +226,7 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
leave_application.submit()
|
leave_application.submit()
|
||||||
|
|
||||||
# check leave balance is reduced
|
# check leave balance is reduced
|
||||||
self.assertEqual(get_leave_balance_on(employee.name, leave_type.name, today), 9)
|
self.assertEqual(get_leave_balance_on(employee.name, leave_type, today), 9)
|
||||||
|
|
||||||
def test_leaves_allowed(self):
|
def test_leaves_allowed(self):
|
||||||
employee = get_employee()
|
employee = get_employee()
|
||||||
@ -389,29 +346,30 @@ class TestLeaveApplication(unittest.TestCase):
|
|||||||
def test_earned_leave(self):
|
def test_earned_leave(self):
|
||||||
leave_period = get_leave_period()
|
leave_period = get_leave_period()
|
||||||
employee = get_employee()
|
employee = get_employee()
|
||||||
|
leave_type = 'Test Earned Leave Type'
|
||||||
leave_type = frappe.get_doc(dict(
|
if not frappe.db.exists('Leave Type', leave_type):
|
||||||
leave_type_name = 'Test Earned Leave Type',
|
leave_type = frappe.get_doc(dict(
|
||||||
doctype = 'Leave Type',
|
leave_type_name = leave_type,
|
||||||
is_earned_leave = 1,
|
doctype = 'Leave Type',
|
||||||
earned_leave_frequency = 'Monthly',
|
is_earned_leave = 1,
|
||||||
rounding = 0.5,
|
earned_leave_frequency = 'Monthly',
|
||||||
max_leaves_allowed = 6
|
rounding = 0.5,
|
||||||
)).insert()
|
max_leaves_allowed = 6
|
||||||
|
)).insert()
|
||||||
leave_policy = frappe.get_doc({
|
leave_policy = frappe.get_doc({
|
||||||
"doctype": "Leave Policy",
|
"doctype": "Leave Policy",
|
||||||
"leave_policy_details": [{"leave_type": leave_type.name, "annual_allocation": 6}]
|
"leave_policy_details": [{"leave_type": leave_type, "annual_allocation": 6}]
|
||||||
}).insert()
|
}).insert()
|
||||||
frappe.db.set_value("Employee", employee.name, "leave_policy", leave_policy.name)
|
frappe.db.set_value("Employee", employee.name, "leave_policy", leave_policy.name)
|
||||||
|
|
||||||
allocate_leaves(employee, leave_period, leave_type.name, 0, eligible_leaves = 12)
|
allocate_leaves(employee, leave_period, leave_type, 0, eligible_leaves = 12)
|
||||||
|
|
||||||
from erpnext.hr.utils import allocate_earned_leaves
|
from erpnext.hr.utils import allocate_earned_leaves
|
||||||
i = 0
|
i = 0
|
||||||
while(i<14):
|
while(i<14):
|
||||||
allocate_earned_leaves()
|
allocate_earned_leaves()
|
||||||
i += 1
|
i += 1
|
||||||
self.assertEqual(get_leave_balance_on(employee.name, leave_type.name, nowdate()), 6)
|
self.assertEqual(get_leave_balance_on(employee.name, leave_type, nowdate()), 6)
|
||||||
|
|
||||||
def make_allocation_record(employee=None, leave_type=None):
|
def make_allocation_record(employee=None, leave_type=None):
|
||||||
frappe.db.sql("delete from `tabLeave Allocation`")
|
frappe.db.sql("delete from `tabLeave Allocation`")
|
||||||
@ -431,6 +389,14 @@ def make_allocation_record(employee=None, leave_type=None):
|
|||||||
def get_employee():
|
def get_employee():
|
||||||
return frappe.get_doc("Employee", "_T-Employee-00001")
|
return frappe.get_doc("Employee", "_T-Employee-00001")
|
||||||
|
|
||||||
|
def set_leave_approver():
|
||||||
|
employee = get_employee()
|
||||||
|
dept_doc = frappe.get_doc("Department", employee.department)
|
||||||
|
dept_doc.append('leave_approver', {
|
||||||
|
'approver': 'test@example.com'
|
||||||
|
})
|
||||||
|
dept_doc.save(ignore_permissions=True)
|
||||||
|
|
||||||
def get_leave_period():
|
def get_leave_period():
|
||||||
leave_period_name = frappe.db.exists({
|
leave_period_name = frappe.db.exists({
|
||||||
"doctype": "Leave Period",
|
"doctype": "Leave Period",
|
||||||
@ -449,7 +415,7 @@ def get_leave_period():
|
|||||||
)).insert()
|
)).insert()
|
||||||
|
|
||||||
def allocate_leaves(employee, leave_period, leave_type, new_leaves_allocated, eligible_leaves=0):
|
def allocate_leaves(employee, leave_period, leave_type, new_leaves_allocated, eligible_leaves=0):
|
||||||
frappe.get_doc({
|
allocate_leave = frappe.get_doc({
|
||||||
"doctype": "Leave Allocation",
|
"doctype": "Leave Allocation",
|
||||||
"__islocal": 1,
|
"__islocal": 1,
|
||||||
"employee": employee.name,
|
"employee": employee.name,
|
||||||
@ -460,3 +426,6 @@ def allocate_leaves(employee, leave_period, leave_type, new_leaves_allocated, el
|
|||||||
"new_leaves_allocated": new_leaves_allocated,
|
"new_leaves_allocated": new_leaves_allocated,
|
||||||
"docstatus": 1
|
"docstatus": 1
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
|
allocate_leave.submit()
|
||||||
|
|
||||||
|
|||||||
@ -89,11 +89,11 @@ def get_regional_address_details(out, doctype, company):
|
|||||||
|
|
||||||
if doctype in ("Sales Invoice", "Delivery Note"):
|
if doctype in ("Sales Invoice", "Delivery Note"):
|
||||||
master_doctype = "Sales Taxes and Charges Template"
|
master_doctype = "Sales Taxes and Charges Template"
|
||||||
if not (out.company_gstin or out.place_of_supply):
|
if not out.company_gstin:
|
||||||
return
|
return
|
||||||
else:
|
elif doctype == "Purchase Invoice":
|
||||||
master_doctype = "Purchase Taxes and Charges Template"
|
master_doctype = "Purchase Taxes and Charges Template"
|
||||||
if not (out.supplier_gstin or out.place_of_supply):
|
if not out.supplier_gstin:
|
||||||
return
|
return
|
||||||
|
|
||||||
if ((doctype in ("Sales Invoice", "Delivery Note") and out.company_gstin
|
if ((doctype in ("Sales Invoice", "Delivery Note") and out.company_gstin
|
||||||
|
|||||||
@ -23,7 +23,7 @@ class TestBatch(unittest.TestCase):
|
|||||||
def make_batch_item(cls, item_name):
|
def make_batch_item(cls, item_name):
|
||||||
from erpnext.stock.doctype.item.test_item import make_item
|
from erpnext.stock.doctype.item.test_item import make_item
|
||||||
if not frappe.db.exists(item_name):
|
if not frappe.db.exists(item_name):
|
||||||
return make_item(item_name, dict(has_batch_no = 1, create_new_batch = 1))
|
return make_item(item_name, dict(has_batch_no = 1, create_new_batch = 1, is_stock_item=1))
|
||||||
|
|
||||||
def test_purchase_receipt(self, batch_qty = 100):
|
def test_purchase_receipt(self, batch_qty = 100):
|
||||||
'''Test automated batch creation from Purchase Receipt'''
|
'''Test automated batch creation from Purchase Receipt'''
|
||||||
@ -36,7 +36,8 @@ class TestBatch(unittest.TestCase):
|
|||||||
dict(
|
dict(
|
||||||
item_code='ITEM-BATCH-1',
|
item_code='ITEM-BATCH-1',
|
||||||
qty=batch_qty,
|
qty=batch_qty,
|
||||||
rate=10
|
rate=10,
|
||||||
|
warehouse= 'Stores - WP'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
)).insert()
|
)).insert()
|
||||||
|
|||||||
@ -95,7 +95,6 @@ class TestPurchaseReceipt(unittest.TestCase):
|
|||||||
make_stock_entry(item_code="_Test Item", target="_Test Warehouse 1 - _TC", qty=100, basic_rate=100)
|
make_stock_entry(item_code="_Test Item", target="_Test Warehouse 1 - _TC", qty=100, basic_rate=100)
|
||||||
make_stock_entry(item_code="_Test Item Home Desktop 100", target="_Test Warehouse 1 - _TC",
|
make_stock_entry(item_code="_Test Item Home Desktop 100", target="_Test Warehouse 1 - _TC",
|
||||||
qty=100, basic_rate=100)
|
qty=100, basic_rate=100)
|
||||||
|
|
||||||
pr = make_purchase_receipt(item_code="_Test FG Item", qty=10, rate=500, is_subcontracted="Yes")
|
pr = make_purchase_receipt(item_code="_Test FG Item", qty=10, rate=500, is_subcontracted="Yes")
|
||||||
self.assertEqual(len(pr.get("supplied_items")), 2)
|
self.assertEqual(len(pr.get("supplied_items")), 2)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user