Merge branch 'version-12-hotfix' into v12-hotfix-clear_pricing_rule_value

This commit is contained in:
Marica
2020-06-19 14:28:06 +05:30
committed by GitHub
20 changed files with 555 additions and 840 deletions

View File

@@ -25,6 +25,7 @@ class RequestforQuotation(BuyingController):
self.validate_duplicate_supplier() self.validate_duplicate_supplier()
self.validate_supplier_list() self.validate_supplier_list()
validate_for_items(self) validate_for_items(self)
super(RequestforQuotation, self).set_qty_as_per_stock_uom()
self.update_email_id() self.update_email_id()
def validate_duplicate_supplier(self): def validate_duplicate_supplier(self):
@@ -278,6 +279,7 @@ def create_rfq_items(sq_doc, supplier, data):
"description": data.description, "description": data.description,
"qty": data.qty, "qty": data.qty,
"rate": data.rate, "rate": data.rate,
"conversion_factor": data.conversion_factor if data.conversion_factor else None,
"supplier_part_no": frappe.db.get_value("Item Supplier", {'parent': data.item_code, 'supplier': supplier}, "supplier_part_no"), "supplier_part_no": frappe.db.get_value("Item Supplier", {'parent': data.item_code, 'supplier': supplier}, "supplier_part_no"),
"warehouse": data.warehouse or '', "warehouse": data.warehouse or '',
"request_for_quotation_item": data.name, "request_for_quotation_item": data.name,

View File

@@ -6,12 +6,14 @@ from __future__ import unicode_literals
import unittest import unittest
import frappe import frappe
from erpnext.templates.pages.rfq import check_supplier_has_docname_access
from frappe.utils import nowdate from frappe.utils import nowdate
from erpnext.stock.doctype.item.test_item import make_item
from erpnext.templates.pages.rfq import check_supplier_has_docname_access
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import create_supplier_quotation
class TestRequestforQuotation(unittest.TestCase): class TestRequestforQuotation(unittest.TestCase):
def test_quote_status(self): def test_quote_status(self):
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation
rfq = make_request_for_quotation() rfq = make_request_for_quotation()
self.assertEqual(rfq.get('suppliers')[0].quote_status, 'Pending') self.assertEqual(rfq.get('suppliers')[0].quote_status, 'Pending')
@@ -31,7 +33,6 @@ class TestRequestforQuotation(unittest.TestCase):
self.assertEqual(rfq.get('suppliers')[1].quote_status, 'No Quote') self.assertEqual(rfq.get('suppliers')[1].quote_status, 'No Quote')
def test_make_supplier_quotation(self): def test_make_supplier_quotation(self):
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation
rfq = make_request_for_quotation() rfq = make_request_for_quotation()
sq = make_supplier_quotation(rfq.name, rfq.get('suppliers')[0].supplier) sq = make_supplier_quotation(rfq.name, rfq.get('suppliers')[0].supplier)
@@ -51,15 +52,13 @@ class TestRequestforQuotation(unittest.TestCase):
self.assertEqual(sq1.get('items')[0].qty, 5) self.assertEqual(sq1.get('items')[0].qty, 5)
def test_make_supplier_quotation_with_special_characters(self): def test_make_supplier_quotation_with_special_characters(self):
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import make_supplier_quotation
frappe.delete_doc_if_exists("Supplier", "_Test Supplier '1", force=1) frappe.delete_doc_if_exists("Supplier", "_Test Supplier '1", force=1)
supplier = frappe.new_doc("Supplier") supplier = frappe.new_doc("Supplier")
supplier.supplier_name = "_Test Supplier '1" supplier.supplier_name = "_Test Supplier '1"
supplier.supplier_group = "_Test Supplier Group" supplier.supplier_group = "_Test Supplier Group"
supplier.insert() supplier.insert()
rfq = make_request_for_quotation(supplier_wt_appos) rfq = make_request_for_quotation(supplier_data=supplier_wt_appos)
sq = make_supplier_quotation(rfq.name, supplier_wt_appos[0].get("supplier")) sq = make_supplier_quotation(rfq.name, supplier_wt_appos[0].get("supplier"))
sq.submit() sq.submit()
@@ -76,7 +75,6 @@ class TestRequestforQuotation(unittest.TestCase):
frappe.form_dict.name = None frappe.form_dict.name = None
def test_make_supplier_quotation_from_portal(self): def test_make_supplier_quotation_from_portal(self):
from erpnext.buying.doctype.request_for_quotation.request_for_quotation import create_supplier_quotation
rfq = make_request_for_quotation() rfq = make_request_for_quotation()
rfq.get('items')[0].rate = 100 rfq.get('items')[0].rate = 100
rfq.supplier = rfq.suppliers[0].supplier rfq.supplier = rfq.suppliers[0].supplier
@@ -90,12 +88,34 @@ class TestRequestforQuotation(unittest.TestCase):
self.assertEqual(supplier_quotation_doc.get('items')[0].qty, 5) self.assertEqual(supplier_quotation_doc.get('items')[0].qty, 5)
self.assertEqual(supplier_quotation_doc.get('items')[0].amount, 500) self.assertEqual(supplier_quotation_doc.get('items')[0].amount, 500)
def test_make_multi_uom_supplier_quotation(self):
item_code = "_Test Multi UOM RFQ Item"
if not frappe.db.exists('Item', item_code):
item = make_item(item_code, {'stock_uom': '_Test UOM'})
row = item.append('uoms', {
'uom': 'Kg',
'conversion_factor': 2
})
row.db_update()
def make_request_for_quotation(supplier_data=None): rfq = make_request_for_quotation(item_code="_Test Multi UOM RFQ Item", uom="Kg", conversion_factor=2)
rfq.get('items')[0].rate = 100
rfq.supplier = rfq.suppliers[0].supplier
self.assertEqual(rfq.items[0].stock_qty, 10)
supplier_quotation_name = create_supplier_quotation(rfq)
supplier_quotation = frappe.get_doc('Supplier Quotation', supplier_quotation_name)
self.assertEqual(supplier_quotation.items[0].qty, 5)
self.assertEqual(supplier_quotation.items[0].stock_qty, 10)
def make_request_for_quotation(**args):
""" """
:param supplier_data: List containing supplier data :param supplier_data: List containing supplier data
""" """
supplier_data = supplier_data if supplier_data else get_supplier_data() args = frappe._dict(args)
supplier_data = args.get("supplier_data") if args.get("supplier_data") else get_supplier_data()
rfq = frappe.new_doc('Request for Quotation') rfq = frappe.new_doc('Request for Quotation')
rfq.transaction_date = nowdate() rfq.transaction_date = nowdate()
rfq.status = 'Draft' rfq.status = 'Draft'
@@ -106,11 +126,13 @@ def make_request_for_quotation(supplier_data=None):
rfq.append('suppliers', data) rfq.append('suppliers', data)
rfq.append("items", { rfq.append("items", {
"item_code": "_Test Item", "item_code": args.item_code or "_Test Item",
"description": "_Test Item", "description": "_Test Item",
"uom": "_Test UOM", "uom": args.uom or "_Test UOM",
"qty": 5, "stock_uom": args.stock_uom or "_Test UOM",
"warehouse": "_Test Warehouse - _TC", "qty": args.qty or 5,
"conversion_factor": args.conversion_factor or 1.0,
"warehouse": args.warehouse or "_Test Warehouse - _TC",
"schedule_date": nowdate() "schedule_date": nowdate()
}) })

