[Fix] Purchase receipt test cases
This commit is contained in:
parent
a6b346f827
commit
b6381c66d8
@ -339,6 +339,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"default": "Material Transferred for Subcontract",
|
||||||
"fieldname": "backflush_raw_materials_of_subcontract_based_on",
|
"fieldname": "backflush_raw_materials_of_subcontract_based_on",
|
||||||
"fieldtype": "Select",
|
"fieldtype": "Select",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -377,7 +378,7 @@
|
|||||||
"issingle": 1,
|
"issingle": 1,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-05-30 16:28:46.899823",
|
"modified": "2018-06-12 03:41:41.739193",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Buying Settings",
|
"name": "Buying Settings",
|
||||||
|
@ -33,7 +33,7 @@ class StockController(AccountsController):
|
|||||||
items, warehouses = self.get_items_and_warehouses()
|
items, warehouses = self.get_items_and_warehouses()
|
||||||
update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items,
|
update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items,
|
||||||
warehouse_account)
|
warehouse_account)
|
||||||
elif self.doctype in ['Purchase Receipt', 'Purchase Invoice']:
|
elif self.doctype in ['Purchase Receipt', 'Purchase Invoice'] and self.docstatus == 1:
|
||||||
gl_entries = []
|
gl_entries = []
|
||||||
gl_entries = self.get_asset_gl_entry(gl_entries)
|
gl_entries = self.get_asset_gl_entry(gl_entries)
|
||||||
make_gl_entries(gl_entries, from_repost=from_repost)
|
make_gl_entries(gl_entries, from_repost=from_repost)
|
||||||
|
@ -92,6 +92,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
|||||||
def test_subcontracting(self):
|
def test_subcontracting(self):
|
||||||
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
||||||
|
|
||||||
|
frappe.db.set_value("Buying Settings", None, "backflush_raw_materials_of_subcontract_based_on", "BOM")
|
||||||
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)
|
||||||
@ -314,9 +315,10 @@ class TestPurchaseReceipt(unittest.TestCase):
|
|||||||
|
|
||||||
asset_category = doc.name
|
asset_category = doc.name
|
||||||
|
|
||||||
asset_item = make_item(asset_item, {'is_stock_item':0,
|
item_data = make_item(asset_item, {'is_stock_item':0,
|
||||||
'stock_uom': 'Box', 'is_fixed_asset': 1, 'has_serial_no': 1,
|
'stock_uom': 'Box', 'is_fixed_asset': 1, 'has_serial_no': 1,
|
||||||
'asset_category': asset_category, 'serial_no_series': 'ABC.###'})
|
'asset_category': asset_category, 'serial_no_series': 'ABC.###'})
|
||||||
|
asset_item = item_data.item_code
|
||||||
|
|
||||||
if not frappe.db.exists('Location', 'Test Location'):
|
if not frappe.db.exists('Location', 'Test Location'):
|
||||||
frappe.get_doc({
|
frappe.get_doc({
|
||||||
@ -334,7 +336,6 @@ class TestPurchaseReceipt(unittest.TestCase):
|
|||||||
serial_nos = frappe.get_all('Serial No', {'asset': asset}, 'name') or []
|
serial_nos = frappe.get_all('Serial No', {'asset': asset}, 'name') or []
|
||||||
self.assertEquals(len(serial_nos), 0)
|
self.assertEquals(len(serial_nos), 0)
|
||||||
frappe.db.sql("delete from `tabLocation")
|
frappe.db.sql("delete from `tabLocation")
|
||||||
frappe.db.sql("delete from `tabAsset Category`")
|
|
||||||
frappe.db.sql("delete from `tabAsset`")
|
frappe.db.sql("delete from `tabAsset`")
|
||||||
|
|
||||||
def get_gl_entries(voucher_type, voucher_no):
|
def get_gl_entries(voucher_type, voucher_no):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user