[bean] [mandatory] fixes in test cases
This commit is contained in:
parent
2862c9e1df
commit
4ee647e84c
@ -12,5 +12,6 @@ test_records = [
|
||||
"income_account": "Sales - _TC",
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"naming_series": "_T-Sales Invoice-"
|
||||
}]
|
||||
]
|
@ -366,6 +366,7 @@ test_records = [
|
||||
# parent
|
||||
{
|
||||
"doctype": "Purchase Invoice",
|
||||
"naming_series": "_T-Purchase Invoice-",
|
||||
"supplier_name": "_Test Supplier",
|
||||
"credit_to": "_Test Supplier - _TC",
|
||||
"bill_no": "NA",
|
||||
|
@ -423,6 +423,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
from stock.doctype.purchase_receipt.test_purchase_receipt import test_records \
|
||||
as pr_test_records
|
||||
pr = webnotes.bean(copy=pr_test_records[0])
|
||||
pr.doc.naming_series = "_T-Purchase Receipt-"
|
||||
pr.run_method("calculate_taxes_and_totals")
|
||||
pr.insert()
|
||||
pr.submit()
|
||||
@ -431,6 +432,7 @@ class TestSalesInvoice(unittest.TestCase):
|
||||
from stock.doctype.delivery_note.test_delivery_note import test_records \
|
||||
as dn_test_records
|
||||
dn = webnotes.bean(copy=dn_test_records[0])
|
||||
dn.doc.naming_series = "_T-Delivery Note-"
|
||||
dn.insert()
|
||||
dn.submit()
|
||||
return dn
|
||||
|
@ -32,6 +32,7 @@ test_records = [
|
||||
[
|
||||
{
|
||||
"doctype": "Shipping Rule",
|
||||
"label": "_Test Shipping Rule",
|
||||
"calculate_based_on": "Net Total",
|
||||
"company": "_Test Company",
|
||||
"account": "_Test Account Shipping Charges - _TC",
|
||||
|
@ -37,6 +37,7 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
self.assertEquals(pr[0]["doctype"], "Purchase Receipt")
|
||||
self.assertEquals(len(pr), len(test_records[0]))
|
||||
|
||||
pr[0].naming_series = "_T-Purchase Receipt-"
|
||||
webnotes.bean(pr).insert()
|
||||
|
||||
def test_make_purchase_invocie(self):
|
||||
@ -75,6 +76,7 @@ test_records = [
|
||||
[
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"naming_series": "_T-Purchase Order-",
|
||||
"conversion_rate": 1.0,
|
||||
"currency": "INR",
|
||||
"doctype": "Purchase Order",
|
||||
@ -86,7 +88,6 @@ test_records = [
|
||||
"net_total": 5000.0,
|
||||
"grand_total": 5000.0,
|
||||
"grand_total_import": 5000.0,
|
||||
|
||||
},
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
@ -101,6 +102,7 @@ test_records = [
|
||||
"warehouse": "_Test Warehouse",
|
||||
"stock_uom": "Nos",
|
||||
"uom": "_Test UOM",
|
||||
"schedule_date": "2013-03-01"
|
||||
}
|
||||
],
|
||||
]
|
@ -36,6 +36,12 @@ class TestPurchaseOrder(unittest.TestCase):
|
||||
self.assertEquals(po[0]["doctype"], "Purchase Order")
|
||||
self.assertEquals(len(po), len(sq.doclist))
|
||||
|
||||
po[0]["naming_series"] = "_T-Purchase Order-"
|
||||
|
||||
for doc in po:
|
||||
if doc.parentfield=="purchase_order_items":
|
||||
doc.schedule_date = "2013-04-12"
|
||||
|
||||
webnotes.bean(po).insert()
|
||||
|
||||
test_records = [
|
||||
@ -53,7 +59,7 @@ test_records = [
|
||||
"net_total": 5000.0,
|
||||
"grand_total": 5000.0,
|
||||
"grand_total_import": 5000.0,
|
||||
|
||||
"naming_series": "_T-Supplier Quotation-"
|
||||
},
|
||||
{
|
||||
"description": "_Test FG Item",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-22 15:11:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:27:38",
|
||||
"modified": "2013-07-08 16:18:33",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -247,7 +247,6 @@
|
||||
"print_hide": 0
|
||||
},
|
||||
{
|
||||
"default": "No Toolbar",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "flat_bom_details",
|
||||
"fieldtype": "Table",
|
||||
|
@ -101,6 +101,16 @@ class DocType(SellingController):
|
||||
def make_customer(source_name, target_doclist=None):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
def set_missing_values(source, target):
|
||||
if source.doc.company_name:
|
||||
target[0].customer_type = "Company"
|
||||
target[0].customer_name = source.doc.company_name
|
||||
else:
|
||||
target[0].customer_type = "Individual"
|
||||
target[0].customer_name = source.doc.lead_name
|
||||
|
||||
target[0].customer_group = webnotes.conn.get_default("customer_group")
|
||||
|
||||
doclist = get_mapped_doclist("Lead", source_name,
|
||||
{"Lead": {
|
||||
"doctype": "Customer",
|
||||
@ -110,7 +120,7 @@ def make_customer(source_name, target_doclist=None):
|
||||
"contact_no": "phone_1",
|
||||
"fax": "fax_1"
|
||||
}
|
||||
}}, target_doclist)
|
||||
}}, target_doclist, set_missing_values)
|
||||
|
||||
return [d.fields for d in doclist]
|
||||
|
||||
|
@ -2,7 +2,7 @@ from __future__ import unicode_literals
|
||||
|
||||
test_records = [
|
||||
[{"doctype":"Lead", "lead_name": "_Test Lead", "status":"Open",
|
||||
"email_id":"test_lead@example.com"}],
|
||||
"email_id":"test_lead@example.com", "territory": "_Test Territory"}],
|
||||
[{"doctype":"Lead", "lead_name": "_Test Lead 1", "status":"Open",
|
||||
"email_id":"test_lead1@example.com"}],
|
||||
[{"doctype":"Lead", "lead_name": "_Test Lead 2", "status":"Contacted",
|
||||
@ -22,5 +22,6 @@ class TestLead(unittest.TestCase):
|
||||
self.assertEquals(customer[0]["doctype"], "Customer")
|
||||
self.assertEquals(customer[0]["lead_name"], "_T-Lead-00001")
|
||||
|
||||
customer[0].customer_group = "_Test Customer Group"
|
||||
webnotes.bean(customer).insert()
|
||||
|
@ -22,9 +22,7 @@ class TestQuotation(unittest.TestCase):
|
||||
self.assertEquals(sales_order[0]["customer"], "_Test Customer")
|
||||
|
||||
sales_order[0]["delivery_date"] = "2014-01-01"
|
||||
|
||||
|
||||
webnotes.print_messages = True
|
||||
sales_order[0]["naming_series"] = "_T-Quotation-"
|
||||
webnotes.bean(sales_order).insert()
|
||||
|
||||
|
||||
@ -34,6 +32,7 @@ test_records = [
|
||||
"company": "_Test Company",
|
||||
"conversion_rate": 1.0,
|
||||
"currency": "INR",
|
||||
"quotation_to": "Customer",
|
||||
"customer": "_Test Customer",
|
||||
"customer_name": "_Test Customer",
|
||||
"customer_group": "_Test Customer Group",
|
||||
|
@ -290,6 +290,7 @@ test_records = [
|
||||
"transaction_date": "2013-02-21",
|
||||
"grand_total": 1000.0,
|
||||
"grand_total_export": 1000.0,
|
||||
"naming_series": "_T-Sales Order-"
|
||||
},
|
||||
{
|
||||
"description": "CPU",
|
||||
|
@ -228,6 +228,10 @@ class DocType:
|
||||
cc.update({"doctype": "Cost Center"})
|
||||
cc_bean = webnotes.bean(cc)
|
||||
cc_bean.ignore_permissions = True
|
||||
|
||||
if cc.get("cost_center_name") == self.doc.name:
|
||||
cc_bean.ignore_mandatory = True
|
||||
|
||||
cc_bean.insert()
|
||||
|
||||
webnotes.conn.set(self.doc, "cost_center", "Main - " + self.doc.abbr)
|
||||
|
@ -169,7 +169,14 @@ def import_defaults():
|
||||
{'uom_name': 'Minute', 'doctype': 'UOM', 'name': 'Minute'},
|
||||
]
|
||||
|
||||
from webnotes.modules import scrub
|
||||
for r in records:
|
||||
if not webnotes.conn.exists(r['doctype'], r['name']):
|
||||
bean = webnotes.bean(r)
|
||||
|
||||
# ignore mandatory for root
|
||||
parent_link_field = ("parent_" + scrub(bean.doc.doctype))
|
||||
if parent_link_field in bean.doc.fields and not bean.doc.fields.get(parent_link_field):
|
||||
bean.ignore_mandatory = True
|
||||
|
||||
bean.insert()
|
@ -109,6 +109,7 @@ test_records = [
|
||||
"net_total": 500.0,
|
||||
"grand_total": 500.0,
|
||||
"grand_total_export": 500.0,
|
||||
"naming_series": "_T-Delivery Note-"
|
||||
},
|
||||
{
|
||||
"description": "CPU",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-03 10:45:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 16:24:34",
|
||||
"modified": "2013-07-08 14:05:47",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -202,7 +202,7 @@
|
||||
"label": "Is Stock Item",
|
||||
"oldfieldname": "is_stock_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -270,7 +270,7 @@
|
||||
"label": "Is Asset Item",
|
||||
"oldfieldname": "is_asset_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -283,7 +283,7 @@
|
||||
"label": "Has Batch No",
|
||||
"oldfieldname": "has_batch_no",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -298,7 +298,7 @@
|
||||
"label": "Has Serial No",
|
||||
"oldfieldname": "has_serial_no",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -399,7 +399,7 @@
|
||||
"label": "Is Purchase Item",
|
||||
"oldfieldname": "is_purchase_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -525,7 +525,7 @@
|
||||
"label": "Is Sales Item",
|
||||
"oldfieldname": "is_sales_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -540,7 +540,7 @@
|
||||
"label": "Is Service Item",
|
||||
"oldfieldname": "is_service_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -554,7 +554,7 @@
|
||||
"label": "Allow Samples",
|
||||
"oldfieldname": "is_sample_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -706,7 +706,7 @@
|
||||
"label": "Allow Bill of Materials",
|
||||
"oldfieldname": "is_manufactured_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -732,7 +732,7 @@
|
||||
"label": "Allow Production Order",
|
||||
"oldfieldname": "is_pro_applicable",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -745,7 +745,7 @@
|
||||
"label": "Is Sub Contracted Item",
|
||||
"oldfieldname": "is_sub_contracted_item",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"options": "Yes\nNo",
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
|
@ -69,7 +69,8 @@ test_records = [
|
||||
"parentfield": "item_reorder",
|
||||
"warehouse": "_Test Warehouse",
|
||||
"warehouse_reorder_level": 20,
|
||||
"warehouse_reorder_qty": 20
|
||||
"warehouse_reorder_qty": 20,
|
||||
"material_request_type": "Purchase"
|
||||
}, {
|
||||
"doctype": "Item Price",
|
||||
"parentfield": "ref_rate_details",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 14:48:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-08 11:02:12",
|
||||
"modified": "2013-07-08 16:17:33",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -137,7 +137,7 @@
|
||||
"label": "Pull Sales Order Items"
|
||||
},
|
||||
{
|
||||
"default": "Give additional details about the indent.",
|
||||
"description": "Give additional details about the indent.",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "more_info",
|
||||
"fieldtype": "Section Break",
|
||||
|
@ -321,7 +321,8 @@ test_records = [
|
||||
"doctype": "Material Request",
|
||||
"fiscal_year": "_Test Fiscal Year 2013",
|
||||
"transaction_date": "2013-02-18",
|
||||
"material_request_type": "Purchase"
|
||||
"material_request_type": "Purchase",
|
||||
"naming_series": "_T-Material Request-"
|
||||
},
|
||||
{
|
||||
"description": "_Test Item Home Desktop 100",
|
||||
|
@ -102,6 +102,7 @@ test_records = [
|
||||
"supplier": "_Test Supplier",
|
||||
"net_total": 500.0,
|
||||
"grand_total": 720.0,
|
||||
"naming_series": "_T-Purchase Receipt-",
|
||||
},
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
|
@ -278,7 +278,9 @@ class TestStockEntry(unittest.TestCase):
|
||||
self._insert_material_receipt()
|
||||
|
||||
from stock.doctype.delivery_note.test_delivery_note \
|
||||
import test_records as delivery_note_test_records, make_sales_invoice
|
||||
import test_records as delivery_note_test_records
|
||||
|
||||
from stock.doctype.delivery_note.delivery_note import make_sales_invoice
|
||||
|
||||
actual_qty_0 = self._get_actual_qty()
|
||||
|
||||
@ -362,8 +364,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
self._insert_material_receipt()
|
||||
|
||||
from selling.doctype.sales_order.test_sales_order \
|
||||
import test_records as sales_order_test_records,
|
||||
make_sales_invoice, make_delivery_note
|
||||
import test_records as sales_order_test_records, make_sales_invoice, make_delivery_note
|
||||
|
||||
actual_qty_0 = self._get_actual_qty()
|
||||
|
||||
@ -418,8 +419,9 @@ class TestStockEntry(unittest.TestCase):
|
||||
actual_qty_0 = self._get_actual_qty()
|
||||
|
||||
from stock.doctype.purchase_receipt.test_purchase_receipt \
|
||||
import test_records as purchase_receipt_test_records,
|
||||
make_purchase_invoice
|
||||
import test_records as purchase_receipt_test_records
|
||||
|
||||
from stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
|
||||
|
||||
# submit purchase receipt
|
||||
pr = webnotes.bean(copy=purchase_receipt_test_records[0])
|
||||
@ -506,7 +508,9 @@ class TestStockEntry(unittest.TestCase):
|
||||
actual_qty_0 = self._get_actual_qty()
|
||||
|
||||
from buying.doctype.purchase_order.test_purchase_order \
|
||||
import test_records as purchase_order_test_records,
|
||||
import test_records as purchase_order_test_records
|
||||
|
||||
from buying.doctype.purchase_order.purchase_order import \
|
||||
make_purchase_receipt, make_purchase_invoice
|
||||
|
||||
# submit purchase receipt
|
||||
|
Loading…
x
Reference in New Issue
Block a user