View File

@@ -1,4 +1,5 @@
{ {
"actions": [],
"autoname": "hash", "autoname": "hash",
"creation": "2016-02-25 08:04:02.452958", "creation": "2016-02-25 08:04:02.452958",
"doctype": "DocType", "doctype": "DocType",
@@ -9,6 +10,7 @@
"supplier_part_no", "supplier_part_no",
"column_break_3", "column_break_3",
"item_name", "item_name",
"schedule_date",
"section_break_5", "section_break_5",
"description", "description",
"item_group", "item_group",
@@ -18,9 +20,11 @@
"image_view", "image_view",
"quantity", "quantity",
"qty", "qty",
"stock_uom",
"col_break2", "col_break2",
"schedule_date",
"uom", "uom",
"conversion_factor",
"stock_qty",
"warehouse_and_reference", "warehouse_and_reference",
"warehouse", "warehouse",
"project_name", "project_name",
@@ -33,7 +37,7 @@
"fields": [ "fields": [
{ {
"bold": 1, "bold": 1,
"columns": 3, "columns": 2,
"fieldname": "item_code", "fieldname": "item_code",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
@@ -98,7 +102,7 @@
{ {
"fieldname": "quantity", "fieldname": "quantity",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Quantity" "label": "Quantity & Stock"
}, },
{ {
"bold": 1, "bold": 1,
@@ -129,12 +133,12 @@
{ {
"fieldname": "uom", "fieldname": "uom",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1,
"label": "UOM", "label": "UOM",
"oldfieldname": "uom", "oldfieldname": "uom",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "UOM", "options": "UOM",
"print_width": "100px", "print_width": "100px",
"read_only": 1,
"reqd": 1, "reqd": 1,
"width": "100px" "width": "100px"
}, },
@@ -144,7 +148,7 @@
"label": "Warehouse and Reference" "label": "Warehouse and Reference"
}, },
{ {
"columns": 3, "columns": 2,
"fieldname": "warehouse", "fieldname": "warehouse",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
@@ -202,6 +206,7 @@
}, },
{ {
"allow_on_submit": 1, "allow_on_submit": 1,
"default": "0",
"fieldname": "page_break", "fieldname": "page_break",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Page Break", "label": "Page Break",
@@ -219,10 +224,36 @@
{ {
"fieldname": "section_break_23", "fieldname": "section_break_23",
"fieldtype": "Section Break" "fieldtype": "Section Break"
},
{
"fieldname": "stock_uom",
"fieldtype": "Link",
"label": "Stock UOM",
"options": "UOM",
"print_hide": 1,
"read_only": 1,
"reqd": 1
},
{
"fieldname": "conversion_factor",
"fieldtype": "Float",
"label": "UOM Conversion Factor",
"print_hide": 1,
"read_only": 1,
"reqd": 1
},
{
"fieldname": "stock_qty",
"fieldtype": "Float",
"label": "Qty as per Stock UOM",
"no_copy": 1,
"print_hide": 1,
"read_only": 1
} }
], ],
"istable": 1, "istable": 1,
"modified": "2019-05-01 17:50:23.703801", "links": [],
"modified": "2020-06-12 19:10:36.333441",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Buying", "module": "Buying",
"name": "Request for Quotation Item", "name": "Request for Quotation Item",

View File

@@ -1,398 +1,119 @@
{ {
"allow_copy": 0, "actions": [],
"allow_guest_to_view": 1, "allow_guest_to_view": 1,
"allow_import": 0, "allow_rename": 1,
"allow_rename": 1, "creation": "2016-09-13 03:05:27.154713",
"autoname": "", "doctype": "DocType",
"beta": 0, "document_type": "Document",
"creation": "2016-09-13 03:05:27.154713", "editable_grid": 1,
"custom": 0, "engine": "InnoDB",
"docstatus": 0, "field_order": [
"doctype": "DocType", "title",
"document_type": "Document", "route",
"editable_grid": 1, "column_break_3",
"academic_year",
"admission_start_date",
"admission_end_date",
"published",
"enable_admission_application",
"section_break_5",
"program_details",
"introduction"
],
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "fieldname": "title",
"allow_on_submit": 0, "fieldtype": "Data",
"bold": 0, "label": "Title"
"collapsible": 0, },
"columns": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Title",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "route",
"allow_on_submit": 0, "fieldtype": "Data",
"bold": 0, "label": "Route",
"collapsible": 0, "no_copy": 1,
"columns": 0,
"depends_on": "",
"fieldname": "route",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Route",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 1 "unique": 1
}, },
{ {
"allow_bulk_edit": 0, "fieldname": "column_break_3",
"allow_on_submit": 0, "fieldtype": "Column Break"
"bold": 0, },
"collapsible": 0,
"columns": 0,
"fieldname": "application_form_route",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Application Form Route",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "academic_year",
"allow_on_submit": 0, "fieldtype": "Link",
"bold": 0, "in_list_view": 1,
"collapsible": 0, "in_standard_filter": 1,
"columns": 0, "label": "Academic Year",
"fieldname": "column_break_3", "no_copy": 1,
"fieldtype": "Column Break", "options": "Academic Year",
"hidden": 0, "reqd": 1
"ignore_user_permissions": 0, },
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "admission_start_date",
"allow_on_submit": 0, "fieldtype": "Date",
"bold": 0, "label": "Admission Start Date",
"collapsible": 0, "no_copy": 1
"columns": 0, },
"fieldname": "academic_year",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Academic Year",
"length": 0,
"no_copy": 1,
"options": "Academic Year",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 1,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "admission_end_date",
"allow_on_submit": 0, "fieldtype": "Date",
"bold": 0, "label": "Admission End Date",
"collapsible": 0, "no_copy": 1
"columns": 0, },
"fieldname": "admission_start_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Admission Start Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "default": "0",
"allow_on_submit": 0, "fieldname": "published",
"bold": 0, "fieldtype": "Check",
"collapsible": 0, "label": "Publish on website"
"columns": 0, },
"fieldname": "admission_end_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Admission End Date",
"length": 0,
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "section_break_5",
"allow_on_submit": 0, "fieldtype": "Section Break",
"bold": 0, "label": "Eligibility and Details"
"collapsible": 0, },
"columns": 0,
"fieldname": "published",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Publish on website",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "program_details",
"allow_on_submit": 0, "fieldtype": "Table",
"bold": 0, "label": "Eligibility and Details",
"collapsible": 0, "options": "Student Admission Program"
"columns": 0, },
"fieldname": "section_break_5",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Eligibility and Details",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "introduction",
"allow_on_submit": 0, "fieldtype": "Text Editor",
"bold": 0, "label": "Introduction"
"collapsible": 0, },
"columns": 0,
"fieldname": "program_details",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Eligibility and Details",
"length": 0,
"no_copy": 0,
"options": "Student Admission Program",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "default": "0",
"allow_on_submit": 0, "fieldname": "enable_admission_application",
"bold": 0, "fieldtype": "Check",
"collapsible": 0, "label": "Enable Admission Application"
"columns": 0,
"fieldname": "introduction",
"fieldtype": "Text Editor",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Introduction",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
} }
], ],
"has_web_view": 1, "has_web_view": 1,
"hide_heading": 0, "is_published_field": "published",
"hide_toolbar": 0, "links": [],
"idx": 0, "modified": "2020-06-15 20:18:38.591626",
"image_view": 0, "modified_by": "Administrator",
"in_create": 0, "module": "Education",
"is_published_field": "published", "name": "Student Admission",
"is_submittable": 0, "owner": "Administrator",
"issingle": 0,
"istable": 0,
"max_attachments": 0,
"modified": "2017-11-10 18:57:34.570376",
"modified_by": "Administrator",
"module": "Education",
"name": "Student Admission",
"name_case": "",
"owner": "Administrator",
"permissions": [ "permissions": [
{ {
"amend": 0, "create": 1,
"apply_user_permissions": 0, "delete": 1,
"cancel": 0, "email": 1,
"create": 1, "export": 1,
"delete": 1, "print": 1,
"email": 1, "read": 1,
"export": 1, "report": 1,
"if_owner": 0, "role": "Academics User",
"import": 0, "share": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 1,
"role": "Academics User",
"set_user_permissions": 0,
"share": 1,
"submit": 0,
"write": 1 "write": 1
} }
], ],
"quick_entry": 0, "restrict_to_domain": "Education",
"read_only": 0, "route": "admissions",
"read_only_onload": 0, "show_name_in_global_search": 1,
"restrict_to_domain": "Education", "sort_field": "modified",
"route": "admissions", "sort_order": "DESC",
"show_name_in_global_search": 1, "title_field": "title"
"sort_field": "modified",
"sort_order": "DESC",
"title_field": "title",
"track_changes": 0,
"track_seen": 0
} }

