Add (optional) Country field to Buying.Supplier DocType (fixes #5223)

Most companies have a headquarter country;
This commit is contained in:
Stavros Anastasiadis 2016-04-28 18:06:45 +03:00
parent 69d293db08
commit 5bd40db0ba
3 changed files with 49 additions and 1 deletions

View File

@ -89,6 +89,32 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "country",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Country",
"length": 0,
"no_copy": 0,
"options": "Country",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
@ -685,7 +711,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2016-04-13 05:47:43.797061",
"modified": "2016-04-28 17:36:44.742525",
"modified_by": "Administrator",
"module": "Buying",
"name": "Supplier",
@ -832,6 +858,7 @@
"write": 0
}
],
"quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"search_fields": "supplier_name, supplier_type",

View File

@ -1,4 +1,10 @@
[
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier with Country",
"supplier_type": "_Test Supplier Type",
"country": "Greece"
},
{
"doctype": "Supplier",
"supplier_name": "_Test Supplier",

View File

@ -70,3 +70,18 @@ class TestSupplier(unittest.TestCase):
frappe.db.set_value("Supplier", "_Test Supplier", "disabled", 0)
po.save()
def test_supplier_country(self):
# Test that country field exists in Supplier DocType
supplier = frappe.get_doc('Supplier', '_Test Supplier with Country')
self.assertTrue('country' in supplier.as_dict())
# Test if test supplier field record is 'Greece'
self.assertEqual(supplier.country, "Greece")
# Test update Supplier instance country value
supplier = frappe.get_doc('Supplier', '_Test Supplier')
supplier.country = 'Greece'
supplier.save()
self.assertEqual(supplier.country, "Greece")