[material requests] [tests]
This commit is contained in:
parent
a2a1ec765b
commit
886c9ef5d1
@ -44,23 +44,13 @@ class DocType(BuyingController):
|
||||
utilities.validate_status(self.doc.status, ["Draft", "Submitted", "Stopped",
|
||||
"Cancelled"])
|
||||
|
||||
# Step 2:=> get Purchase Common Obj
|
||||
pc_obj = get_obj(dt='Purchase Common')
|
||||
|
||||
|
||||
# Step 4:=> validate for items
|
||||
pc_obj.validate_for_items(self)
|
||||
|
||||
# Get po date
|
||||
pc_obj.get_prevdoc_date(self)
|
||||
|
||||
# validate_doc
|
||||
self.validate_doc(pc_obj)
|
||||
|
||||
# Check for stopped status
|
||||
self.check_for_stopped_status(pc_obj)
|
||||
|
||||
# sub-contracting
|
||||
self.validate_for_subcontracting()
|
||||
self.update_raw_materials_supplied("po_raw_material_details")
|
||||
|
||||
|
@ -36,6 +36,8 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
self.assertEquals(po[0]["doctype"], "Purchase Order")
|
||||
self.assertEquals(len(po), len(sq.doclist))
|
||||
|
||||
webnotes.bean(po).insert()
|
||||
|
||||
test_records = [
|
||||
[
|
||||
{
|
||||
@ -45,7 +47,7 @@ test_records = [
|
||||
"doctype": "Supplier Quotation",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"transaction_date": "2013-02-12",
|
||||
"is_subcontracted": "Yes",
|
||||
"is_subcontracted": "No",
|
||||
"supplier": "_Test Supplier",
|
||||
"supplier_name": "_Test Supplier",
|
||||
"net_total": 5000.0,
|
||||
|
@ -34,6 +34,9 @@ class BuyingController(StockController):
|
||||
|
||||
def validate(self):
|
||||
super(BuyingController, self).validate()
|
||||
if self.doc.supplier and not self.doc.supplier_name:
|
||||
self.doc.supplier_name = webnotes.conn.get_value("Supplier",
|
||||
self.doc.supplier, "supplier_name")
|
||||
self.validate_stock_or_nonstock_items()
|
||||
self.validate_warehouse_belongs_to_company()
|
||||
|
||||
|
@ -6,6 +6,9 @@ import webnotes, unittest
|
||||
from webnotes.utils import flt
|
||||
|
||||
class TestMaterialRequest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
|
||||
|
||||
def test_make_purchase_order(self):
|
||||
from stock.doctype.material_request.material_request import make_purchase_order
|
||||
|
||||
@ -118,6 +121,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
# map a purchase order
|
||||
from stock.doctype.material_request.material_request import make_purchase_order
|
||||
po_doclist = make_purchase_order(mr.doc.name)
|
||||
po_doclist[0].supplier = "_Test Supplier"
|
||||
po_doclist[1].qty = 27.0
|
||||
po_doclist[2].qty = 1.5
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user