refactored code for reserved qty with testcases

This commit is contained in:
Nabin Hait
2013-02-22 12:44:51 +05:30
parent c924c1ebb5
commit 87d270a5b5
6 changed files with 284 additions and 81 deletions

View File

@@ -319,9 +319,9 @@ class DocType(SellingController):
webnotes.msgprint("%s Packing Slip(s) Cancelled" % res[0][1])
def update_stock_ledger(self, update_stock, is_stopped = 0):
def update_stock_ledger(self, update_stock):
self.values = []
for d in self.get_item_list(is_stopped):
for d in self.get_item_list():
if webnotes.conn.get_value("Item", d['item_code'], "is_stock_item") == "Yes":
if not d['warehouse']:
msgprint("Please enter Warehouse for item %s as it is stock item"
@@ -344,8 +344,8 @@ class DocType(SellingController):
get_obj('Stock Ledger', 'Stock Ledger').update_stock(self.values)
def get_item_list(self, is_stopped):
return get_obj('Sales Common').get_item_list(self, is_stopped)
def get_item_list(self):
return get_obj('Sales Common').get_item_list(self)
def make_sl_entry(self, d, wh, qty, in_value, update_stock):

View File

@@ -145,4 +145,23 @@ test_records = [
"is_sub_contracted_item": "No",
"stock_uom": "_Test UOM"
}],
[{
"doctype": "Item",
"item_code": "_Test Sales BOM Item",
"item_name": "_Test Sales BOM Item",
"description": "_Test Sales BOM Item",
"item_group": "_Test Item Group Desktops",
"is_stock_item": "No",
"is_asset_item": "No",
"has_batch_no": "No",
"has_serial_no": "No",
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "No",
"is_sub_contracted_item": "No",
"stock_uom": "_Test UOM"
}],
]

View File

@@ -0,0 +1,20 @@
test_records = [
[
{
"doctype": "Sales BOM",
"new_item_code": "_Test Sales BOM Item"
},
{
"doctype": "Sales BOM Item",
"item_code": "_Test Item",
"parentfield": "sales_bom_items",
"qty": 5.0
},
{
"doctype": "Sales BOM Item",
"item_code": "_Test Item Home Desktop 100",
"parentfield": "sales_bom_items",
"qty": 2.0
}
],
]