Merge pull request #7216 from KanchanChauhan/salary-fixes
[Fixes]Payroll Fixes
diff --git a/erpnext/__init__.py b/erpnext/__init__.py
index 97ab934..6c93525 100644
--- a/erpnext/__init__.py
+++ b/erpnext/__init__.py
@@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
-__version__ = '7.1.23'
+__version__ = '7.1.25'
def get_default_company(user=None):
'''Get default company for user'''
diff --git a/erpnext/accounts/doctype/account/account_tree.js b/erpnext/accounts/doctype/account/account_tree.js
index 8c7925a..1fbbf4f 100644
--- a/erpnext/accounts/doctype/account/account_tree.js
+++ b/erpnext/accounts/doctype/account/account_tree.js
@@ -36,7 +36,7 @@
description: __("Optional. This setting will be used to filter in various transactions.")
},
{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate'),
- depends_on: 'eval:doc.is_group==1&&doc.account_type=="Tax"'},
+ depends_on: 'eval:doc.is_group==0&&doc.account_type=="Tax"'},
{fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse",
depends_on: 'eval:(!doc.is_group&&doc.account_type=="Stock")',
get_query: function() {
diff --git a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
index f1ccd9f..956f15a 100644
--- a/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
+++ b/erpnext/accounts/doctype/bank_reconciliation/bank_reconciliation.js
@@ -15,7 +15,7 @@
frm.set_query("bank_account", function() {
return {
"filters": {
- "account_type": "Bank",
+ "account_type": ["in",["Bank","Cash"]],
"is_group": 0
}
};
diff --git a/erpnext/accounts/doctype/budget/budget.js b/erpnext/accounts/doctype/budget/budget.js
index 40e929a..6697b17 100644
--- a/erpnext/accounts/doctype/budget/budget.js
+++ b/erpnext/accounts/doctype/budget/budget.js
@@ -36,5 +36,18 @@
}
}
})
+ },
+
+ refresh: function(frm) {
+ frm.trigger("toggle_reqd_fields")
+ },
+
+ budget_against: function(frm) {
+ frm.trigger("toggle_reqd_fields")
+ },
+
+ toggle_reqd_fields: function(frm) {
+ frm.toggle_reqd("cost_center", frm.doc.budget_against=="Cost Center");
+ frm.toggle_reqd("project", frm.doc.budget_against=="Project");
}
});
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.json b/erpnext/accounts/doctype/payment_request/payment_request.json
index b4c3349..574103d 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.json
+++ b/erpnext/accounts/doctype/payment_request/payment_request.json
@@ -447,7 +447,7 @@
"collapsible": 0,
"columns": 0,
"fieldname": "payment_url",
- "fieldtype": "Data",
+ "fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -681,7 +681,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-11-07 05:55:42.339193",
+ "modified": "2016-12-12 13:30:42.858205",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Request",
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.js b/erpnext/accounts/doctype/pos_profile/pos_profile.js
index bbbab73..c1aa0c3 100755
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.js
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.js
@@ -26,30 +26,6 @@
});
});
-frappe.ui.form.on("POS Profile", {
- setup: function(frm) {
- frm.trigger("get_query_for_groups")
- },
-
- get_query_for_groups: function(frm) {
- frm.fields_dict['item_groups'].grid.get_field('item_group').get_query = function(frm, cdt, cdn) {
- return{
- filters: {
- 'is_group': 0
- }
- }
- }
-
- frm.fields_dict['customer_groups'].grid.get_field('customer_group').get_query = function(frm, cdt, cdn) {
- return{
- filters: {
- 'is_group': 0
- }
- }
- }
- }
-})
-
// Income Account
// --------------------------------
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.json b/erpnext/accounts/doctype/pos_profile/pos_profile.json
index b8404f0..cef56af 100644
--- a/erpnext/accounts/doctype/pos_profile/pos_profile.json
+++ b/erpnext/accounts/doctype/pos_profile/pos_profile.json
@@ -309,7 +309,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "allow_partial_payment",
+ "fieldname": "allow_delete",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
@@ -317,7 +317,7 @@
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Allow Partial Payment",
+ "label": "Allow Delete",
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -400,6 +400,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -426,6 +427,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Item Groups",
"length": 0,
"no_copy": 0,
@@ -454,6 +456,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -480,6 +483,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Customer Groups",
"length": 0,
"no_copy": 0,
@@ -1054,7 +1058,7 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
- "icon": "fa fa-cog",
+ "icon": "icon-cog",
"idx": 1,
"image_view": 0,
"in_create": 0,
@@ -1063,7 +1067,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-11-17 05:19:52.335433",
+ "modified": "2016-12-12 17:02:22.323006",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",
diff --git a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
index 3476ddd..9928227 100644
--- a/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
+++ b/erpnext/accounts/doctype/pricing_rule/pricing_rule.py
@@ -138,6 +138,8 @@
})
if args.ignore_pricing_rule or not args.item_code:
+ if frappe.db.exists(args.doctype, args.name) and args.get("pricing_rule"):
+ item_details = remove_pricing_rule(args, item_details)
return item_details
if not (args.item_group and args.brand):
@@ -178,9 +180,16 @@
else:
item_details.discount_percentage = pricing_rule.discount_percentage
elif args.get('pricing_rule'):
- if frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), 'price_or_discount') == 'Discount Percentage':
- item_details.discount_percentage = 0.0
+ item_details = remove_pricing_rule(args, item_details)
+ return item_details
+
+def remove_pricing_rule(args, item_details):
+ pricing_rule = frappe.db.get_value('Pricing Rule', args.get('pricing_rule'), ['price_or_discount', 'margin_type'], as_dict=1)
+ if pricing_rule and pricing_rule.price_or_discount == 'Discount Percentage':
+ item_details.discount_percentage = 0.0
+
+ if pricing_rule and pricing_rule.margin_type in ['Percentage', 'Amount']:
item_details.margin_rate_or_amount = 0.0
item_details.margin_type = None
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index 9fb11f2..3619e98 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -116,9 +116,9 @@
item_groups = []
if pos_profile.get('item_groups'):
# Get items based on the item groups defined in the POS profile
-
- cond = "item_group in (%s)"%(', '.join(['%s']*len(pos_profile.get('item_groups'))))
- item_groups = [d.item_group for d in pos_profile.get('item_groups')]
+ for d in pos_profile.get('item_groups'):
+ item_groups.extend(get_child_nodes('Item Group', d.item_group))
+ cond = "item_group in (%s)"%(', '.join(['%s']*len(item_groups)))
return frappe.db.sql("""
select
@@ -136,14 +136,19 @@
customer_groups = []
if pos_profile.get('customer_groups'):
# Get customers based on the customer groups defined in the POS profile
-
- cond = "customer_group in (%s)"%(', '.join(['%s']*len(pos_profile.get('customer_groups'))))
- customer_groups = [d.customer_group for d in pos_profile.get('customer_groups')]
+ for d in pos_profile.get('customer_groups'):
+ customer_groups.extend(get_child_nodes('Customer Group', d.customer_group))
+ cond = "customer_group in (%s)"%(', '.join(['%s']*len(customer_groups)))
return frappe.db.sql(""" select name, customer_name, customer_group,
territory from tabCustomer where disabled = 0
and {cond}""".format(cond=cond), tuple(customer_groups), as_dict=1) or {}
+def get_child_nodes(group_type, root):
+ lft, rgt = frappe.db.get_value(group_type, root, ["lft", "rgt"])
+ return frappe.db.sql_list(""" Select name from `tab{tab}` where
+ lft >= {lft} and rgt <= {rgt}""".format(tab=group_type, lft=lft, rgt=rgt))
+
def get_serial_no_data(pos_profile, company):
# get itemwise serial no data
# example {'Nokia Lumia 1020': {'SN0001': 'Pune'}}
@@ -241,8 +246,7 @@
for docs in doc_list:
for name, doc in docs.items():
- if not frappe.db.exists('Sales Invoice',
- {'offline_pos_name': name, 'docstatus': ("<", "2")}):
+ if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
validate_records(doc)
si_doc = frappe.new_doc('Sales Invoice')
si_doc.offline_pos_name = name
@@ -287,6 +291,7 @@
try:
si_doc.insert()
si_doc.submit()
+ frappe.db.commit()
except Exception, e:
if frappe.message_log: frappe.message_log.pop()
frappe.db.rollback()
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 70db094..b2b6aea 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -107,51 +107,122 @@
show_unsync_invoice_list: function(){
var me = this;
this.si_docs = this.get_doc_from_localstorage();
-
this.list_dialog = new frappe.ui.Dialog({
title: 'Invoice List'
});
this.list_dialog.show();
this.list_body = this.list_dialog.body;
+ if(me.pos_profile_data["allow_delete"]) {
+ this.list_dialog.set_primary_action(__("Delete"), function() {
+ frappe.confirm(__("Delete permanently?"), function () {
+ me.delete_records();
+ })
+ }).addClass("btn-danger");
+ this.toggle_primary_action();
+ }
+
if(this.si_docs.length > 0){
- $(this.list_body).append('<div class="row list-row list-row-head pos-invoice-list">\
- <div class="col-xs-1">Sr</div>\
- <div class="col-xs-3">Customer</div>\
- <div class="col-xs-2 text-left">Status</div>\
- <div class="col-xs-3 text-right">Paid Amount</div>\
- <div class="col-xs-3 text-right">Grand Total</div>\
- </div>')
-
- $.each(this.si_docs, function(index, data){
- for(key in data) {
- $(frappe.render_template("pos_invoice_list", {
- sr: index + 1,
- name: key,
- customer: data[key].customer,
- paid_amount: format_currency(data[key].paid_amount, me.frm.doc.currency),
- grand_total: format_currency(data[key].grand_total, me.frm.doc.currency),
- data: me.get_doctype_status(data[key])
- })).appendTo($(me.list_body));
- }
- })
-
- $(this.list_body).find('.list-row').click(function() {
- me.name = $(this).attr('invoice-name')
- doc_data = me.get_invoice_doc(me.si_docs)
- if(doc_data){
- me.frm.doc = doc_data[0][me.name];
- me.set_missing_values();
- me.refresh(false);
- me.disable_input_field();
- me.list_dialog.hide();
- }
- })
+ me.render_offline_data();
+ me.dialog_actions()
}else{
$(this.list_body).append(repl('<div class="media-heading">%(message)s</div>', {'message': __("All records are synced.")}))
}
},
+ render_offline_data: function() {
+ var me = this;
+
+ this.removed_items = [];
+ $(this.list_body).empty();
+
+ $(this.list_body).append('<div class="row list-row list-row-head pos-invoice-list">\
+ <div class="col-xs-1"><input class="list-select-all" type="checkbox"></div>\
+ <div class="col-xs-3">Customer</div>\
+ <div class="col-xs-2 text-left">Status</div>\
+ <div class="col-xs-3 text-right">Paid Amount</div>\
+ <div class="col-xs-3 text-right">Grand Total</div>\
+ </div>')
+
+ $.each(this.si_docs, function(index, data){
+ for(key in data) {
+ $(frappe.render_template("pos_invoice_list", {
+ sr: index + 1,
+ name: key,
+ customer: data[key].customer,
+ paid_amount: format_currency(data[key].paid_amount, me.frm.doc.currency),
+ grand_total: format_currency(data[key].grand_total, me.frm.doc.currency),
+ data: me.get_doctype_status(data[key])
+ })).appendTo($(me.list_body));
+ }
+ })
+ },
+
+ dialog_actions: function() {
+ var me = this;
+
+ $(this.list_body).find('.list-column').click(function() {
+ me.name = $(this).parents().attr('invoice-name')
+ me.edit_record();
+ })
+
+ $(this.list_body).find('.list-select-all').click(function() {
+ me.removed_items = [];
+ $(me.list_body).find('.list-delete').prop("checked", $(this).is(":checked"))
+ if($(this).is(":checked")) {
+ $.each(me.si_docs, function(index, data){
+ for(key in data) {
+ me.removed_items.push(key)
+ }
+ })
+ }
+
+ me.toggle_primary_action();
+ })
+
+ $(this.list_body).find('.list-delete').click(function() {
+ me.name = $(this).parent().parent().attr('invoice-name');
+ if($(this).is(":checked")) {
+ me.removed_items.push(me.name);
+ } else {
+ me.removed_items.pop(me.name)
+ }
+
+ me.toggle_primary_action();
+ })
+ },
+
+ edit_record: function() {
+ var me = this;
+
+ doc_data = this.get_invoice_doc(this.si_docs);
+ if(doc_data){
+ this.frm.doc = doc_data[0][this.name];
+ this.set_missing_values();
+ this.refresh(false);
+ this.disable_input_field();
+ this.list_dialog.hide();
+ }
+ },
+
+ delete_records: function() {
+ var me = this;
+ this.remove_doc_from_localstorage()
+ this.update_localstorage();
+ this.render_offline_data();
+ this.dialog_actions();
+ this.toggle_primary_action();
+ },
+
+ toggle_primary_action: function() {
+ var me = this;
+ if(this.removed_items && this.removed_items.length > 0) {
+ $(this.list_dialog.wrapper).find('.btn-danger').show();
+ } else {
+ $(this.list_dialog.wrapper).find('.btn-danger').hide();
+ }
+ },
+
get_doctype_status: function(doc){
if(doc.docstatus == 0) {
return {status: "Draft", indicator: "red"}
@@ -229,7 +300,7 @@
},
save_previous_entry : function(){
- if(this.frm.doc.items.length > 0){
+ if(this.frm.doc.docstatus < 1 && this.frm.doc.items.length > 0){
this.create_invoice()
}
},
@@ -256,7 +327,7 @@
frappe.meta.sync(data)
})
- this.print_template = frappe.render_template("print_template",
+ this.print_template_data = frappe.render_template("print_template",
{content: this.print_template, title:"POS",
base_url: frappe.urllib.get_base_url(), print_css: frappe.boot.print_css})
},
@@ -736,7 +807,7 @@
}, "octicon octfa fa-credit-card");
}else if(this.frm.doc.docstatus == 1) {
this.page.set_primary_action(__("Print"), function() {
- html = frappe.render(me.print_template, me.frm.doc)
+ html = frappe.render(me.print_template_data, me.frm.doc)
me.print_document(html)
})
}else {
@@ -759,7 +830,7 @@
]));
$('.print_doc').click(function(){
- html = frappe.render(me.print_template, me.frm.doc)
+ html = frappe.render(me.print_template_data, me.frm.doc)
me.print_document(html)
})
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
index 8cfbc83..2b7f1f3 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.js
@@ -31,6 +31,14 @@
options: "Company",
default: frappe.defaults.get_user_default("Company"),
reqd: 1
+ },
+ {
+ fieldname: "budget_against",
+ label: __("Budget Against"),
+ fieldtype: "Select",
+ options: ["Cost Center", "Project"],
+ default: "Cost Center",
+ reqd: 1
}
]
}
diff --git a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
index 0be0b3d..875ec99 100644
--- a/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
+++ b/erpnext/accounts/report/budget_variance_report/budget_variance_report.py
@@ -12,7 +12,7 @@
if not filters: filters = {}
columns = get_columns(filters)
- cost_centers = get_cost_centers(filters.company)
+ cost_centers = get_cost_centers(filters)
period_month_ranges = get_period_month_ranges(filters["period"], filters["fiscal_year"])
cam_map = get_cost_center_account_month_map(filters)
@@ -40,7 +40,7 @@
return columns, data
def get_columns(filters):
- columns = [_("Cost Center") + ":Link/Cost Center:120", _("Account") + ":Link/Account:120"]
+ columns = [_(filters.get("budget_against")) + ":Link/%s:120"%(filters.get("budget_against")), _("Account") + ":Link/Account:120"]
group_months = False if filters["period"] == "Monthly" else True
@@ -56,16 +56,23 @@
return columns + [_("Total Target") + ":Float:120", _("Total Actual") + ":Float:120",
_("Total Variance") + ":Float:120"]
-def get_cost_centers(company):
- return frappe.db.sql_list("select name from `tabCost Center` where company=%s order by lft", company)
+def get_cost_centers(filters):
+ cond = "and 1=1"
+ if filters.get("budget_against") == "Cost Center":
+ cond = "order by lft"
+
+ return frappe.db.sql_list("""select name from `tab{tab}` where company=%s
+ {cond}""".format(tab=filters.get("budget_against"), cond=cond), filters.get("company"))
#Get cost center & target details
def get_cost_center_target_details(filters):
return frappe.db.sql("""
- select b.cost_center, b.monthly_distribution, ba.account, ba.budget_amount
+ select b.{budget_against} as budget_against, b.monthly_distribution, ba.account, ba.budget_amount
from `tabBudget` b, `tabBudget Account` ba
- where b.name=ba.parent and b.docstatus = 1 and b.fiscal_year=%s and b.company=%s
- """, (filters.fiscal_year, filters.company), as_dict=True)
+ where b.name=ba.parent and b.docstatus = 1 and b.fiscal_year=%s
+ and b.budget_against = %s and b.company=%s
+ """.format(budget_against=filters.get("budget_against").replace(" ", "_").lower()),
+ (filters.fiscal_year, filters.budget_against, filters.company), as_dict=True)
#Get target distribution details of accounts of cost center
def get_target_distribution_details(filters):
@@ -78,20 +85,26 @@
return target_details
#Get actual details from gl entry
-def get_actual_details(cost_center, fiscal_year):
- cc_lft, cc_rgt = frappe.db.get_value("Cost Center", cost_center, ["lft", "rgt"])
+def get_actual_details(name, filters):
+ cond = "1=1"
+ budget_against=filters.get("budget_against").replace(" ", "_").lower()
+
+ if filters.get("budget_against") == "Cost Center":
+ cc_lft, cc_rgt = frappe.db.get_value("Cost Center", name, ["lft", "rgt"])
+ cond = "lft>='{lft}' and rgt<='{rgt}'".format(lft = cc_lft, rgt=cc_rgt)
ac_details = frappe.db.sql("""select gl.account, gl.debit, gl.credit,
- MONTHNAME(gl.posting_date) as month_name, b.cost_center
+ MONTHNAME(gl.posting_date) as month_name, b.{budget_against} as budget_against
from `tabGL Entry` gl, `tabBudget Account` ba, `tabBudget` b
where
b.name = ba.parent
and b.docstatus = 1
and ba.account=gl.account
and gl.fiscal_year=%s
- and b.cost_center=%s
- and exists(select name from `tabCost Center` where name=gl.cost_center and lft>=%s and rgt<=%s)
- """, (fiscal_year, cost_center, cc_lft, cc_rgt), as_dict=1)
+ and b.{budget_against}=%s
+ and exists(select name from `tab{tab}` where name=gl.{budget_against} and {cond})
+ """.format(tab = filters.budget_against, budget_against = budget_against, cond = cond),
+ (filters.fiscal_year, name), as_dict=1)
cc_actual_details = {}
for d in ac_details:
@@ -107,17 +120,17 @@
cam_map = {}
for ccd in cost_center_target_details:
- actual_details = get_actual_details(ccd.cost_center, filters.fiscal_year)
+ actual_details = get_actual_details(ccd.budget_against, filters)
for month_id in range(1, 13):
month = datetime.date(2013, month_id, 1).strftime('%B')
- cam_map.setdefault(ccd.cost_center, {}).setdefault(ccd.account, {})\
+ cam_map.setdefault(ccd.budget_against, {}).setdefault(ccd.account, {})\
.setdefault(month, frappe._dict({
"target": 0.0, "actual": 0.0
}))
- tav_dict = cam_map[ccd.cost_center][ccd.account][month]
+ tav_dict = cam_map[ccd.budget_against][ccd.account][month]
month_percentage = tdd.get(ccd.monthly_distribution, {}).get(month, 0) \
if ccd.monthly_distribution else 100.0/12
diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py
index 0b21fec..55363ab 100644
--- a/erpnext/config/hr.py
+++ b/erpnext/config/hr.py
@@ -150,12 +150,23 @@
},
{
- "label": _("Tools"),
- "icon": "fa fa-wrench",
+ "label": _("Training"),
"items": [
-
+ {
+ "type": "doctype",
+ "name": "Training Event"
+ },
+ {
+ "type": "doctype",
+ "name": "Training Result"
+ },
+ {
+ "type": "doctype",
+ "name": "Training Feedback"
+ },
]
},
+
{
"label": _("Setup"),
"icon": "fa fa-cog",
diff --git a/erpnext/config/schools.py b/erpnext/config/schools.py
index f9696d0..1d33d4d 100644
--- a/erpnext/config/schools.py
+++ b/erpnext/config/schools.py
@@ -68,7 +68,7 @@
},
{
"type": "doctype",
- "name": "Student Batch Attendance Tool"
+ "name": "Student Attendance Tool"
},
{
"type": "report",
diff --git a/erpnext/docs/assets/img/human-resources/training_event.png b/erpnext/docs/assets/img/human-resources/training_event.png
new file mode 100644
index 0000000..04162eb
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/training_event.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/training_event_employee.png b/erpnext/docs/assets/img/human-resources/training_event_employee.png
new file mode 100644
index 0000000..aea90b4
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/training_event_employee.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/training_feedback.png b/erpnext/docs/assets/img/human-resources/training_feedback.png
new file mode 100644
index 0000000..84a2ec2
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/training_feedback.png
Binary files differ
diff --git a/erpnext/docs/assets/img/human-resources/training_result.png b/erpnext/docs/assets/img/human-resources/training_result.png
new file mode 100644
index 0000000..36f086c
--- /dev/null
+++ b/erpnext/docs/assets/img/human-resources/training_result.png
Binary files differ
diff --git a/erpnext/docs/user/manual/en/human-resources/index.txt b/erpnext/docs/user/manual/en/human-resources/index.txt
index 2543b4b..5615790 100644
--- a/erpnext/docs/user/manual/en/human-resources/index.txt
+++ b/erpnext/docs/user/manual/en/human-resources/index.txt
@@ -7,6 +7,7 @@
job-applicant
job-opening
offer-letter
+training
tools
human-resources-reports
setup
diff --git a/erpnext/docs/user/manual/en/human-resources/training.md b/erpnext/docs/user/manual/en/human-resources/training.md
new file mode 100644
index 0000000..5d55b6c
--- /dev/null
+++ b/erpnext/docs/user/manual/en/human-resources/training.md
@@ -0,0 +1,28 @@
+### Training Event
+
+Schedule seminars, workshops, conferences etc using Training Event. You can also invite your employees to attend the event using this feature.
+
+<img class="screenshot" alt="Employee" src="{{docs_base_url}}/assets/img/human-resources/training_event.png">
+
+### Inviting Employees for Event
+
+You can invite your employees to attend the event. You can do so by selecting the employees to be invited in the employee table.
+By default the status of the employee will be 'Open'.
+The system shall notify the employee with status 'Open' by sending a email to the office email address of the employee as mentioned in the employee master if you have selected 'Send Email' checkbox.
+The status is changed to 'Invited' when an invitation email is sent to the employee by the system.
+When an Employee confirms his/her presence for the event you can change the status to 'Confirmed'.
+
+<img class="screenshot" alt="Employee" src="{{docs_base_url}}/assets/img/human-resources/training_event_employee.png">
+
+### Training Result
+
+After compleation of the training Employee Wise training results can be stored based on the Feedback received from the Trainer.
+
+<img class="screenshot" alt="Employee" src="{{docs_base_url}}/assets/img/human-resources/training_result.png">
+
+
+### Trainig Feedback
+
+Collect feedback regarding the event from your Employees using Training Feedback.
+
+<img class="screenshot" alt="Employee" src="{{docs_base_url}}/assets/img/human-resources/training_feedback.png">
diff --git a/erpnext/docs/user/manual/en/selling/articles/adding-margin.md b/erpnext/docs/user/manual/en/selling/articles/adding-margin.md
index 2b2fb09..2725fee 100644
--- a/erpnext/docs/user/manual/en/selling/articles/adding-margin.md
+++ b/erpnext/docs/user/manual/en/selling/articles/adding-margin.md
@@ -1,7 +1,7 @@
#Adding Margin
User Can apply the margin on Quotation Item and Sales Order Item using following two options.
-1)Price Rule: With the help of this method user can apply the margin on Quotation and Sales Order based on condition. you can find the section margin on pricing rule where a user has to select the type of margin whether it is Percentage or Amount and rate or amount. The system will apply the margin on quotation item and sales order item if pricing rule is enabled.
+1)Price Rule: With the help of this method user can apply the margin on Quotation and Sales Order based on condition. You can find the section margin on pricing rule where a user has to select the type of margin whether it is Percentage or Amount and Rate or Amount. The system will apply the margin on quotation item and sales order item if pricing rule is enabled.
To setup Pricing Rule, go to:
diff --git a/erpnext/docs/user/manual/en/setting-up/integration-services/ldap-integration.md b/erpnext/docs/user/manual/en/setting-up/integration-services/ldap-integration.md
index 34678a9..e12ed1c 100644
--- a/erpnext/docs/user/manual/en/setting-up/integration-services/ldap-integration.md
+++ b/erpnext/docs/user/manual/en/setting-up/integration-services/ldap-integration.md
@@ -4,16 +4,16 @@
By settings up LDAP service, you able to login to ERPNext account by using LDAP credentials.
-####Step 1: Create Razorpay service
+####Step 1: Create LDAP service
`Explore > Setup > Integration Service`
Make a new Integration Service and select `LDAP` as a service from dropdown then save the document.
After saving a document, click on `LDAP Settings` button, to setup service.
-####Step 2: Setup ldap service
+####Step 2: Setup LDAP service
-To enable ldap service, you need to configure parameters like LDAP Server Url, Organizational Unit, Base Distinguished Name (DN) and Password for Base DN
+To enable ldap service, you need to configure parameters like LDAP Server Url, Organizational Unit, UID, Base Distinguished Name (DN) and Password for Base DN
<img class="screenshot" alt="LDAP Settings" src="{{docs_base_url}}/assets/img/setup/integration-service/ldap_settings.png">
@@ -21,4 +21,4 @@
After setting up credentials on LDAP Settings, go back to LDAP Service record and enable it.
While enabling, it will validate LDAP details and on successful validation, it will enables LDAP login option.
-<img class="screenshot" alt="LOGIN via LDAP" src="{{docs_base_url}}/assets/img/setup/integration-service/login_via_ldap.png">
\ No newline at end of file
+<img class="screenshot" alt="LOGIN via LDAP" src="{{docs_base_url}}/assets/img/setup/integration-service/login_via_ldap.png">
diff --git a/erpnext/hr/doctype/appraisal_template/appraisal_template.json b/erpnext/hr/doctype/appraisal_template/appraisal_template.json
index 22ee3dd..97402ac 100644
--- a/erpnext/hr/doctype/appraisal_template/appraisal_template.json
+++ b/erpnext/hr/doctype/appraisal_template/appraisal_template.json
@@ -3,16 +3,19 @@
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:kra_title",
+ "beta": 0,
"creation": "2012-07-03 13:30:39",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
+ "editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "kra_title",
"fieldtype": "Data",
"hidden": 0,
@@ -20,6 +23,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Appraisal Template Title",
"length": 0,
"no_copy": 0,
@@ -29,6 +33,7 @@
"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,
@@ -39,6 +44,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "description",
"fieldtype": "Small Text",
"hidden": 0,
@@ -46,6 +52,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -56,6 +63,7 @@
"print_hide_if_no_value": 0,
"print_width": "300px",
"read_only": 0,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -67,6 +75,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "goals",
"fieldtype": "Table",
"hidden": 0,
@@ -74,6 +83,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Goals",
"length": 0,
"no_copy": 0,
@@ -84,6 +94,7 @@
"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,
@@ -93,15 +104,16 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
- "icon": "fa fa-file-text",
+ "icon": "icon-file-text",
"idx": 1,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-04-13 01:49:21.815151",
+ "modified": "2016-12-13 12:37:56.937023",
"modified_by": "Administrator",
"module": "HR",
"name": "Appraisal Template",
@@ -117,6 +129,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -126,8 +139,30 @@
"share": 1,
"submit": 0,
"write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 0,
+ "delete": 0,
+ "email": 0,
+ "export": 0,
+ "if_owner": 0,
+ "import": 0,
+ "is_custom": 0,
+ "permlevel": 0,
+ "print": 0,
+ "read": 1,
+ "report": 0,
+ "role": "Employee",
+ "set_user_permissions": 0,
+ "share": 0,
+ "submit": 0,
+ "write": 0
}
],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_order": "DESC",
diff --git a/erpnext/hr/doctype/employee/employee.js b/erpnext/hr/doctype/employee/employee.js
index 98f9f6e..0a8d9a1 100755
--- a/erpnext/hr/doctype/employee/employee.js
+++ b/erpnext/hr/doctype/employee/employee.js
@@ -58,6 +58,15 @@
},
update_contact:function(frm){
frm.set_value("prefered_email",frm.fields_dict[frappe.model.scrub(frm.doc.prefered_contact_email)].value)
- }
+ },
+ status: function(frm) {
+ return frm.call({
+ method: "deactivate_sales_person",
+ args: {
+ employee: frm.doc.employee,
+ status: frm.doc.status
+ }
+ });
+ },
});
cur_frm.cscript = new erpnext.hr.EmployeeController({frm: cur_frm});
diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py
index e2e541b..58d1262 100755
--- a/erpnext/hr/doctype/employee/employee.py
+++ b/erpnext/hr/doctype/employee/employee.py
@@ -244,3 +244,9 @@
if holiday_list:
return frappe.get_all('Holiday List', dict(name=holiday_list, holiday_date=date)) and True or False
+@frappe.whitelist()
+def deactivate_sales_person(status = None, employee = None):
+ if status == "Left":
+ sales_person = frappe.db.get_value("Sales Person", {"Employee": employee})
+ if sales_person:
+ frappe.db.set_value("Sales Person", sales_person, "enabled", 0)
diff --git a/erpnext/hr/doctype/salary_slip/salary_slip.py b/erpnext/hr/doctype/salary_slip/salary_slip.py
index 95bea7a..ffd1136 100644
--- a/erpnext/hr/doctype/salary_slip/salary_slip.py
+++ b/erpnext/hr/doctype/salary_slip/salary_slip.py
@@ -222,7 +222,6 @@
["date_of_joining", "relieving_date"])
holidays = self.get_holidays_for_employee(self.start_date, self.end_date)
-
working_days = date_diff(self.end_date, self.start_date) + 1
if not cint(frappe.db.get_value("HR Settings", None, "include_holidays_in_total_working_days")):
working_days -= len(holidays)
diff --git a/erpnext/hr/doctype/salary_structure/test_salary_structure.py b/erpnext/hr/doctype/salary_structure/test_salary_structure.py
index 9217c64..fe88d9a 100644
--- a/erpnext/hr/doctype/salary_structure/test_salary_structure.py
+++ b/erpnext/hr/doctype/salary_structure/test_salary_structure.py
@@ -6,12 +6,15 @@
import unittest
import erpnext
from frappe.utils.make_random import get_random
-from frappe.utils import nowdate, add_days, add_years
+from frappe.utils import nowdate, add_days, add_years, getdate
from erpnext.hr.doctype.salary_structure.salary_structure import make_salary_slip
-from erpnext.hr.doctype.salary_slip.test_salary_slip import make_earning_salary_component, make_deduction_salary_component
+from erpnext.hr.doctype.salary_slip.test_salary_slip \
+ import make_earning_salary_component, make_deduction_salary_component
+
+test_dependencies = ["Fiscal Year"]
class TestSalaryStructure(unittest.TestCase):
- def test_setup(self):
+ def setUp(self):
self.make_holiday_list()
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", "Salary Structure Test Holiday List")
make_earning_salary_component(["Basic Salary", "Allowance", "HRA"])
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/__init__.py b/erpnext/hr/doctype/training_event/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/student_batch_attendance_tool/__init__.py
copy to erpnext/hr/doctype/training_event/__init__.py
diff --git a/erpnext/hr/doctype/training_event/test_training_event.py b/erpnext/hr/doctype/training_event/test_training_event.py
new file mode 100644
index 0000000..03416ee
--- /dev/null
+++ b/erpnext/hr/doctype/training_event/test_training_event.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('Training Event')
+
+class TestTrainingEvent(unittest.TestCase):
+ pass
diff --git a/erpnext/hr/doctype/training_event/training_event.js b/erpnext/hr/doctype/training_event/training_event.js
new file mode 100644
index 0000000..ebe0c79
--- /dev/null
+++ b/erpnext/hr/doctype/training_event/training_event.js
@@ -0,0 +1,21 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Training Event', {
+ refresh: function(frm) {
+ if(!frm.doc.__islocal) {
+ frm.add_custom_button(__("Training Result"), function() {
+ frappe.route_options = {
+ training_event: frm.doc.name
+ }
+ frappe.set_route("List", "Training Result");
+ });
+ frm.add_custom_button(__("Training Feedback"), function() {
+ frappe.route_options = {
+ training_event: frm.doc.name
+ }
+ frappe.set_route("List", "Training Feedback");
+ });
+ }
+ }
+});
diff --git a/erpnext/hr/doctype/training_event/training_event.json b/erpnext/hr/doctype/training_event/training_event.json
new file mode 100644
index 0000000..168943d
--- /dev/null
+++ b/erpnext/hr/doctype/training_event/training_event.json
@@ -0,0 +1,679 @@
+{
+ "allow_copy": 0,
+ "allow_import": 1,
+ "allow_rename": 1,
+ "autoname": "field:event_name",
+ "beta": 0,
+ "creation": "2016-08-08 04:53:58.355206",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "fields": [
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "event_name",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Event Name",
+ "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_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "event_status",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Event Status",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Scheduled\nCompleted\nCancelled",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_2",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "type",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Type",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Seminar\nTheory\nWorkshop\nConference\nExam\nInternet",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_4",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "trainer_name",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Trainer Name",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "trainer_email",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Trainer Email",
+ "length": 0,
+ "no_copy": 0,
+ "options": "",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_7",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "supplier",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Supplier",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Supplier",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "contact_number",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Contact Number",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_9",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "course",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Course",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Course",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "location",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Location",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_12",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "start_time",
+ "fieldtype": "Datetime",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Start Time",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "end_time",
+ "fieldtype": "Datetime",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "End Time",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_15",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "introduction",
+ "fieldtype": "Text Editor",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_18",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Attendees",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "description": "Will send an email about the event to employees with status 'Open'",
+ "fieldname": "send_email",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Send Email",
+ "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_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "employees",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Employees",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Training Event Employee",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "amended_from",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Amended From",
+ "length": 0,
+ "no_copy": 1,
+ "options": "Training Event",
+ "permlevel": 0,
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "remember_last_selected_value": 0,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ }
+ ],
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "in_dialog": 0,
+ "is_submittable": 1,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2016-12-14 11:46:25.712779",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Training Event",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "amend": 1,
+ "apply_user_permissions": 0,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 1,
+ "is_custom": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ }
+ ],
+ "quick_entry": 1,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "search_fields": "event_name",
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "title_field": "event_name",
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/training_event/training_event.py b/erpnext/hr/doctype/training_event/training_event.py
new file mode 100644
index 0000000..c9be3dd
--- /dev/null
+++ b/erpnext/hr/doctype/training_event/training_event.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.model.document import Document
+
+class TrainingEvent(Document):
+ def validate(self):
+ if self.event_status == "Scheduled":
+ self.invite_employee()
+
+ def on_update_after_submit(self):
+ if self.event_status == "Scheduled" and self.send_email:
+ self.invite_employee()
+
+ def invite_employee(self):
+ subject = _("""You are invited for to attend {0} - {1} scheduled from {2} to {3} at {4}."""\
+ .format(self.type, self.event_name, self.start_time, self.end_time, self.location))
+
+ for emp in self.employees:
+ if emp.status== "Open":
+ frappe.sendmail(frappe.db.get_value("Employee", emp.employee, "company_email"), \
+ subject=subject, content= self.introduction)
+ emp.status= "Invited"
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/__init__.py b/erpnext/hr/doctype/training_event_employee/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/student_batch_attendance_tool/__init__.py
copy to erpnext/hr/doctype/training_event_employee/__init__.py
diff --git a/erpnext/hr/doctype/training_event_employee/training_event_employee.json b/erpnext/hr/doctype/training_event_employee/training_event_employee.json
new file mode 100644
index 0000000..575d0e7
--- /dev/null
+++ b/erpnext/hr/doctype/training_event_employee/training_event_employee.json
@@ -0,0 +1,152 @@
+{
+ "allow_copy": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2016-08-08 05:33:39.965305",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "fields": [
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "employee",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Employee",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Employee",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "employee_name",
+ "fieldtype": "Read Only",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Employee Name",
+ "length": 0,
+ "no_copy": 0,
+ "options": "employee.employee_name",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "default": "Open",
+ "fieldname": "status",
+ "fieldtype": "Select",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Status",
+ "length": 0,
+ "no_copy": 1,
+ "options": "Open\nInvited\nConfirmed\nAttended\nWithdrawn",
+ "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
+ }
+ ],
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "in_dialog": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2016-12-14 11:43:40.996578",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Training Event Employee",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py b/erpnext/hr/doctype/training_event_employee/training_event_employee.py
similarity index 84%
rename from erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py
rename to erpnext/hr/doctype/training_event_employee/training_event_employee.py
index 49a5ae8..234e958 100644
--- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py
+++ b/erpnext/hr/doctype/training_event_employee/training_event_employee.py
@@ -6,5 +6,5 @@
import frappe
from frappe.model.document import Document
-class StudentBatchAttendanceTool(Document):
+class TrainingEventEmployee(Document):
pass
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/__init__.py b/erpnext/hr/doctype/training_feedback/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/student_batch_attendance_tool/__init__.py
copy to erpnext/hr/doctype/training_feedback/__init__.py
diff --git a/erpnext/hr/doctype/training_feedback/test_training_feedback.py b/erpnext/hr/doctype/training_feedback/test_training_feedback.py
new file mode 100644
index 0000000..3455998
--- /dev/null
+++ b/erpnext/hr/doctype/training_feedback/test_training_feedback.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('Training Feedback')
+
+class TestTrainingFeedback(unittest.TestCase):
+ pass
diff --git a/erpnext/hr/doctype/training_feedback/training_feedback.js b/erpnext/hr/doctype/training_feedback/training_feedback.js
new file mode 100644
index 0000000..0dea098
--- /dev/null
+++ b/erpnext/hr/doctype/training_feedback/training_feedback.js
@@ -0,0 +1,10 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Training Feedback', {
+ onload: function(frm) {
+ frm.add_fetch("training_event", "course", "course");
+ frm.add_fetch("training_event", "event_name", "event_name");
+ frm.add_fetch("training_event", "trainer_name", "trainer_name");
+ }
+});
\ No newline at end of file
diff --git a/erpnext/hr/doctype/training_feedback/training_feedback.json b/erpnext/hr/doctype/training_feedback/training_feedback.json
new file mode 100644
index 0000000..932d4a7
--- /dev/null
+++ b/erpnext/hr/doctype/training_feedback/training_feedback.json
@@ -0,0 +1,354 @@
+{
+ "allow_copy": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "autoname": "Feedback.####",
+ "beta": 0,
+ "creation": "2016-08-08 06:35:34.158568",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "fields": [
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "employee",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Employee",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Employee",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "employee_name",
+ "fieldtype": "Read Only",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Employee Name",
+ "length": 0,
+ "no_copy": 0,
+ "options": "employee.employee_name",
+ "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,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "course",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Course",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Course",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_3",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "training_event",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Training Event",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Training Event",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "event_name",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Event Name",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "trainer_name",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Trainer Name",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_6",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "feedback",
+ "fieldtype": "Text",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Feedback",
+ "length": 0,
+ "no_copy": 0,
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "amended_from",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Amended From",
+ "length": 0,
+ "no_copy": 1,
+ "options": "Training Feedback",
+ "permlevel": 0,
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ }
+ ],
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "in_dialog": 0,
+ "is_submittable": 1,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2016-11-04 08:53:24.731178",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Training Feedback",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "amend": 1,
+ "apply_user_permissions": 0,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "is_custom": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 0,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "is_custom": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "Employee",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ }
+ ],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "title_field": "employee_name",
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py b/erpnext/hr/doctype/training_feedback/training_feedback.py
similarity index 84%
copy from erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py
copy to erpnext/hr/doctype/training_feedback/training_feedback.py
index 49a5ae8..2a0403b 100644
--- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py
+++ b/erpnext/hr/doctype/training_feedback/training_feedback.py
@@ -6,5 +6,5 @@
import frappe
from frappe.model.document import Document
-class StudentBatchAttendanceTool(Document):
+class TrainingFeedback(Document):
pass
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/__init__.py b/erpnext/hr/doctype/training_result/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/student_batch_attendance_tool/__init__.py
copy to erpnext/hr/doctype/training_result/__init__.py
diff --git a/erpnext/hr/doctype/training_result/test_training_result.py b/erpnext/hr/doctype/training_result/test_training_result.py
new file mode 100644
index 0000000..29ed2a0
--- /dev/null
+++ b/erpnext/hr/doctype/training_result/test_training_result.py
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
+# See license.txt
+from __future__ import unicode_literals
+
+import frappe
+import unittest
+
+# test_records = frappe.get_test_records('Training Result')
+
+class TestTrainingResult(unittest.TestCase):
+ pass
diff --git a/erpnext/hr/doctype/training_result/training_result.js b/erpnext/hr/doctype/training_result/training_result.js
new file mode 100644
index 0000000..3a3d70a
--- /dev/null
+++ b/erpnext/hr/doctype/training_result/training_result.js
@@ -0,0 +1,32 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.ui.form.on('Training Result', {
+ onload: function(frm) {
+ if (frm.doc.training_event) {
+ frm.trigger("training_event");
+ }
+ },
+
+ training_event: function(frm) {
+ if (frm.doc.training_event) {
+ frappe.call({
+ method: "erpnext.hr.doctype.training_result.training_result.get_employees",
+ args: {
+ "training_event": frm.doc.training_event
+ },
+ callback: function(r) {
+ frm.set_value("employees" ,"");
+ if (r.message) {
+ $.each(r.message, function(i, d) {
+ var row = frappe.model.add_child(cur_frm.doc, "Training Result Employee", "employees");
+ row.employee = d.employee;
+ row.employee_name = d.employee_name;
+ });
+ }
+ refresh_field("employees");
+ }
+ });
+ }
+ }
+});
diff --git a/erpnext/hr/doctype/training_result/training_result.json b/erpnext/hr/doctype/training_result/training_result.json
new file mode 100644
index 0000000..52b9a16
--- /dev/null
+++ b/erpnext/hr/doctype/training_result/training_result.json
@@ -0,0 +1,171 @@
+{
+ "allow_copy": 0,
+ "allow_import": 0,
+ "allow_rename": 1,
+ "autoname": "TRES.#####",
+ "beta": 0,
+ "creation": "2016-11-04 02:13:48.407576",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "training_event",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Training Event",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Training Event",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 1
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "section_break_3",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "employees",
+ "fieldtype": "Table",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Employees",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Training Result Employee",
+ "permlevel": 0,
+ "precision": "",
+ "print_hide": 0,
+ "print_hide_if_no_value": 0,
+ "read_only": 0,
+ "report_hide": 0,
+ "reqd": 1,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "amended_from",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Amended From",
+ "length": 0,
+ "no_copy": 1,
+ "options": "Training Result",
+ "permlevel": 0,
+ "print_hide": 1,
+ "print_hide_if_no_value": 0,
+ "read_only": 1,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ }
+ ],
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "in_dialog": 0,
+ "is_submittable": 1,
+ "issingle": 0,
+ "istable": 0,
+ "max_attachments": 0,
+ "modified": "2016-11-04 08:53:48.597031",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Training Result",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [
+ {
+ "amend": 1,
+ "apply_user_permissions": 0,
+ "cancel": 1,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "is_custom": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 1,
+ "write": 1
+ }
+ ],
+ "quick_entry": 0,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "title_field": "training_event",
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/hr/doctype/training_result/training_result.py b/erpnext/hr/doctype/training_result/training_result.py
new file mode 100644
index 0000000..16b76a7
--- /dev/null
+++ b/erpnext/hr/doctype/training_result/training_result.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe import _
+from frappe.model.document import Document
+
+class TrainingResult(Document):
+ def on_submit(self):
+ self.send_result()
+
+ def send_result(self):
+ for emp in self.employees:
+ message = "Thank You for attending {0}. You grade is {1}".format(self.training_event, emp.grade)
+ frappe.sendmail(frappe.db.get_value("Employee", emp.employee, "company_email"), \
+ subject=_("{0} Results".format(self.training_event)), \
+ content=message)
+
+@frappe.whitelist()
+def get_employees(training_event):
+ return frappe.get_doc("Training Event", training_event).employees
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/__init__.py b/erpnext/hr/doctype/training_result_employee/__init__.py
similarity index 100%
copy from erpnext/schools/doctype/student_batch_attendance_tool/__init__.py
copy to erpnext/hr/doctype/training_result_employee/__init__.py
diff --git a/erpnext/hr/doctype/training_result_employee/training_result_employee.json b/erpnext/hr/doctype/training_result_employee/training_result_employee.json
new file mode 100644
index 0000000..477a8e6
--- /dev/null
+++ b/erpnext/hr/doctype/training_result_employee/training_result_employee.json
@@ -0,0 +1,254 @@
+{
+ "allow_copy": 0,
+ "allow_import": 0,
+ "allow_rename": 0,
+ "beta": 0,
+ "creation": "2016-11-04 02:39:12.825569",
+ "custom": 0,
+ "docstatus": 0,
+ "doctype": "DocType",
+ "document_type": "",
+ "editable_grid": 1,
+ "engine": "InnoDB",
+ "fields": [
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "employee",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Employee",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Employee",
+ "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,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_2",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "employee_name",
+ "fieldtype": "Read Only",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Employee Name",
+ "length": 0,
+ "no_copy": 0,
+ "options": "employee.employee_name",
+ "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,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "",
+ "fieldname": "section_break_5",
+ "fieldtype": "Section Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "hours",
+ "fieldtype": "Float",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Hours",
+ "length": 0,
+ "no_copy": 0,
+ "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": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "grade",
+ "fieldtype": "Data",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Grade",
+ "length": 0,
+ "no_copy": 0,
+ "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,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "column_break_7",
+ "fieldtype": "Column Break",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 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,
+ "report_hide": 0,
+ "reqd": 0,
+ "search_index": 0,
+ "set_only_once": 0,
+ "unique": 0
+ },
+ {
+ "allow_on_submit": 1,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "comments",
+ "fieldtype": "Text",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 1,
+ "in_standard_filter": 0,
+ "label": "Comments",
+ "length": 0,
+ "no_copy": 0,
+ "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
+ }
+ ],
+ "hide_heading": 0,
+ "hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
+ "in_create": 0,
+ "in_dialog": 0,
+ "is_submittable": 0,
+ "issingle": 0,
+ "istable": 1,
+ "max_attachments": 0,
+ "modified": "2016-11-04 03:31:08.624394",
+ "modified_by": "Administrator",
+ "module": "HR",
+ "name": "Training Result Employee",
+ "name_case": "",
+ "owner": "Administrator",
+ "permissions": [],
+ "quick_entry": 1,
+ "read_only": 0,
+ "read_only_onload": 0,
+ "sort_field": "modified",
+ "sort_order": "DESC",
+ "track_seen": 0
+}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py b/erpnext/hr/doctype/training_result_employee/training_result_employee.py
similarity index 84%
copy from erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py
copy to erpnext/hr/doctype/training_result_employee/training_result_employee.py
index 49a5ae8..54e2a18 100644
--- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.py
+++ b/erpnext/hr/doctype/training_result_employee/training_result_employee.py
@@ -6,5 +6,5 @@
import frappe
from frappe.model.document import Document
-class StudentBatchAttendanceTool(Document):
+class TrainingResultEmployee(Document):
pass
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.json b/erpnext/manufacturing/doctype/workstation/workstation.json
index 144635c..9f72e5c 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.json
+++ b/erpnext/manufacturing/doctype/workstation/workstation.json
@@ -3,29 +3,36 @@
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:workstation_name",
+ "beta": 0,
"creation": "2013-01-10 16:34:17",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
+ "editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "description_and_warehouse",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "",
"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,
@@ -36,12 +43,15 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "workstation_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Workstation Name",
"length": 0,
"no_copy": 0,
@@ -49,7 +59,9 @@
"oldfieldtype": "Data",
"permlevel": 0,
"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,
@@ -60,12 +72,15 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "description",
"fieldtype": "Text",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Description",
"length": 0,
"no_copy": 0,
@@ -73,7 +88,9 @@
"oldfieldtype": "Text",
"permlevel": 0,
"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,
@@ -85,18 +102,23 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_4",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 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,
@@ -107,13 +129,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"default": "",
"fieldname": "holiday_list",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Holiday List",
"length": 0,
"no_copy": 0,
@@ -121,7 +146,9 @@
"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,
@@ -132,19 +159,24 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "over_heads",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Operating Costs",
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
"permlevel": 0,
"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,
@@ -155,13 +187,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "per hour",
"fieldname": "hour_rate_electricity",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Electricity Cost",
"length": 0,
"no_copy": 0,
@@ -169,7 +204,9 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"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,
@@ -180,13 +217,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "per hour",
"fieldname": "hour_rate_consumable",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Consumable Cost",
"length": 0,
"no_copy": 0,
@@ -194,7 +234,9 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"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,
@@ -205,18 +247,23 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_11",
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 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,
@@ -227,13 +274,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "per hour",
"fieldname": "hour_rate_rent",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Rent Cost",
"length": 0,
"no_copy": 0,
@@ -241,7 +291,9 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"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,
@@ -252,13 +304,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "Wages per hour",
"fieldname": "hour_rate_labour",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Wages",
"length": 0,
"no_copy": 0,
@@ -266,7 +321,9 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"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,
@@ -277,13 +334,16 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"description": "per hour",
"fieldname": "hour_rate",
"fieldtype": "Currency",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Net Hour Rate",
"length": 0,
"no_copy": 0,
@@ -291,7 +351,9 @@
"oldfieldtype": "Currency",
"permlevel": 0,
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
+ "remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
@@ -302,19 +364,24 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "working_hours_section",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Working Hours",
"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,
@@ -325,12 +392,15 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "working_hours",
"fieldtype": "Table",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Working Hours",
"length": 0,
"no_copy": 0,
@@ -338,7 +408,9 @@
"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,
@@ -348,15 +420,16 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
- "icon": "fa fa-wrench",
+ "icon": "icon-wrench",
"idx": 1,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2015-11-16 06:30:01.041198",
+ "modified": "2016-12-13 05:04:54.668633",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Workstation",
@@ -372,6 +445,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -383,6 +457,9 @@
"write": 1
}
],
+ "quick_entry": 0,
"read_only": 0,
- "read_only_onload": 0
+ "read_only_onload": 0,
+ "sort_order": "ASC",
+ "track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/manufacturing/doctype/workstation/workstation.py b/erpnext/manufacturing/doctype/workstation/workstation.py
index 5095784..dd1c9f2 100644
--- a/erpnext/manufacturing/doctype/workstation/workstation.py
+++ b/erpnext/manufacturing/doctype/workstation/workstation.py
@@ -58,6 +58,9 @@
def is_within_operating_hours(workstation, operation, from_datetime, to_datetime):
operation_length = time_diff_in_seconds(to_datetime, from_datetime)
workstation = frappe.get_doc("Workstation", workstation)
+
+ if not workstation.working_hours:
+ return
for working_hour in workstation.working_hours:
if working_hour.start_time and working_hour.end_time:
diff --git a/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json b/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json
index b9cd174..89ca714 100644
--- a/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json
+++ b/erpnext/manufacturing/doctype/workstation_working_hour/workstation_working_hour.json
@@ -9,11 +9,13 @@
"doctype": "DocType",
"document_type": "",
"editable_grid": 1,
+ "engine": "InnoDB",
"fields": [
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "start_time",
"fieldtype": "Time",
"hidden": 0,
@@ -21,6 +23,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Start Time",
"length": 0,
"no_copy": 0,
@@ -29,6 +32,7 @@
"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,
@@ -39,6 +43,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_2",
"fieldtype": "Column Break",
"hidden": 0,
@@ -46,6 +51,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -53,6 +59,7 @@
"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,
@@ -63,6 +70,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "end_time",
"fieldtype": "Time",
"hidden": 0,
@@ -70,6 +78,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "End Time",
"length": 0,
"no_copy": 0,
@@ -78,6 +87,7 @@
"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,
@@ -88,30 +98,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "fieldname": "section_break_2",
- "fieldtype": "Column Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "length": 0,
- "no_copy": 0,
- "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,
- "collapsible": 0,
+ "columns": 0,
"default": "1",
"fieldname": "enabled",
"fieldtype": "Check",
@@ -120,6 +107,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Enabled",
"length": 0,
"no_copy": 0,
@@ -128,6 +116,7 @@
"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,
@@ -145,7 +134,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-11 03:28:10.225704",
+ "modified": "2016-12-13 05:02:36.754145",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Workstation Working Hour",
diff --git a/erpnext/patches.txt b/erpnext/patches.txt
index 94212ec..aad8d42 100644
--- a/erpnext/patches.txt
+++ b/erpnext/patches.txt
@@ -355,4 +355,6 @@
erpnext.patches.v7_1.update_bom_base_currency
erpnext.patches.v7_0.update_status_of_po_so
erpnext.patches.v7_1.set_budget_against_as_cost_center
-erpnext.patches.v7_1.set_currency_exchange_date
\ No newline at end of file
+erpnext.patches.v7_1.set_currency_exchange_date
+erpnext.patches.v7_1.set_sales_person_status
+erpnext.patches.v7_1.repost_stock_for_deleted_bins_for_merging_items
diff --git a/erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py b/erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py
new file mode 100644
index 0000000..5c63c00
--- /dev/null
+++ b/erpnext/patches/v7_1/repost_stock_for_deleted_bins_for_merging_items.py
@@ -0,0 +1,41 @@
+from __future__ import unicode_literals
+import frappe
+from erpnext.stock.stock_balance import repost_stock
+
+def execute():
+ modified_items = frappe.db.sql_list("""
+ select name from `tabItem`
+ where is_stock_item=1 and modified >= '2016-10-31'
+ """)
+
+ if not modified_items:
+ return
+
+ item_warehouses_with_transactions = []
+ transactions = ("Sales Order Item", "Material Request Item", "Purchase Order Item",
+ "Stock Ledger Entry", "Packed Item")
+
+ for doctype in transactions:
+ item_warehouses_with_transactions += list(frappe.db.sql("""
+ select distinct item_code, warehouse
+ from `tab{0}` where docstatus=1 and item_code in ({1})"""
+ .format(doctype, ', '.join(['%s']*len(modified_items))), tuple(modified_items)))
+
+ item_warehouses_with_transactions += list(frappe.db.sql("""
+ select distinct production_item, fg_warehouse
+ from `tabProduction Order` where docstatus=1 and production_item in ({0})"""
+ .format(', '.join(['%s']*len(modified_items))), tuple(modified_items)))
+
+ item_warehouses_with_transactions += list(frappe.db.sql("""
+ select distinct pr_item.item_code, pr.source_warehouse
+ from `tabProduction Order` pr, `tabProduction Order Item` pr_item
+ where pr_item.parent and pr.name and pr.docstatus=1 and pr_item.item_code in ({0})"""
+ .format(', '.join(['%s']*len(modified_items))), tuple(modified_items)))
+
+ item_warehouses_with_bin = list(frappe.db.sql("select distinct item_code, warehouse from `tabBin`"))
+
+ item_warehouses_with_missing_bin = list(
+ set(item_warehouses_with_transactions) - set(item_warehouses_with_bin))
+
+ for item_code, warehouse in item_warehouses_with_missing_bin:
+ repost_stock(item_code, warehouse)
diff --git a/erpnext/patches/v7_1/set_sales_person_status.py b/erpnext/patches/v7_1/set_sales_person_status.py
new file mode 100644
index 0000000..929beac
--- /dev/null
+++ b/erpnext/patches/v7_1/set_sales_person_status.py
@@ -0,0 +1,8 @@
+from __future__ import unicode_literals
+import frappe
+
+def execute():
+ frappe.reload_doc('setup','doctype','sales_person')
+ frappe.db.sql("""update `tabSales Person` set enabled=1
+ where (employee is null or employee = ''
+ or employee IN (select employee from tabEmployee where status != "Left"))""")
diff --git a/erpnext/projects/doctype/activity_type/activity_type.json b/erpnext/projects/doctype/activity_type/activity_type.json
index fb6d1b2..65a0fa1 100644
--- a/erpnext/projects/doctype/activity_type/activity_type.json
+++ b/erpnext/projects/doctype/activity_type/activity_type.json
@@ -15,6 +15,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "activity_type",
"fieldtype": "Data",
"hidden": 0,
@@ -22,6 +23,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Activity Type",
"length": 0,
"no_copy": 0,
@@ -29,6 +31,7 @@
"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,
@@ -39,6 +42,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "costing_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -46,6 +50,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Costing Rate",
"length": 0,
"no_copy": 0,
@@ -54,6 +59,7 @@
"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,
@@ -64,6 +70,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "column_break_3",
"fieldtype": "Column Break",
"hidden": 0,
@@ -71,6 +78,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"length": 0,
"no_copy": 0,
"permlevel": 0,
@@ -78,6 +86,7 @@
"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,
@@ -88,6 +97,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "billing_rate",
"fieldtype": "Currency",
"hidden": 0,
@@ -95,6 +105,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Default Billing Rate",
"length": 0,
"no_copy": 0,
@@ -103,6 +114,7 @@
"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,
@@ -112,7 +124,7 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
- "icon": "fa fa-flag",
+ "icon": "icon-flag",
"idx": 1,
"image_view": 0,
"in_create": 0,
@@ -121,7 +133,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-08-22 08:53:43.680463",
+ "modified": "2016-12-13 12:38:18.218618",
"modified_by": "Administrator",
"module": "Projects",
"name": "Activity Type",
@@ -137,6 +149,7 @@
"export": 1,
"if_owner": 0,
"import": 1,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -157,6 +170,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -166,6 +180,27 @@
"share": 1,
"submit": 0,
"write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 0,
+ "delete": 0,
+ "email": 0,
+ "export": 0,
+ "if_owner": 0,
+ "import": 0,
+ "is_custom": 0,
+ "permlevel": 0,
+ "print": 0,
+ "read": 1,
+ "report": 0,
+ "role": "Employee",
+ "set_user_permissions": 0,
+ "share": 0,
+ "submit": 0,
+ "write": 0
}
],
"quick_entry": 1,
diff --git a/erpnext/projects/doctype/task/task.js b/erpnext/projects/doctype/task/task.js
index c6b6664..7c4eb80 100644
--- a/erpnext/projects/doctype/task/task.js
+++ b/erpnext/projects/doctype/task/task.js
@@ -67,4 +67,12 @@
});
+cur_frm.fields_dict['depends_on'].grid.get_field('task').get_query = function(doc) {
+ if(doc.project) {
+ return {
+ filters: {'project': doc.project}
+ }
+ }
+}
+
cur_frm.add_fetch('task', 'subject', 'subject');
diff --git a/erpnext/public/build.json b/erpnext/public/build.json
index ac1c7c3..30b0900 100644
--- a/erpnext/public/build.json
+++ b/erpnext/public/build.json
@@ -1,37 +1,38 @@
{
- "css/erpnext.css": [
- "public/css/erpnext.css"
- ],
- "js/erpnext-web.min.js": [
- "public/js/website_utils.js",
- "public/js/shopping_cart.js"
- ],
- "js/erpnext.min.js": [
- "public/js/conf.js",
- "public/js/utils.js",
- "public/js/queries.js",
- "public/js/sms_manager.js",
- "public/js/utils/party.js",
- "public/js/templates/address_list.html",
- "public/js/templates/contact_list.html",
- "public/js/controllers/stock_controller.js",
- "public/js/payment/payments.js",
- "public/js/controllers/taxes_and_totals.js",
- "public/js/controllers/transaction.js",
- "public/js/pos/pos.html",
- "public/js/pos/pos_bill_item.html",
- "public/js/pos/pos_item.html",
- "public/js/pos/pos_tax_row.html",
- "public/js/pos/pos_invoice_list.html",
- "public/js/payment/pos_payment.html",
- "public/js/payment/payment_details.html",
- "public/js/templates/item_selector.html",
- "public/js/utils/item_selector.js",
- "public/js/help_links.js"
- ],
- "js/item-dashboard.min.js": [
- "stock/dashboard/item_dashboard.html",
- "stock/dashboard/item_dashboard_list.html",
- "stock/dashboard/item_dashboard.js"
- ]
-}
+ "css/erpnext.css": [
+ "public/css/erpnext.css"
+ ],
+ "js/erpnext-web.min.js": [
+ "public/js/website_utils.js",
+ "public/js/shopping_cart.js"
+ ],
+ "js/erpnext.min.js": [
+ "public/js/conf.js",
+ "public/js/utils.js",
+ "public/js/queries.js",
+ "public/js/sms_manager.js",
+ "public/js/utils/party.js",
+ "public/js/templates/address_list.html",
+ "public/js/templates/contact_list.html",
+ "public/js/controllers/stock_controller.js",
+ "public/js/payment/payments.js",
+ "public/js/controllers/taxes_and_totals.js",
+ "public/js/controllers/transaction.js",
+ "public/js/pos/pos.html",
+ "public/js/pos/pos_bill_item.html",
+ "public/js/pos/pos_item.html",
+ "public/js/pos/pos_tax_row.html",
+ "public/js/pos/pos_invoice_list.html",
+ "public/js/payment/pos_payment.html",
+ "public/js/payment/payment_details.html",
+ "public/js/templates/item_selector.html",
+ "public/js/utils/item_selector.js",
+ "public/js/help_links.js",
+ "public/js/schools/student_button.html"
+ ],
+ "js/item-dashboard.min.js": [
+ "stock/dashboard/item_dashboard.html",
+ "stock/dashboard/item_dashboard_list.html",
+ "stock/dashboard/item_dashboard.js"
+ ]
+}
\ No newline at end of file
diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js
index c31b0c8..dcbb56b 100644
--- a/erpnext/public/js/controllers/transaction.js
+++ b/erpnext/public/js/controllers/transaction.js
@@ -902,13 +902,17 @@
get_terms: function() {
var me = this;
if(this.frm.doc.tc_name) {
- return this.frm.call({
- method: "frappe.client.get_value",
+ return frappe.call({
+ method: 'erpnext.setup.doctype.terms_and_conditions.terms_and_conditions.get_terms_and_conditions',
args: {
- doctype: "Terms and Conditions",
- fieldname: "terms",
- filters: { name: this.frm.doc.tc_name },
+ template_name: this.frm.doc.tc_name,
+ doc: this.frm.doc
},
+ callback: function(r) {
+ if(!r.exc) {
+ me.frm.set_value("terms", r.message);
+ }
+ }
});
}
},
diff --git a/erpnext/public/js/pos/pos_invoice_list.html b/erpnext/public/js/pos/pos_invoice_list.html
index 6eecfe3..67110a7 100644
--- a/erpnext/public/js/pos/pos_invoice_list.html
+++ b/erpnext/public/js/pos/pos_invoice_list.html
@@ -1,7 +1,7 @@
<div class="row list-row pos-invoice-list" invoice-name = "{{name}}">
- <div class="col-xs-1">{%= sr %}</div>
- <div class="col-xs-3">{%= customer %}</div>
- <div class="col-xs-2 text-left"><span class="indicator {{data.indicator}}">{{ data.status }}</span></div>
- <div class="col-xs-3 text-right">{%= paid_amount %}</div>
- <div class="col-xs-3 text-right">{%= grand_total %}</div>
+ <div class="col-xs-1"><input class="list-delete" type="checkbox"></div>
+ <div class="list-column col-xs-3">{%= customer %}</div>
+ <div class="list-column col-xs-2 text-left"><span class="indicator {{data.indicator}}">{{ data.status }}</span></div>
+ <div class="list-column col-xs-3 text-right">{%= paid_amount %}</div>
+ <div class="list-column col-xs-3 text-right">{%= grand_total %}</div>
</div>
diff --git a/erpnext/public/js/schools/student_button.html b/erpnext/public/js/schools/student_button.html
new file mode 100644
index 0000000..dabaf26
--- /dev/null
+++ b/erpnext/public/js/schools/student_button.html
@@ -0,0 +1,20 @@
+<div class="col-sm-3">
+ <div class="checkbox {% if status %} text-muted {% endif %}">
+ <label>
+ <input
+ type="checkbox"
+ data-idx="{{idx}}"
+ data-student="{{student}}"
+ data-student-name="{{student_name}}"
+ class="students-check"
+ {% if status %}
+ disabled="true"
+ {% endif %}
+ {% if status === "Present" %}
+ checked
+ {% endif %}
+ >
+ {{ idx }} - {{ student_name }}
+ </label>
+ </div>
+</div>
\ No newline at end of file
diff --git a/erpnext/schools/api.py b/erpnext/schools/api.py
index 7cb02a3..bf09351 100644
--- a/erpnext/schools/api.py
+++ b/erpnext/schools/api.py
@@ -52,8 +52,10 @@
:param student_batch: Student Batch.
:param date: Date.
"""
+
present = json.loads(students_present)
absent = json.loads(students_absent)
+
for d in present:
make_attendance_records(d["student"], d["student_name"], "Present", course_schedule, student_batch, date)
diff --git a/erpnext/schools/doctype/course/course.json b/erpnext/schools/doctype/course/course.json
index cd8362a..6fada19 100644
--- a/erpnext/schools/doctype/course/course.json
+++ b/erpnext/schools/doctype/course/course.json
@@ -219,7 +219,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2016-11-07 05:28:55.089882",
+ "modified": "2016-08-08 05:26:26.442635",
"modified_by": "Administrator",
"module": "Schools",
"name": "Course",
@@ -246,6 +246,26 @@
"share": 1,
"submit": 0,
"write": 1
+ },
+ {
+ "amend": 0,
+ "apply_user_permissions": 0,
+ "cancel": 0,
+ "create": 1,
+ "delete": 1,
+ "email": 1,
+ "export": 1,
+ "if_owner": 0,
+ "import": 0,
+ "permlevel": 0,
+ "print": 1,
+ "read": 1,
+ "report": 1,
+ "role": "HR Manager",
+ "set_user_permissions": 0,
+ "share": 1,
+ "submit": 0,
+ "write": 1
}
],
"quick_entry": 0,
diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.js b/erpnext/schools/doctype/course_schedule/course_schedule.js
index 04a8cde..12e8522 100644
--- a/erpnext/schools/doctype/course_schedule/course_schedule.js
+++ b/erpnext/schools/doctype/course_schedule/course_schedule.js
@@ -1,134 +1,15 @@
frappe.provide("schools")
frappe.ui.form.on("Course Schedule", {
- onload: function(frm) {
- if (frm.doc.from_datetime && frm.doc.to_datetime) {
- var from_datetime = moment(frm.doc.from_datetime);
- var to_datetime = moment(frm.doc.to_datetime);
- frm.doc.schedule_date = from_datetime.format(moment.defaultFormat);
- frm.doc.from_time = from_datetime.format("HH:mm:ss");
- frm.doc.to_time = to_datetime.format("HH:mm:ss");
- }
- },
-
refresh: function(frm) {
- if (!frm.doc.__islocal && frm.doc.student_group) {
- frappe.call({
- method: "erpnext.schools.api.check_attendance_records_exist",
- args: {
- "course_schedule": frm.doc.name
- },
- callback: function(r) {
- if (r.message) {
- hide_field('attendance');
- frm.events.view_attendance(frm)
- } else {
- frappe.call({
- method: "erpnext.schools.api.get_student_group_students",
- args: {
- "student_group": frm.doc.student_group
- },
- callback: function(r) {
- if (r.message) {
- frm.events.get_students(frm, r.message)
- }
- }
- });
- }
+ if (!frm.doc.__islocal) {
+ frm.add_custom_button(__("Attendance"), function() {
+ frappe.route_options = {
+ based_on: "Course Schedule",
+ course_schedule: frm.doc.name
}
+ frappe.set_route("Form", "Student Attendance Tool");
});
- } else {
- hide_field('attendance');
}
- },
-
- view_attendance: function(frm) {
- hide_field('attendance');
- frm.add_custom_button(__("View attendance"), function() {
- frappe.route_options = {
- course_schedule: frm.doc.name
- }
- frappe.set_route("List", "Student Attendance");
- });
- },
-
- get_students: function(frm, students) {
- if (!frm.students_area) {
- frm.students_area = $('<div>')
- .appendTo(frm.fields_dict.students_html.wrapper);
- }
- frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
}
-});
-
-
-schools.StudentsEditor = Class.extend({
- init: function(frm, wrapper, students) {
- this.wrapper = wrapper;
- this.frm = frm;
- this.make(frm, students);
- },
- make: function(frm, students) {
- var me = this;
-
- $(this.wrapper).empty();
- var student_toolbar = $('<p>\
- <button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
- <button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
- <button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
-
- student_toolbar.find(".btn-add")
- .html(__('Check all'))
- .on("click", function() {
- $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
- if (!$(check).is(":checked")) {
- check.checked = true;
- }
- });
- });
-
- student_toolbar.find(".btn-remove")
- .html(__('Uncheck all'))
- .on("click", function() {
- $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
- if ($(check).is(":checked")) {
- check.checked = false;
- }
- });
- });
-
- student_toolbar.find(".btn-mark-att")
- .html(__('Mark Attendence'))
- .on("click", function() {
- var students_present = [];
- var students_absent = [];
- $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
- if ($(check).is(":checked")) {
- students_present.push(students[i]);
- } else {
- students_absent.push(students[i]);
- }
- });
- frappe.call({
- method: "erpnext.schools.api.mark_attendance",
- args: {
- "students_present": students_present,
- "students_absent": students_absent,
- "course_schedule": frm.doc.name
- },
- callback: function(r) {
- frm.events.view_attendance(frm)
- }
- });
- });
-
-
- $.each(students, function(i, m) {
- $(repl('<div class="col-sm-6">\
- <div class="checkbox">\
- <label><input type="checkbox" class="students-check" student="%(student)s">\
- %(student)s</label>\
- </div></div>', { student: m.student_name })).appendTo(me.wrapper);
- });
- }
-})
\ No newline at end of file
+});
\ No newline at end of file
diff --git a/erpnext/schools/doctype/course_schedule/course_schedule.json b/erpnext/schools/doctype/course_schedule/course_schedule.json
index 122285e..450d7cf 100644
--- a/erpnext/schools/doctype/course_schedule/course_schedule.json
+++ b/erpnext/schools/doctype/course_schedule/course_schedule.json
@@ -385,62 +385,6 @@
{
"allow_on_submit": 0,
"bold": 0,
- "collapsible": 1,
- "columns": 0,
- "fieldname": "attendance",
- "fieldtype": "Section Break",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Attendance",
- "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_on_submit": 0,
- "bold": 0,
- "collapsible": 0,
- "columns": 0,
- "fieldname": "students_html",
- "fieldtype": "HTML",
- "hidden": 0,
- "ignore_user_permissions": 0,
- "ignore_xss_filter": 0,
- "in_filter": 0,
- "in_list_view": 0,
- "in_standard_filter": 0,
- "label": "Students HTML",
- "length": 0,
- "no_copy": 0,
- "permlevel": 0,
- "precision": "",
- "print_hide": 0,
- "print_hide_if_no_value": 0,
- "read_only": 1,
- "remember_last_selected_value": 0,
- "report_hide": 0,
- "reqd": 0,
- "search_index": 0,
- "set_only_once": 0,
- "unique": 0
- },
- {
- "allow_on_submit": 0,
- "bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "title",
@@ -478,7 +422,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2016-12-01 12:59:25.086606",
+ "modified": "2016-12-09 17:00:02.822788",
"modified_by": "Administrator",
"module": "Schools",
"name": "Course Schedule",
diff --git a/erpnext/schools/doctype/student_attendance/student_attendance.py b/erpnext/schools/doctype/student_attendance/student_attendance.py
index 45b3014..e2d01b5 100644
--- a/erpnext/schools/doctype/student_attendance/student_attendance.py
+++ b/erpnext/schools/doctype/student_attendance/student_attendance.py
@@ -31,9 +31,9 @@
(self.student, self.course_schedule, self.name))
else:
attendance_records= frappe.db.sql("""select name from `tabStudent Attendance` where \
- student= %s and date= %s and name != %s and docstatus=1 and \
+ student= %s and student_batch= %s and date= %s and name != %s and docstatus=1 and \
(course_schedule is Null or course_schedule='')""",
- (self.student, self.date, self.name))
+ (self.student, self.student_batch, self.date, self.name))
if attendance_records:
frappe.throw(_("Attendance Record {0} exists against Student {1}")
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/__init__.py b/erpnext/schools/doctype/student_attendance_tool/__init__.py
similarity index 100%
rename from erpnext/schools/doctype/student_batch_attendance_tool/__init__.py
rename to erpnext/schools/doctype/student_attendance_tool/__init__.py
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
new file mode 100644
index 0000000..7dd9dda
--- /dev/null
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.js
@@ -0,0 +1,150 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+frappe.provide("schools")
+
+frappe.ui.form.on('Student Attendance Tool', {
+ refresh: function(frm) {
+ frm.disable_save();
+ },
+
+ based_on: function(frm) {
+ if (frm.doc.based_on == "Student Batch") {
+ frm.set_value("course_schedule", "");
+ } else {
+ frm.set_value("student_batch", "");
+ }
+ },
+
+ student_batch: function(frm) {
+ if ((frm.doc.student_batch && frm.doc.date) || frm.doc.course_schedule) {
+ var method = "erpnext.schools.doctype.student_attendance_tool.student_attendance_tool.get_student_attendance_records";
+
+ frappe.call({
+ method: method,
+ args: {
+ based_on: frm.doc.based_on,
+ student_batch: frm.doc.student_batch,
+ date: frm.doc.date,
+ course_schedule: frm.doc.course_schedule
+ },
+ callback: function(r) {
+ frm.events.get_students(frm, r.message);
+ }
+ })
+ }
+ },
+
+ date: function(frm) {
+ frm.trigger("student_batch");
+ },
+
+ course_schedule: function(frm) {
+ frm.trigger("student_batch");
+ },
+
+ get_students: function(frm, students) {
+ if (!frm.students_area) {
+ frm.students_area = $('<div>')
+ .appendTo(frm.fields_dict.students_html.wrapper);
+ }
+ frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
+ }
+});
+
+
+schools.StudentsEditor = Class.extend({
+ init: function(frm, wrapper, students) {
+ this.wrapper = wrapper;
+ this.frm = frm;
+ this.make(frm, students);
+ },
+ make: function(frm, students) {
+ var me = this;
+
+ $(this.wrapper).empty();
+ var student_toolbar = $('<p>\
+ <button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
+ <button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
+ <button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
+
+ student_toolbar.find(".btn-add")
+ .html(__('Check all'))
+ .on("click", function() {
+ $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+ if (!$(check).prop("disabled")) {
+ check.checked = true;
+ }
+ });
+ });
+
+ student_toolbar.find(".btn-remove")
+ .html(__('Uncheck all'))
+ .on("click", function() {
+ $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
+ if (!$(check).prop("disabled")) {
+ check.checked = false;
+ }
+ });
+ });
+
+ var get_present_student = function(student) {
+ return students.filter(function(s) {
+ return s.idx === idx;
+ })
+ }
+ var get_absent_student = function(idx) {
+ return students.filter(function(s) {
+ return s.idx === idx;
+ })
+ }
+
+ student_toolbar.find(".btn-mark-att")
+ .html(__('Mark Attendence'))
+ .on("click", function() {
+ var studs = [];
+ $(me.wrapper.find('input[type="checkbox"]')).each(function(i, check) {
+ var $check = $(check);
+ studs.push({
+ student: $check.data().student,
+ student_name: $check.data().studentName,
+ idx: $check.data().idx,
+ disabled: $check.prop("disabled"),
+ checked: $check.is(":checked")
+ });
+ });
+
+ var students_present = studs.filter(function(stud) {
+ return !stud.disabled && stud.checked;
+ });
+
+ var students_absent = studs.filter(function(stud) {
+ return !stud.disabled && !stud.checked;
+ });
+
+ frappe.call({
+ method: "erpnext.schools.api.mark_attendance",
+ args: {
+ "students_present": students_present,
+ "students_absent": students_absent,
+ "student_batch": frm.doc.student_batch,
+ "course_schedule": frm.doc.course_schedule,
+ "date": frm.doc.date
+ },
+ callback: function(r) {
+ frm.trigger("student_batch");
+ }
+ });
+ });
+
+ var htmls = students.map(function(student) {
+ return frappe.render_template("student_button", {
+ student: student.student,
+ student_name: student.student_name,
+ idx: student.idx,
+ status: student.status
+ })
+ });
+
+ $(htmls.join("")).appendTo(me.wrapper);
+ }
+});
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
similarity index 72%
rename from erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json
rename to erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
index defc886..092af04 100644
--- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.json
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.json
@@ -16,18 +16,19 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "fieldname": "student_batch",
- "fieldtype": "Link",
+ "default": "",
+ "fieldname": "based_on",
+ "fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"in_standard_filter": 0,
- "label": "Student Batch",
+ "label": "Based On",
"length": 0,
"no_copy": 0,
- "options": "Student Batch",
+ "options": "Student Batch\nCourse Schedule",
"permlevel": 0,
"precision": "",
"print_hide": 0,
@@ -35,7 +36,7 @@
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
- "reqd": 1,
+ "reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
@@ -72,6 +73,67 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "depends_on": "eval:doc.based_on ==\"Student Batch\"",
+ "fieldname": "student_batch",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Student Batch",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Student Batch",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.based_on ==\"Course Schedule\"",
+ "fieldname": "course_schedule",
+ "fieldtype": "Link",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Course Schedule",
+ "length": 0,
+ "no_copy": 0,
+ "options": "Course Schedule",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "depends_on": "eval:doc.based_on ==\"Student Batch\"",
"fieldname": "date",
"fieldtype": "Date",
"hidden": 0,
@@ -100,7 +162,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
- "depends_on": "",
+ "depends_on": "eval: (doc.course_schedule \n|| (doc.student_batch && doc.date))",
"fieldname": "attendance",
"fieldtype": "Section Break",
"hidden": 0,
@@ -163,10 +225,10 @@
"issingle": 1,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-12-01 12:58:31.822014",
+ "modified": "2016-12-09 17:36:28.739318",
"modified_by": "Administrator",
"module": "Schools",
- "name": "Student Batch Attendance Tool",
+ "name": "Student Attendance Tool",
"name_case": "",
"owner": "Administrator",
"permissions": [
diff --git a/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
new file mode 100644
index 0000000..30a692c
--- /dev/null
+++ b/erpnext/schools/doctype/student_attendance_tool/student_attendance_tool.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+from frappe.model.document import Document
+
+class StudentAttendanceTool(Document):
+ pass
+
+@frappe.whitelist()
+def get_student_attendance_records(based_on, date=None, student_batch=None, course_schedule=None):
+ student_list = []
+ student_attendance_list = []
+
+ if based_on=="Course Schedule":
+ student_group = frappe.db.get_value("Course Schedule", course_schedule, "student_group")
+ if student_group:
+ student_list = frappe.get_list("Student Group Student", fields=["student", "student_name", "idx"] , \
+ filters={"parent": student_group}, order_by= "idx")
+ else:
+ student_batch = frappe.db.get_value("Course Schedule", course_schedule, "student_batch")
+ if not student_list:
+ student_list = frappe.get_list("Student Batch Student", fields=["student", "student_name", "idx"] , filters={"parent": student_batch}, order_by= "idx")
+
+ if course_schedule:
+ student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
+ course_schedule= %s and docstatus=1""", (course_schedule), as_dict=1)
+ else:
+ student_attendance_list= frappe.db.sql("""select student, status from `tabStudent Attendance` where \
+ student_batch= %s and date= %s and docstatus=1 and \
+ (course_schedule is Null or course_schedule='')""",
+ (student_batch, date), as_dict=1)
+
+ for attendance in student_attendance_list:
+ for student in student_list:
+ if student.student == attendance.student:
+ student.status = attendance.status
+ return student_list
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js b/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js
deleted file mode 100644
index 2dc6a85..0000000
--- a/erpnext/schools/doctype/student_batch_attendance_tool/student_batch_attendance_tool.js
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
-// For license information, please see license.txt
-frappe.provide("schools")
-
-frappe.ui.form.on('Student Batch Attendance Tool', {
- refresh: function(frm) {
- frm.disable_save();
- hide_field('attendance');
- },
-
- student_batch: function(frm) {
- if (frm.doc.student_batch && frm.doc.date) {
- frappe.call({
- method: "erpnext.schools.api.check_attendance_records_exist",
- args: {
- "student_batch": frm.doc.student_batch,
- "date": frm.doc.date
- },
- callback: function(r) {
- if (r.message) {
- frappe.msgprint("Attendance already marked.");
- hide_field('attendance');
- } else {
- frappe.call({
- method: "erpnext.schools.api.get_student_batch_students",
- args: {
- "student_batch": frm.doc.student_batch
- },
- callback: function(r) {
- if (r.message) {
- unhide_field('attendance');
- frm.events.get_students(frm, r.message)
- }
- }
- });
- }
- }
- });
- }
- },
-
- date: function(frm) {
- frm.trigger("student_batch");
- },
-
- get_students: function(frm, students) {
- if (!frm.students_area) {
- frm.students_area = $('<div>')
- .appendTo(frm.fields_dict.students_html.wrapper);
- }
- frm.students_editor = new schools.StudentsEditor(frm, frm.students_area, students)
- }
-});
-
-
-schools.StudentsEditor = Class.extend({
- init: function(frm, wrapper, students) {
- this.wrapper = wrapper;
- this.frm = frm;
- this.make(frm, students);
- },
- make: function(frm, students) {
- var me = this;
-
- $(this.wrapper).empty();
- var student_toolbar = $('<p>\
- <button class="btn btn-default btn-add btn-xs" style="margin-right: 5px;"></button>\
- <button class="btn btn-xs btn-default btn-remove" style="margin-right: 5px;"></button>\
- <button class="btn btn-default btn-primary btn-mark-att btn-xs"></button></p>').appendTo($(this.wrapper));
-
- student_toolbar.find(".btn-add")
- .html(__('Check all'))
- .on("click", function() {
- $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
- if (!$(check).is(":checked")) {
- check.checked = true;
- }
- });
- });
-
- student_toolbar.find(".btn-remove")
- .html(__('Uncheck all'))
- .on("click", function() {
- $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
- if ($(check).is(":checked")) {
- check.checked = false;
- }
- });
- });
-
- var get_student = function(idx) {
- return students.filter(function(s) {
- return s.idx === idx;
- })[0]
- }
-
- student_toolbar.find(".btn-mark-att")
- .html(__('Mark Attendence'))
- .on("click", function() {
- var students_present = [];
- var students_absent = [];
- $(me.wrapper).find('input[type="checkbox"]').each(function(i, check) {
- var idx = $(check).data().idx;
- if ($(check).is(":checked")) {
- students_present.push(get_student(idx));
- } else {
- students_absent.push(get_student(idx));
- }
- });
- frappe.call({
- method: "erpnext.schools.api.mark_attendance",
- args: {
- "students_present": students_present,
- "students_absent": students_absent,
- "student_batch": frm.doc.student_batch,
- "date": frm.doc.date
- },
- callback: function(r) {
- hide_field('attendance');
- }
- });
- });
-
-
- $.each(students, function(i, m) {
- $(repl('<div class="col-sm-6">\
- <div class="checkbox">\
- <label><input data-idx="%(idx)s" type="checkbox" class="students-check" data-student="%(name)s">\
- %(idx)s - %(name)s</label>\
- </div></div>', {
- name: m.student_name,
- idx: m.idx
- })).appendTo(me.wrapper);
- });
- }
-});
\ No newline at end of file
diff --git a/erpnext/setup/doctype/sales_person/sales_person.json b/erpnext/setup/doctype/sales_person/sales_person.json
index 1665ba5..595552e 100644
--- a/erpnext/setup/doctype/sales_person/sales_person.json
+++ b/erpnext/setup/doctype/sales_person/sales_person.json
@@ -29,7 +29,7 @@
"label": "Name and Employee ID",
"length": 0,
"no_copy": 0,
- "options": "fa fa-user",
+ "options": "icon-user",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -190,6 +190,35 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
+ "default": "1",
+ "fieldname": "enabled",
+ "fieldtype": "Check",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Enabled",
+ "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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
"fieldname": "lft",
"fieldtype": "Int",
"hidden": 1,
@@ -290,7 +319,7 @@
"length": 0,
"no_copy": 0,
"oldfieldtype": "Section Break",
- "options": "fa fa-bullseye",
+ "options": "icon-bullseye",
"permlevel": 0,
"print_hide": 0,
"print_hide_if_no_value": 0,
@@ -366,7 +395,7 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
- "icon": "fa fa-user",
+ "icon": "icon-user",
"idx": 1,
"image_view": 0,
"in_create": 0,
@@ -375,7 +404,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-11-07 05:29:29.299529",
+ "modified": "2016-12-12 18:47:13.924225",
"modified_by": "Administrator",
"module": "Setup",
"name": "Sales Person",
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
index ce057c2..bede595 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.json
@@ -16,6 +16,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
@@ -23,6 +24,7 @@
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Title",
"length": 0,
"no_copy": 1,
@@ -32,6 +34,7 @@
"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,
@@ -42,6 +45,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "disabled",
"fieldtype": "Check",
"hidden": 0,
@@ -49,6 +53,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
+ "in_standard_filter": 0,
"label": "Disabled",
"length": 0,
"no_copy": 0,
@@ -57,6 +62,7 @@
"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,
@@ -67,6 +73,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
+ "columns": 0,
"fieldname": "terms",
"fieldtype": "Text Editor",
"hidden": 0,
@@ -74,6 +81,7 @@
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
+ "in_standard_filter": 0,
"label": "Terms and Conditions",
"length": 0,
"no_copy": 0,
@@ -83,6 +91,36 @@
"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_on_submit": 0,
+ "bold": 0,
+ "collapsible": 0,
+ "columns": 0,
+ "fieldname": "terms_and_conditions_help",
+ "fieldtype": "HTML",
+ "hidden": 0,
+ "ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
+ "in_filter": 0,
+ "in_list_view": 0,
+ "in_standard_filter": 0,
+ "label": "Terms and Conditions Help",
+ "length": 0,
+ "no_copy": 0,
+ "options": "<h4>Standard Terms and Conditions Example</h4>\n\n<pre>Delivery Terms for Order number {{ name }}\n\n-Order Date : {{ transaction_date }} \n-Expected Delivery Date : {{ delivery_date }}\n</pre>\n\n<h4>How to get fieldnames</h4>\n\n<p>The fieldnames you can use in your standard reply are the fields in the document from which you are sending the email. You can find out the fields of any documents via Setup > Customize Form View and selecting the document type (e.g. Sales Invoice)</p>\n\n<h4>Templating</h4>\n\n<p>Templates are compiled using the Jinja Templating Langauge. To learn more about Jinja, <a class=\"strong\" href=\"http://jinja.pocoo.org/docs/dev/templates/\">read this documentation.</a></p>",
+ "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,
@@ -92,7 +130,7 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
- "icon": "fa fa-legal",
+ "icon": "icon-legal",
"idx": 1,
"image_view": 0,
"in_create": 0,
@@ -101,7 +139,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-07-25 05:24:25.093905",
+ "modified": "2016-12-12 17:31:53.349301",
"modified_by": "Administrator",
"module": "Setup",
"name": "Terms and Conditions",
@@ -117,6 +155,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -137,6 +176,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -157,6 +197,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -177,6 +218,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -197,6 +239,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 1,
"read": 1,
@@ -217,6 +260,7 @@
"export": 0,
"if_owner": 0,
"import": 0,
+ "is_custom": 0,
"permlevel": 0,
"print": 0,
"read": 1,
@@ -231,5 +275,6 @@
"quick_entry": 1,
"read_only": 0,
"read_only_onload": 0,
+ "sort_order": "ASC",
"track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
index 52f5156..d2b68b4 100644
--- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
+++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.py
@@ -3,8 +3,18 @@
from __future__ import unicode_literals
import frappe
-
+import json
from frappe.model.document import Document
+from frappe.utils.jinja import validate_template
class TermsandConditions(Document):
- pass
\ No newline at end of file
+ def validate(self):
+ validate_template(self.terms)
+
+@frappe.whitelist()
+def get_terms_and_conditions(template_name, doc):
+ if isinstance(doc, basestring):
+ doc = json.loads(doc)
+
+ terms_and_conditions = frappe.get_doc("Terms and Conditions", template_name)
+ return frappe.render_template(terms_and_conditions.terms, doc)
\ No newline at end of file
diff --git a/erpnext/stock/doctype/item/item.json b/erpnext/stock/doctype/item/item.json
index bad8416..5d2d557 100644
--- a/erpnext/stock/doctype/item/item.json
+++ b/erpnext/stock/doctype/item/item.json
@@ -343,7 +343,7 @@
"columns": 0,
"depends_on": "eval:(doc.__islocal&&doc.is_stock_item && !doc.has_serial_no && !doc.has_batch_no)",
"fieldname": "opening_stock",
- "fieldtype": "Int",
+ "fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
@@ -2683,7 +2683,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 1,
- "modified": "2016-11-18 02:19:54.507883",
+ "modified": "2016-12-13 02:19:54.507883",
"modified_by": "Administrator",
"module": "Stock",
"name": "Item",
diff --git a/erpnext/stock/doctype/item/item.py b/erpnext/stock/doctype/item/item.py
index 3d248d1..98d0ebc 100644
--- a/erpnext/stock/doctype/item/item.py
+++ b/erpnext/stock/doctype/item/item.py
@@ -532,8 +532,6 @@
frappe.throw(_("To merge, following properties must be same for both items")
+ ": \n" + ", ".join([self.meta.get_label(fld) for fld in field_list]))
- frappe.db.sql("delete from `tabBin` where item_code=%s", old_name)
-
def after_rename(self, old_name, new_name, merge):
if self.route:
invalidate_cache_for_item(self)
@@ -567,8 +565,14 @@
existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
- for warehouse in frappe.db.sql("select warehouse from `tabBin` where item_code=%s", new_name):
- repost_stock(new_name, warehouse[0])
+ repost_stock_for_warehouses = frappe.db.sql_list("""select distinct warehouse
+ from tabBin where item_code=%s""", new_name)
+
+ # Delete all existing bins to avoid duplicate bins for the same item and warehouse
+ frappe.db.sql("delete from `tabBin` where item_code=%s", new_name)
+
+ for warehouse in repost_stock_for_warehouses:
+ repost_stock(new_name, warehouse)
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)
frappe.db.auto_commit_on_many_writes = 0
diff --git a/erpnext/stock/doctype/item/test_item.py b/erpnext/stock/doctype/item/test_item.py
index aceefc0..706fd5a 100644
--- a/erpnext/stock/doctype/item/test_item.py
+++ b/erpnext/stock/doctype/item/test_item.py
@@ -9,6 +9,9 @@
from erpnext.controllers.item_variant import (create_variant, ItemVariantExistsError,
InvalidItemAttributeValueError)
+from frappe.model.rename_doc import rename_doc
+from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
+
test_ignore = ["BOM"]
test_dependencies = ["Warehouse"]
@@ -164,11 +167,31 @@
variant.item_name = "_Test Numeric Variant Large 1.1m"
self.assertRaises(InvalidItemAttributeValueError, variant.save)
- variant = create_variant("_Test Numeric Template Item", {"Test Size": "Large", "Test Item Length": 1.5})
+ variant = create_variant("_Test Numeric Template Item",
+ {"Test Size": "Large", "Test Item Length": 1.5})
self.assertEquals(variant.item_code, None)
variant.item_code = "_Test Numeric Variant-L-1.5"
variant.item_name = "_Test Numeric Variant Large 1.5m"
variant.save()
+
+ def test_item_merging(self):
+ create_item("Test Item for Merging 1")
+ create_item("Test Item for Merging 2")
+
+ make_stock_entry(item_code="Test Item for Merging 1", target="_Test Warehouse - _TC",
+ qty=1, rate=100)
+ make_stock_entry(item_code="Test Item for Merging 2", target="_Test Warehouse 1 - _TC",
+ qty=1, rate=100)
+
+ rename_doc("Item", "Test Item for Merging 1", "Test Item for Merging 2", merge=True)
+
+ self.assertFalse(frappe.db.exists("Item", "Test Item for Merging 1"))
+
+ self.assertTrue(frappe.db.get_value("Bin",
+ {"item_code": "Test Item for Merging 2", "warehouse": "_Test Warehouse - _TC"}))
+
+ self.assertTrue(frappe.db.get_value("Bin",
+ {"item_code": "Test Item for Merging 2", "warehouse": "_Test Warehouse 1 - _TC"}))
def make_item_variant():
if not frappe.db.exists("Item", "_Test Variant Item-S"):
@@ -184,3 +207,14 @@
return total_qty[0].projected_qty if total_qty else 0.0
test_records = frappe.get_test_records('Item')
+
+def create_item(item_code, is_stock_item=None):
+ if not frappe.db.exists("Item", item_code):
+ item = frappe.new_doc("Item")
+ item.item_code = item_code
+ item.item_name = item_code
+ item.description = item_code
+ item.item_group = "All Item Groups"
+ item.is_stock_item = is_stock_item or 1
+ item.save()
+
\ No newline at end of file
diff --git a/erpnext/stock/doctype/warehouse/test_warehouse.py b/erpnext/stock/doctype/warehouse/test_warehouse.py
index 2232584..edc5400 100644
--- a/erpnext/stock/doctype/warehouse/test_warehouse.py
+++ b/erpnext/stock/doctype/warehouse/test_warehouse.py
@@ -1,7 +1,10 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
-
+from frappe.model.rename_doc import rename_doc
+from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry
+from frappe.utils import cint
+from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
import frappe
import unittest
@@ -21,5 +24,77 @@
for child_warehouse in child_warehouses:
self.assertEquals(p_warehouse.name, child_warehouse.parent_warehouse)
self.assertEquals(child_warehouse.is_group, 0)
+
+ def test_warehouse_renaming(self):
+ set_perpetual_inventory(1)
+ create_warehouse("Test Warehouse for Renaming 1")
+ self.assertTrue(frappe.db.exists("Account", "Test Warehouse for Renaming 1 - _TC"))
+ self.assertTrue(frappe.db.get_value("Account",
+ filters={"warehouse": "Test Warehouse for Renaming 1 - _TC"}))
+ # Rename with abbr
+ if frappe.db.exists("Warehouse", "Test Warehouse for Renaming 2 - _TC"):
+ frappe.delete_doc("Warehouse", "Test Warehouse for Renaming 2 - _TC")
+ rename_doc("Warehouse", "Test Warehouse for Renaming 1 - _TC", "Test Warehouse for Renaming 2 - _TC")
+
+ self.assertTrue(frappe.db.exists("Account", "Test Warehouse for Renaming 2 - _TC"))
+ self.assertTrue(frappe.db.get_value("Account",
+ filters={"warehouse": "Test Warehouse for Renaming 2 - _TC"}))
+
+ # Rename without abbr
+ if frappe.db.exists("Warehouse", "Test Warehouse for Renaming 3 - _TC"):
+ frappe.delete_doc("Warehouse", "Test Warehouse for Renaming 3 - _TC")
+
+ rename_doc("Warehouse", "Test Warehouse for Renaming 2 - _TC", "Test Warehouse for Renaming 3")
+
+ self.assertTrue(frappe.db.exists("Account", "Test Warehouse for Renaming 3 - _TC"))
+ self.assertTrue(frappe.db.get_value("Account",
+ filters={"warehouse": "Test Warehouse for Renaming 3 - _TC"}))
+
+ set_perpetual_inventory(0)
+
+ def test_warehouse_merging(self):
+ set_perpetual_inventory(1)
+
+ create_warehouse("Test Warehouse for Merging 1")
+ create_warehouse("Test Warehouse for Merging 2")
+
+ make_stock_entry(item_code="_Test Item", target="Test Warehouse for Merging 1 - _TC",
+ qty=1, rate=100)
+ make_stock_entry(item_code="_Test Item", target="Test Warehouse for Merging 2 - _TC",
+ qty=1, rate=100)
+
+ existing_bin_qty = (
+ cint(frappe.db.get_value("Bin",
+ {"item_code": "_Test Item", "warehouse": "Test Warehouse for Merging 1 - _TC"}, "actual_qty"))
+ + cint(frappe.db.get_value("Bin",
+ {"item_code": "_Test Item", "warehouse": "Test Warehouse for Merging 2 - _TC"}, "actual_qty"))
+ )
+
+ rename_doc("Warehouse", "Test Warehouse for Merging 1 - _TC",
+ "Test Warehouse for Merging 2 - _TC", merge=True)
+
+ self.assertFalse(frappe.db.exists("Warehouse", "Test Warehouse for Merging 1 - _TC"))
+
+ bin_qty = frappe.db.get_value("Bin",
+ {"item_code": "_Test Item", "warehouse": "Test Warehouse for Merging 2 - _TC"}, "actual_qty")
+
+ self.assertEqual(bin_qty, existing_bin_qty)
+
+ self.assertFalse(frappe.db.exists("Account", "Test Warehouse for Merging 1 - _TC"))
+ self.assertTrue(frappe.db.exists("Account", "Test Warehouse for Merging 2 - _TC"))
+ self.assertTrue(frappe.db.get_value("Account",
+ filters={"warehouse": "Test Warehouse for Merging 2 - _TC"}))
+
+ set_perpetual_inventory(0)
+
+def create_warehouse(warehouse_name):
+ if not frappe.db.exists("Warehouse", warehouse_name + " - _TC"):
+ w = frappe.new_doc("Warehouse")
+ w.warehouse_name = warehouse_name
+ w.parent_warehouse = "_Test Warehouse Group - _TC"
+ w.company = "_Test Company"
+ w.save()
+
+
\ No newline at end of file
diff --git a/erpnext/stock/doctype/warehouse/warehouse.py b/erpnext/stock/doctype/warehouse/warehouse.py
index 5d0951b..e01cc0b 100644
--- a/erpnext/stock/doctype/warehouse/warehouse.py
+++ b/erpnext/stock/doctype/warehouse/warehouse.py
@@ -143,9 +143,7 @@
if self.company != frappe.db.get_value("Warehouse", new_warehouse, "company"):
frappe.throw(_("Both Warehouse must belong to same Company"))
- frappe.db.sql("delete from `tabBin` where warehouse=%s", olddn)
-
- self.rename_account_for(olddn, newdn, merge)
+ self.rename_account_for(olddn, new_warehouse, merge)
return new_warehouse
@@ -195,8 +193,14 @@
existing_allow_negative_stock = frappe.db.get_value("Stock Settings", None, "allow_negative_stock")
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", 1)
- for item in frappe.db.sql(""" select distinct item_code from tabBin where warehouse = %s""", newdn):
- repost_stock(item[0], newdn)
+ repost_stock_for_items = frappe.db.sql_list("""select distinct item_code
+ from tabBin where warehouse=%s""", newdn)
+
+ # Delete all existing bins to avoid duplicate bins for the same item and warehouse
+ frappe.db.sql("delete from `tabBin` where warehouse=%s", newdn)
+
+ for item_code in repost_stock_for_items:
+ repost_stock(item_code, newdn)
frappe.db.set_value("Stock Settings", None, "allow_negative_stock", existing_allow_negative_stock)
frappe.db.auto_commit_on_many_writes = 0
diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py
index 16ea58e..7bcad08 100644
--- a/erpnext/stock/get_item_details.py
+++ b/erpnext/stock/get_item_details.py
@@ -172,7 +172,7 @@
"net_amount": 0.0,
"discount_percentage": 0.0,
"supplier": item.default_supplier,
- "delivered_by_supplier": item.delivered_by_supplier,
+ "delivered_by_supplier": item.delivered_by_supplier if args.get("doctype") in ["Sales Order", "Sales Invoice"] else 0,
"is_fixed_asset": item.is_fixed_asset
})
diff --git a/erpnext/support/doctype/warranty_claim/warranty_claim.json b/erpnext/support/doctype/warranty_claim/warranty_claim.json
index 4e63bb6..d1b0b8f 100644
--- a/erpnext/support/doctype/warranty_claim/warranty_claim.json
+++ b/erpnext/support/doctype/warranty_claim/warranty_claim.json
@@ -1124,7 +1124,7 @@
"issingle": 0,
"istable": 0,
"max_attachments": 0,
- "modified": "2016-11-07 05:06:08.638760",
+ "modified": "2016-12-13 11:17:40.538428",
"modified_by": "Administrator",
"module": "Support",
"name": "Warranty Claim",
diff --git a/erpnext/utilities/doctype/address/address.py b/erpnext/utilities/doctype/address/address.py
index 1d215cc..2952531 100644
--- a/erpnext/utilities/doctype/address/address.py
+++ b/erpnext/utilities/doctype/address/address.py
@@ -10,6 +10,7 @@
from frappe.model.document import Document
from jinja2 import TemplateSyntaxError
from frappe.utils.user import is_website_user
+from frappe.model.naming import make_autoname
class Address(Document):
def __setup__(self):
@@ -21,7 +22,10 @@
or self.supplier or self.sales_partner or self.lead
if self.address_title:
- self.name = cstr(self.address_title).strip() + "-" + cstr(self.address_type).strip()
+ self.name = (cstr(self.address_title).strip() + "-" + cstr(self.address_type).strip())
+ if frappe.db.exists("Address", self.name):
+ self.name = make_autoname(cstr(self.address_title).strip() + "-" +
+ cstr(self.address_type).strip() + "-.#")
else:
throw(_("Address Title is mandatory."))