View File

@@ -43,8 +43,8 @@
<thead> <thead>
<tr class="active"> <tr class="active">
<th style="width: 90px">Program/Std.</th> <th style="width: 90px">Program/Std.</th>
<th style="width: 170px">Minumum Age(DOB)</th> <th style="width: 170px">Minumum Age</th>
<th style="width: 170px">Maximum Age(DOB)</th> <th style="width: 170px">Maximum Age</th>
<th style="width: 100px">Application Fee</th> <th style="width: 100px">Application Fee</th>
</tr> </tr>
</thead> </thead>
@@ -52,8 +52,8 @@
{% for row in program_details %} {% for row in program_details %}
<tr> <tr>
<td>{{ row.program }}</td> <td>{{ row.program }}</td>
<td>{{ row.minimum_age }}</td> <td>{{ row.min_age }}</td>
<td>{{ row.maximum_age }}</td> <td>{{ row.max_age }}</td>
<td>{{ row.application_fee }}</td> <td>{{ row.application_fee }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
@@ -61,12 +61,11 @@
</table> </table>
</div> </div>
{% endif %} {% endif %}
{%- if doc.enable_admission_application -%}
{%- if application_form_route -%}
<br> <br>
<p> <p>
<a class='btn btn-primary' <a class='btn btn-primary'
href='/{{ doc.application_form_route }}?new=1'> href='/student-applicant?new=1&student_admission={{doc.name}}'>
{{ _("Apply Now") }}</a> {{ _("Apply Now") }}</a>
</p> </p>
{% endif %} {% endif %}

View File

@@ -11,7 +11,7 @@ QUnit.test('Test: Student Admission', function(assert) {
{admission_start_date: '2016-04-20'}, {admission_start_date: '2016-04-20'},
{admission_end_date: '2016-05-31'}, {admission_end_date: '2016-05-31'},
{title: '2016-17 Admissions'}, {title: '2016-17 Admissions'},
{application_form_route: 'student-applicant'}, {enable_admission_application: 1},
{introduction: 'Test intro'}, {introduction: 'Test intro'},
{program_details: [ {program_details: [
[ [
@@ -28,7 +28,7 @@ QUnit.test('Test: Student Admission', function(assert) {
assert.ok(cur_frm.doc.admission_start_date == '2016-04-20'); assert.ok(cur_frm.doc.admission_start_date == '2016-04-20');
assert.ok(cur_frm.doc.admission_end_date == '2016-05-31'); assert.ok(cur_frm.doc.admission_end_date == '2016-05-31');
assert.ok(cur_frm.doc.title == '2016-17 Admissions'); assert.ok(cur_frm.doc.title == '2016-17 Admissions');
assert.ok(cur_frm.doc.application_form_route == 'student-applicant'); assert.ok(cur_frm.doc.enable_admission_application == 1);
assert.ok(cur_frm.doc.introduction == 'Test intro'); assert.ok(cur_frm.doc.introduction == 'Test intro');
assert.ok(cur_frm.doc.program_details[0].program == 'Standard Test', 'Program correctly selected'); assert.ok(cur_frm.doc.program_details[0].program == 'Standard Test', 'Program correctly selected');
assert.ok(cur_frm.doc.program_details[0].application_fee == 1000); assert.ok(cur_frm.doc.program_details[0].application_fee == 1000);

View File

@@ -1,237 +1,77 @@
{ {
"allow_copy": 0, "actions": [],
"allow_events_in_timeline": 0, "creation": "2017-09-15 12:59:43.207923",
"allow_guest_to_view": 0, "doctype": "DocType",
"allow_import": 0, "editable_grid": 1,
"allow_rename": 0, "engine": "InnoDB",
"autoname": "", "field_order": [
"beta": 0, "program",
"creation": "2017-09-15 12:59:43.207923", "min_age",
"custom": 0, "max_age",
"docstatus": 0, "column_break_4",
"doctype": "DocType", "application_fee",
"document_type": "", "applicant_naming_series"
"editable_grid": 1, ],
"engine": "InnoDB",
"fields": [ "fields": [
{ {
"allow_bulk_edit": 0, "fieldname": "program",
"allow_in_quick_entry": 0, "fieldtype": "Link",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Program",
"collapsible": 0, "options": "Program",
"columns": 0, "show_days": 1,
"fieldname": "program", "show_seconds": 1
"fieldtype": "Link", },
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Program",
"length": 0,
"no_copy": 0,
"options": "Program",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "column_break_4",
"allow_in_quick_entry": 0, "fieldtype": "Column Break",
"allow_on_submit": 0, "show_days": 1,
"bold": 0, "show_seconds": 1
"collapsible": 0, },
"columns": 0,
"fieldname": "minimum_age",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Minimum Age",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "application_fee",
"allow_in_quick_entry": 0, "fieldtype": "Currency",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Application Fee",
"collapsible": 0, "show_days": 1,
"columns": 0, "show_seconds": 1
"fieldname": "maximum_age", },
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Maximum Age",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "applicant_naming_series",
"allow_in_quick_entry": 0, "fieldtype": "Data",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Naming Series (for Student Applicant)",
"collapsible": 0, "show_days": 1,
"columns": 0, "show_seconds": 1
"fieldname": "column_break_4", },
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "min_age",
"allow_in_quick_entry": 0, "fieldtype": "Int",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Minimum Age",
"collapsible": 0, "show_days": 1,
"columns": 0, "show_seconds": 1
"fieldname": "application_fee", },
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Application Fee",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "fieldname": "max_age",
"allow_in_quick_entry": 0, "fieldtype": "Int",
"allow_on_submit": 0, "in_list_view": 1,
"bold": 0, "label": "Maximum Age",
"collapsible": 0, "show_days": 1,
"columns": 0, "show_seconds": 1
"fieldname": "applicant_naming_series",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 1,
"in_standard_filter": 0,
"label": "Naming Series (for Student Applicant)",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"translatable": 0,
"unique": 0
} }
], ],
"has_web_view": 0, "istable": 1,
"hide_heading": 0, "links": [],
"hide_toolbar": 0, "modified": "2020-06-10 23:06:30.037404",
"idx": 0, "modified_by": "Administrator",
"image_view": 0, "module": "Education",
"in_create": 0, "name": "Student Admission Program",
"is_submittable": 0, "owner": "Administrator",
"issingle": 0, "permissions": [],
"istable": 1, "quick_entry": 1,
"max_attachments": 0, "restrict_to_domain": "Education",
"modified": "2018-11-04 03:37:17.408427", "sort_field": "modified",
"modified_by": "Administrator", "sort_order": "DESC",
"module": "Education", "track_changes": 1
"name": "Student Admission Program",
"name_case": "",
"owner": "Administrator",
"permissions": [],
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
"restrict_to_domain": "Education",
"show_name_in_global_search": 0,
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1,
"track_seen": 0,
"track_views": 0
} }

View File

@@ -6,7 +6,7 @@ from __future__ import print_function, unicode_literals
import frappe import frappe
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import getdate from frappe.utils import getdate, add_years, nowdate, date_diff
class StudentApplicant(Document): class StudentApplicant(Document):
def autoname(self): def autoname(self):
@@ -30,6 +30,7 @@ class StudentApplicant(Document):
def validate(self): def validate(self):
self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name])) self.title = " ".join(filter(None, [self.first_name, self.middle_name, self.last_name]))
if self.student_admission and self.program and self.date_of_birth: if self.student_admission and self.program and self.date_of_birth:
self.validation_from_student_admission() self.validation_from_student_admission()
@@ -43,16 +44,16 @@ class StudentApplicant(Document):
frappe.throw(_("Please select Student Admission which is mandatory for the paid student applicant")) frappe.throw(_("Please select Student Admission which is mandatory for the paid student applicant"))
def validation_from_student_admission(self): def validation_from_student_admission(self):
student_admission = get_student_admission_data(self.student_admission, self.program) student_admission = get_student_admission_data(self.student_admission, self.program)
# different validation for minimum and maximum age so that either min/max can also work independently. if student_admission and student_admission.min_age and \
if student_admission and student_admission.minimum_age and \ date_diff(nowdate(), add_years(getdate(self.date_of_birth), student_admission.min_age)) < 0:
getdate(student_admission.minimum_age) < getdate(self.date_of_birth): frappe.throw(_("Not eligible for the admission in this program as per Date Of Birth"))
frappe.throw(_("Not eligible for the admission in this program as per DOB"))
if student_admission and student_admission.maximum_age and \ if student_admission and student_admission.max_age and \
getdate(student_admission.maximum_age) > getdate(self.date_of_birth): date_diff(nowdate(), add_years(getdate(self.date_of_birth), student_admission.max_age)) > 0:
frappe.throw(_("Not eligible for the admission in this program as per DOB")) frappe.throw(_("Not eligible for the admission in this program as per Date Of Birth"))
def on_payment_authorized(self, *args, **kwargs): def on_payment_authorized(self, *args, **kwargs):
@@ -60,10 +61,12 @@ class StudentApplicant(Document):
def get_student_admission_data(student_admission, program): def get_student_admission_data(student_admission, program):
student_admission = frappe.db.sql("""select sa.admission_start_date, sa.admission_end_date, student_admission = frappe.db.sql("""select sa.admission_start_date, sa.admission_end_date,
sap.program, sap.minimum_age, sap.maximum_age, sap.applicant_naming_series sap.program, sap.min_age, sap.max_age, sap.applicant_naming_series
from `tabStudent Admission` sa, `tabStudent Admission Program` sap from `tabStudent Admission` sa, `tabStudent Admission Program` sap
where sa.name = sap.parent and sa.name = %s and sap.program = %s""", (student_admission, program), as_dict=1) where sa.name = sap.parent and sa.name = %s and sap.program = %s""", (student_admission, program), as_dict=1)
if student_admission: if student_admission:
return student_admission[0] return student_admission[0]
else: else:

View File

@@ -1,200 +1,248 @@
{ {
"accept_payment": 0, "accept_payment": 0,
"allow_comments": 0, "allow_comments": 0,
"allow_delete": 0, "allow_delete": 0,
"allow_edit": 1, "allow_edit": 1,
"allow_incomplete": 0, "allow_incomplete": 0,
"allow_multiple": 1, "allow_multiple": 1,
"allow_print": 0, "allow_print": 0,
"amount": 0.0, "amount": 0.0,
"amount_based_on_field": 0, "amount_based_on_field": 0,
"creation": "2016-09-22 13:10:10.792735", "creation": "2016-09-22 13:10:10.792735",
"doc_type": "Student Applicant", "doc_type": "Student Applicant",
"docstatus": 0, "docstatus": 0,
"doctype": "Web Form", "doctype": "Web Form",
"idx": 0, "idx": 0,
"is_standard": 1, "is_standard": 1,
"login_required": 1, "login_required": 1,
"max_attachment_size": 0, "max_attachment_size": 0,
"modified": "2017-02-21 05:44:46.022738", "modified": "2020-06-11 22:53:45.875310",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Education", "module": "Education",
"name": "student-applicant", "name": "student-applicant",
"owner": "Administrator", "owner": "Administrator",
"payment_button_label": "Buy Now", "payment_button_label": "Buy Now",
"published": 1, "published": 1,
"route": "student-applicant", "route": "student-applicant",
"show_sidebar": 1, "route_to_success_link": 0,
"sidebar_items": [], "show_attachments": 0,
"success_url": "/student-applicant", "show_in_grid": 0,
"title": "Student Applicant", "show_sidebar": 1,
"sidebar_items": [],
"success_url": "/student-applicant",
"title": "Student Applicant",
"web_form_fields": [ "web_form_fields": [
{ {
"fieldname": "first_name", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "first_name",
"hidden": 0, "fieldtype": "Data",
"label": "First Name", "hidden": 0,
"max_length": 0, "label": "First Name",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 1 "read_only": 0,
}, "reqd": 1,
"show_in_filter": 0
},
{ {
"fieldname": "middle_name", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "middle_name",
"hidden": 0, "fieldtype": "Data",
"label": "Middle Name", "hidden": 0,
"max_length": 0, "label": "Middle Name",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "last_name", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "last_name",
"hidden": 0, "fieldtype": "Data",
"label": "Last Name", "hidden": 0,
"max_length": 0, "label": "Last Name",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "image", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "image",
"hidden": 0, "fieldtype": "Data",
"label": "Image", "hidden": 0,
"max_length": 0, "label": "Image",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "program", "allow_read_on_all_link_options": 0,
"fieldtype": "Link", "fieldname": "program",
"hidden": 0, "fieldtype": "Link",
"label": "Program", "hidden": 0,
"max_length": 0, "label": "Program",
"max_value": 0, "max_length": 0,
"options": "Program", "max_value": 0,
"read_only": 0, "options": "Program",
"reqd": 1 "read_only": 0,
}, "reqd": 1,
"show_in_filter": 0
},
{ {
"fieldname": "academic_year", "allow_read_on_all_link_options": 0,
"fieldtype": "Link", "fieldname": "academic_year",
"hidden": 0, "fieldtype": "Link",
"label": "Academic Year", "hidden": 0,
"max_length": 0, "label": "Academic Year",
"max_value": 0, "max_length": 0,
"options": "Academic Year", "max_value": 0,
"read_only": 0, "options": "Academic Year",
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "date_of_birth", "allow_read_on_all_link_options": 0,
"fieldtype": "Date", "fieldname": "date_of_birth",
"hidden": 0, "fieldtype": "Date",
"label": "Date of Birth", "hidden": 0,
"max_length": 0, "label": "Date of Birth",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "blood_group", "allow_read_on_all_link_options": 0,
"fieldtype": "Select", "fieldname": "blood_group",
"hidden": 0, "fieldtype": "Select",
"label": "Blood Group", "hidden": 0,
"max_length": 0, "label": "Blood Group",
"max_value": 0, "max_length": 0,
"options": "\nA+\nA-\nB+\nB-\nO+\nO-\nAB+\nAB-", "max_value": 0,
"read_only": 0, "options": "\nA+\nA-\nB+\nB-\nO+\nO-\nAB+\nAB-",
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "student_email_id", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "student_email_id",
"hidden": 0, "fieldtype": "Data",
"label": "Student Email ID", "hidden": 0,
"max_length": 0, "label": "Student Email ID",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "student_mobile_number", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "student_mobile_number",
"hidden": 0, "fieldtype": "Data",
"label": "Student Mobile Number", "hidden": 0,
"max_length": 0, "label": "Student Mobile Number",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"default": "INDIAN", "allow_read_on_all_link_options": 0,
"fieldname": "nationality", "default": "INDIAN",
"fieldtype": "Data", "fieldname": "nationality",
"hidden": 0, "fieldtype": "Data",
"label": "Nationality", "hidden": 0,
"max_length": 0, "label": "Nationality",
"max_value": 0, "max_length": 0,
"options": "", "max_value": 0,
"read_only": 0, "options": "",
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "address_line_1", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "address_line_1",
"hidden": 0, "fieldtype": "Data",
"label": "Address Line 1", "hidden": 0,
"max_length": 0, "label": "Address Line 1",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "address_line_2", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "address_line_2",
"hidden": 0, "fieldtype": "Data",
"label": "Address Line 2", "hidden": 0,
"max_length": 0, "label": "Address Line 2",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "pincode", "allow_read_on_all_link_options": 0,
"fieldtype": "Data", "fieldname": "pincode",
"hidden": 0, "fieldtype": "Data",
"label": "Pincode", "hidden": 0,
"max_length": 0, "label": "Pincode",
"max_value": 0, "max_length": 0,
"read_only": 0, "max_value": 0,
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "guardians", "allow_read_on_all_link_options": 0,
"fieldtype": "Table", "fieldname": "guardians",
"hidden": 0, "fieldtype": "Table",
"label": "Guardians", "hidden": 0,
"max_length": 0, "label": "Guardians",
"max_value": 0, "max_length": 0,
"options": "Student Guardian", "max_value": 0,
"read_only": 0, "options": "Student Guardian",
"reqd": 0 "read_only": 0,
}, "reqd": 0,
"show_in_filter": 0
},
{ {
"fieldname": "siblings", "allow_read_on_all_link_options": 0,
"fieldtype": "Table", "fieldname": "siblings",
"hidden": 0, "fieldtype": "Table",
"label": "Siblings", "hidden": 0,
"max_length": 0, "label": "Siblings",
"max_value": 0, "max_length": 0,
"options": "Student Sibling", "max_value": 0,
"read_only": 0, "options": "Student Sibling",
"reqd": 0 "read_only": 0,
"reqd": 0,
"show_in_filter": 0
},
{
"allow_read_on_all_link_options": 0,
"fieldname": "student_admission",
"fieldtype": "Link",
"hidden": 0,
"label": "Student Admission",
"max_length": 0,
"max_value": 0,
"options": "Student Admission",
"read_only": 0,
"reqd": 0,
"show_in_filter": 0
} }
] ]
} }

View File

@@ -671,3 +671,4 @@ erpnext.patches.v12_0.update_uom_conversion_factor
erpnext.patches.v12_0.set_italian_import_supplier_invoice_permissions erpnext.patches.v12_0.set_italian_import_supplier_invoice_permissions
execute:frappe.reload_doc("HR", "doctype", "Employee Advance") execute:frappe.reload_doc("HR", "doctype", "Employee Advance")
erpnext.patches.v12_0.move_due_advance_amount_to_pending_amount erpnext.patches.v12_0.move_due_advance_amount_to_pending_amount
erpnext.patches.v12_0.set_multi_uom_in_rfq

View File

@@ -0,0 +1,16 @@
# Copyright (c) 2017, Frappe and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt
from erpnext.stock.get_item_details import get_conversion_factor
def execute():
frappe.reload_doc('buying', 'doctype', 'request_for_quotation_item')
frappe.db.sql("""UPDATE `tabRequest for Quotation Item`
SET
stock_uom = uom,
conversion_factor = 1,
stock_qty = qty""")

View File

@@ -2,4 +2,13 @@
// For license information, please see license.txt // For license information, please see license.txt
frappe.ui.form.on('Quality Procedure', { frappe.ui.form.on('Quality Procedure', {
refresh: function(frm) {
frm.set_query("procedure","processes", (frm) =>{
return {
filters: {
name: ["not in", [frm.parent_quality_procedure, frm.name]]
}
};
});
}
}); });

View File

@@ -1,5 +1,6 @@
{ {
"actions": [], "actions": [],
"allow_rename": 1,
"autoname": "format:PRC-{quality_procedure_name}", "autoname": "format:PRC-{quality_procedure_name}",
"creation": "2018-10-06 00:06:29.756804", "creation": "2018-10-06 00:06:29.756804",
"doctype": "DocType", "doctype": "DocType",
@@ -72,7 +73,7 @@
], ],
"is_tree": 1, "is_tree": 1,
"links": [], "links": [],
"modified": "2020-03-18 18:26:05.511984", "modified": "2020-06-17 17:25:03.434953",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Quality Management", "module": "Quality Management",
"name": "Quality Procedure", "name": "Quality Procedure",

View File

@@ -10,13 +10,8 @@ from frappe import _
class QualityProcedure(NestedSet): class QualityProcedure(NestedSet):
nsm_parent_field = 'parent_quality_procedure' nsm_parent_field = 'parent_quality_procedure'
def on_save(self): def before_save(self):
for process in self.processes: self.check_for_incorrect_child()
if process.procedure:
doc = frappe.get_doc("Quality Procedure", process.procedure)
if doc.parent_quality_procedure:
frappe.throw(_("{0} already has a Parent Procedure {1}.".format(process.procedure, doc.parent_quality_procedure)))
self.is_group = 1
def on_update(self): def on_update(self):
self.set_parent() self.set_parent()
@@ -47,11 +42,21 @@ class QualityProcedure(NestedSet):
doc.save(ignore_permissions=True) doc.save(ignore_permissions=True)
def set_parent(self): def set_parent(self):
for process in self.processes:
# Set parent for only those children who don't have a parent
parent_quality_procedure = frappe.db.get_value("Quality Procedure", process.procedure, "parent_quality_procedure")
if not parent_quality_procedure and process.procedure:
frappe.db.set_value(self.doctype, process.procedure, "parent_quality_procedure", self.name)
def check_for_incorrect_child(self):
for process in self.processes: for process in self.processes:
if process.procedure: if process.procedure:
doc = frappe.get_doc("Quality Procedure", process.procedure) # Check if any child process belongs to another parent.
doc.parent_quality_procedure = self.name parent_quality_procedure = frappe.db.get_value("Quality Procedure", process.procedure, "parent_quality_procedure")
doc.save(ignore_permissions=True) if parent_quality_procedure and parent_quality_procedure != self.name:
frappe.throw(_("{0} already has a Parent Procedure {1}.".format(frappe.bold(process.procedure), frappe.bold(parent_quality_procedure))),
title=_("Invalid Child Procedure"))
self.is_group = 1
@frappe.whitelist() @frappe.whitelist()
def get_children(doctype, parent=None, parent_quality_procedure=None, is_root=False): def get_children(doctype, parent=None, parent_quality_procedure=None, is_root=False):

View File

@@ -16,6 +16,7 @@ frappe.treeview_settings["Quality Procedure"] = {
}, },
], ],
breadcrumb: "Setup", breadcrumb: "Setup",
disable_add_node: true,
root_label: "All Quality Procedures", root_label: "All Quality Procedures",
get_tree_root: false, get_tree_root: false,
menu_items: [ menu_items: [

View File

@@ -1,6 +1,8 @@
{ {
"actions": [],
"creation": "2019-05-26 00:10:00.248885", "creation": "2019-05-26 00:10:00.248885",
"doctype": "DocType", "doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB", "engine": "InnoDB",
"field_order": [ "field_order": [
"process_description", "process_description",
@@ -23,7 +25,8 @@
} }
], ],
"istable": 1, "istable": 1,
"modified": "2019-05-26 22:05:49.007189", "links": [],
"modified": "2020-06-17 15:44:38.937915",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Quality Management", "module": "Quality Management",
"name": "Quality Procedure Process", "name": "Quality Procedure Process",

View File

@@ -96,7 +96,7 @@ def get_columns(filters):
"label": _("Customer Group"), "label": _("Customer Group"),
"fieldtype": "Link", "fieldtype": "Link",
"fieldname": "customer_group", "fieldname": "customer_group",
"options": "customer Group", "options": "Customer Group",
"width": 120 "width": 120
}, },
{ {

View File

@@ -883,7 +883,12 @@ class Item(WebsiteGenerator):
linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item"] linked_doctypes += ["Sales Order Item", "Purchase Order Item", "Material Request Item"]
for doctype in linked_doctypes: for doctype in linked_doctypes:
if frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}) or \ if doctype in ("Purchase Invoice Item", "Sales Invoice Item",):
# If Invoice has Stock impact, only then consider it.
if self.stock_ledger_created():
return True
elif frappe.db.get_value(doctype, filters={"item_code": self.name, "docstatus": 1}) or \
frappe.db.get_value("Production Order", frappe.db.get_value("Production Order",
filters={"production_item": self.name, "docstatus": 1}): filters={"production_item": self.name, "docstatus": 1}):
return True return True

