[bean] [mandatory] fixes in test cases
diff --git a/accounts/doctype/pos_setting/test_pos_setting.py b/accounts/doctype/pos_setting/test_pos_setting.py
index 2373f85..d6556ae 100644
--- a/accounts/doctype/pos_setting/test_pos_setting.py
+++ b/accounts/doctype/pos_setting/test_pos_setting.py
@@ -12,5 +12,6 @@
"income_account": "Sales - _TC",
"cost_center": "_Test Cost Center - _TC",
"expense_account": "_Test Account Cost for Goods Sold - _TC",
+ "naming_series": "_T-Sales Invoice-"
}]
]
\ No newline at end of file
diff --git a/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 2ae569b..55a6a81 100644
--- a/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -366,6 +366,7 @@
# parent
{
"doctype": "Purchase Invoice",
+ "naming_series": "_T-Purchase Invoice-",
"supplier_name": "_Test Supplier",
"credit_to": "_Test Supplier - _TC",
"bill_no": "NA",
diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py
index 777f515..db08a4f 100644
--- a/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -423,6 +423,7 @@
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 @@
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
diff --git a/accounts/doctype/shipping_rule/test_shipping_rule.py b/accounts/doctype/shipping_rule/test_shipping_rule.py
index 23d204d..fe11e2b 100644
--- a/accounts/doctype/shipping_rule/test_shipping_rule.py
+++ b/accounts/doctype/shipping_rule/test_shipping_rule.py
@@ -32,6 +32,7 @@
[
{
"doctype": "Shipping Rule",
+ "label": "_Test Shipping Rule",
"calculate_based_on": "Net Total",
"company": "_Test Company",
"account": "_Test Account Shipping Charges - _TC",
diff --git a/buying/doctype/purchase_order/test_purchase_order.py b/buying/doctype/purchase_order/test_purchase_order.py
index e70de97..aa3e8c4 100644
--- a/buying/doctype/purchase_order/test_purchase_order.py
+++ b/buying/doctype/purchase_order/test_purchase_order.py
@@ -37,6 +37,7 @@
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 @@
[
{
"company": "_Test Company",
+ "naming_series": "_T-Purchase Order-",
"conversion_rate": 1.0,
"currency": "INR",
"doctype": "Purchase Order",
@@ -86,7 +88,6 @@
"net_total": 5000.0,
"grand_total": 5000.0,
"grand_total_import": 5000.0,
-
},
{
"conversion_factor": 1.0,
@@ -101,6 +102,7 @@
"warehouse": "_Test Warehouse",
"stock_uom": "Nos",
"uom": "_Test UOM",
+ "schedule_date": "2013-03-01"
}
],
]
\ No newline at end of file
diff --git a/buying/doctype/supplier_quotation/test_supplier_quotation.py b/buying/doctype/supplier_quotation/test_supplier_quotation.py
index 7e772cc..540662d 100644
--- a/buying/doctype/supplier_quotation/test_supplier_quotation.py
+++ b/buying/doctype/supplier_quotation/test_supplier_quotation.py
@@ -36,6 +36,12 @@
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 @@
"net_total": 5000.0,
"grand_total": 5000.0,
"grand_total_import": 5000.0,
-
+ "naming_series": "_T-Supplier Quotation-"
},
{
"description": "_Test FG Item",
diff --git a/manufacturing/doctype/bom/bom.txt b/manufacturing/doctype/bom/bom.txt
index e677302..693f17d 100644
--- a/manufacturing/doctype/bom/bom.txt
+++ b/manufacturing/doctype/bom/bom.txt
@@ -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",
diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py
index 4dde84a..a97611e 100644
--- a/selling/doctype/lead/lead.py
+++ b/selling/doctype/lead/lead.py
@@ -100,7 +100,17 @@
@webnotes.whitelist()
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 @@
"contact_no": "phone_1",
"fax": "fax_1"
}
- }}, target_doclist)
+ }}, target_doclist, set_missing_values)
return [d.fields for d in doclist]
diff --git a/selling/doctype/lead/test_lead.py b/selling/doctype/lead/test_lead.py
index 3fc177f..3893a3f 100644
--- a/selling/doctype/lead/test_lead.py
+++ b/selling/doctype/lead/test_lead.py
@@ -2,7 +2,7 @@
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",
@@ -21,6 +21,7 @@
customer = make_customer("_T-Lead-00001")
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()
\ No newline at end of file
diff --git a/selling/doctype/quotation/test_quotation.py b/selling/doctype/quotation/test_quotation.py
index de609b8..49fa736 100644
--- a/selling/doctype/quotation/test_quotation.py
+++ b/selling/doctype/quotation/test_quotation.py
@@ -22,9 +22,7 @@
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 @@
"company": "_Test Company",
"conversion_rate": 1.0,
"currency": "INR",
+ "quotation_to": "Customer",
"customer": "_Test Customer",
"customer_name": "_Test Customer",
"customer_group": "_Test Customer Group",
diff --git a/selling/doctype/sales_order/test_sales_order.py b/selling/doctype/sales_order/test_sales_order.py
index dd0cd44..19b888e 100644
--- a/selling/doctype/sales_order/test_sales_order.py
+++ b/selling/doctype/sales_order/test_sales_order.py
@@ -290,6 +290,7 @@
"transaction_date": "2013-02-21",
"grand_total": 1000.0,
"grand_total_export": 1000.0,
+ "naming_series": "_T-Sales Order-"
},
{
"description": "CPU",
diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py
index 446d602..054dea9 100644
--- a/setup/doctype/company/company.py
+++ b/setup/doctype/company/company.py
@@ -228,6 +228,10 @@
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)
diff --git a/startup/install.py b/startup/install.py
index dfe03b2..de60e38 100644
--- a/startup/install.py
+++ b/startup/install.py
@@ -169,7 +169,14 @@
{'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()
\ No newline at end of file
diff --git a/stock/doctype/delivery_note/test_delivery_note.py b/stock/doctype/delivery_note/test_delivery_note.py
index 287d05b..a8ff87e 100644
--- a/stock/doctype/delivery_note/test_delivery_note.py
+++ b/stock/doctype/delivery_note/test_delivery_note.py
@@ -109,6 +109,7 @@
"net_total": 500.0,
"grand_total": 500.0,
"grand_total_export": 500.0,
+ "naming_series": "_T-Delivery Note-"
},
{
"description": "CPU",
diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt
index 54725a1..ff9c564 100644
--- a/stock/doctype/item/item.txt
+++ b/stock/doctype/item/item.txt
@@ -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
},
diff --git a/stock/doctype/item/test_item.py b/stock/doctype/item/test_item.py
index 38f1d97..042363d 100644
--- a/stock/doctype/item/test_item.py
+++ b/stock/doctype/item/test_item.py
@@ -69,7 +69,8 @@
"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",
diff --git a/stock/doctype/material_request/material_request.txt b/stock/doctype/material_request/material_request.txt
index a5907c7..a65e546 100644
--- a/stock/doctype/material_request/material_request.txt
+++ b/stock/doctype/material_request/material_request.txt
@@ -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",
diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py
index 0efc3b0..5d22168 100644
--- a/stock/doctype/material_request/test_material_request.py
+++ b/stock/doctype/material_request/test_material_request.py
@@ -321,7 +321,8 @@
"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",
diff --git a/stock/doctype/purchase_receipt/test_purchase_receipt.py b/stock/doctype/purchase_receipt/test_purchase_receipt.py
index 9540f78..e754e69 100644
--- a/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -102,6 +102,7 @@
"supplier": "_Test Supplier",
"net_total": 500.0,
"grand_total": 720.0,
+ "naming_series": "_T-Purchase Receipt-",
},
{
"conversion_factor": 1.0,
diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py
index 9051d6b..6816860 100644
--- a/stock/doctype/stock_entry/test_stock_entry.py
+++ b/stock/doctype/stock_entry/test_stock_entry.py
@@ -278,7 +278,9 @@
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 @@
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 @@
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 @@
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