View File

@@ -14,12 +14,12 @@
{%- if introduction -%} {%- if introduction -%}
<div>{{ introduction }}</div> <div>{{ introduction }}</div>
{% endif %} {% endif %}
{%- if application_form_route -%} {%- if doc.enable_admission_application -%}
<p> <p>
<a class='btn btn-primary' <a class='btn btn-primary'
href='/{{ doc.application_form_route }}'> href='/student-applicant'>
{{ _("Apply Now") }}</a> {{ _("Apply Now") }}</a>
</p> </p>
{% endif %} {% endif %}

View File

@@ -10,9 +10,17 @@
'Agriculture': '/agriculture', 'Agriculture': '/agriculture',
'Hospitality': '' 'Hospitality': ''
} %} } %}
{% set link = '' %} {% set link = '' %}
{% set label = domains[0].domain %}
{% if domains %} {% if domains %}
{% set link = links[domains[0].domain] %} {% set link = links[label] %}
{% endif %} {% endif %}
<a href="https://erpnext.com{{ link }}?source=website_footer" target="_blank" class="text-muted">Powered by ERPNext - {{ '' if domains else 'Open Source' }} ERP Software {{ ('for ' + domains[0].domain + ' Companies') if domains else '' }}</a> {% if label == "Services" %}
{% set label = "Service" %}
{% endif %}
<a href="https://erpnext.com{{ link }}?source=website_footer" target="_blank" class="text-muted">Powered by ERPNext - {{ '' if domains else 'Open Source' }} ERP Software {{ ('for ' + label + ' Companies') if domains else '' }}</a>