Merge pull request #5822 from nabinhait/fix_106
Unlink payment entries on cancellation of Invoice
diff --git a/erpnext/accounts/doctype/sales_invoice/pos.py b/erpnext/accounts/doctype/sales_invoice/pos.py
index f986eea..605bf09 100644
--- a/erpnext/accounts/doctype/sales_invoice/pos.py
+++ b/erpnext/accounts/doctype/sales_invoice/pos.py
@@ -71,7 +71,7 @@
def update_multi_mode_option(doc, pos_profile):
from frappe.model import default_fields
- if not pos_profile:
+ if not pos_profile or not pos_profile.get('payments'):
for payment in get_mode_of_payment(doc):
payments = doc.append('payments', {})
payments.mode_of_payment = payment.parent
@@ -166,13 +166,14 @@
for docs in doc_list:
for name, doc in docs.items():
- validate_customer(doc)
- validate_item(doc)
- si_doc = frappe.new_doc('Sales Invoice')
- si_doc.offline_pos_name = name
- si_doc.update(doc)
- submit_invoice(si_doc, name)
- name_list.append(name)
+ if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name}):
+ validate_customer(doc)
+ validate_item(doc)
+ si_doc = frappe.new_doc('Sales Invoice')
+ si_doc.offline_pos_name = name
+ si_doc.update(doc)
+ submit_invoice(si_doc, name)
+ name_list.append(name)
return name_list
@@ -213,7 +214,6 @@
save_invoice(e, si_doc, name)
def save_invoice(e, si_doc, name):
- if not frappe.db.exists('Sales Invoice', {'offline_pos_name': name, 'docstatus': 1}):
si_doc.docstatus = 0
si_doc.name = ''
si_doc.save(ignore_permissions=True)
diff --git a/erpnext/accounts/page/pos/pos.js b/erpnext/accounts/page/pos/pos.js
index 49cbdd0..cb57ff4 100644
--- a/erpnext/accounts/page/pos/pos.js
+++ b/erpnext/accounts/page/pos/pos.js
@@ -104,9 +104,10 @@
this.page.add_menu_item(__("Sync Master Data"), function(){
me.get_data_from_server(function(){
- me.load_data();
+ me.load_data(false);
me.make_customer();
me.make_item_list();
+ me.set_missing_values();
})
});
@@ -151,7 +152,7 @@
if(doc_data){
me.frm.doc = doc_data[0][me.name];
me.set_missing_values();
- me.refresh();
+ me.refresh(false);
me.disable_input_field();
me.list_dialog.hide();
}
@@ -177,6 +178,10 @@
if(this.frm.doc.payments.length == 0){
this.frm.doc.payments = doc.payments;
}
+
+ if(this.frm.doc.customer){
+ this.party_field.$input.val(this.frm.doc.customer);
+ }
},
get_invoice_doc: function(si_docs){
@@ -222,15 +227,18 @@
var me = this;
this.frm = {}
this.name = '';
- this.load_data();
+ this.load_data(true);
this.setup();
},
- load_data: function(){
+ load_data: function(load_doc){
this.items = window.items;
this.customers = window.customers;
this.pricing_rules = window.pricing_rules;
- this.frm.doc = JSON.parse(localStorage.getItem('doc'));
+
+ if(load_doc) {
+ this.frm.doc = JSON.parse(localStorage.getItem('doc'));
+ }
$.each(window.meta, function(i, data){
frappe.meta.sync(data)
@@ -302,7 +310,7 @@
make_customer: function() {
var me = this;
- if(this.default_customer){
+ if(this.default_customer && !this.frm.doc.customer){
this.party_field.$input.val(this.default_customer);
this.frm.doc.customer = this.default_customer;
}
@@ -535,7 +543,6 @@
customer_validate: function(){
var me = this;
-
if(!this.frm.doc.customer){
frappe.throw(__("Please select customer"))
}
@@ -598,21 +605,21 @@
? this.item_serial_no[this.child.item_code][0] : '');
},
- refresh: function() {
+ refresh: function(update_paid_amount) {
var me = this;
- this.refresh_fields();
+ this.refresh_fields(update_paid_amount);
this.update_qty();
this.update_rate();
this.set_primary_action();
},
- refresh_fields: function() {
+ refresh_fields: function(update_paid_amount) {
this.apply_pricing_rule();
this.discount_amount_applied = false;
this._calculate_taxes_and_totals();
this.calculate_discount_amount();
this.show_items_in_item_cart();
this.set_taxes();
- this.calculate_outstanding_amount();
+ this.calculate_outstanding_amount(update_paid_amount);
this.set_totals();
},
diff --git a/erpnext/buying/report/quoted_item_comparison/__init__.py b/erpnext/buying/report/quoted_item_comparison/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/erpnext/buying/report/quoted_item_comparison/__init__.py
diff --git a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.js b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.js
new file mode 100644
index 0000000..45bc738
--- /dev/null
+++ b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.js
@@ -0,0 +1,15 @@
+// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
+// For license information, please see license.txt
+
+frappe.query_reports["Quoted Item Comparison"] = {
+ "filters": [
+ {
+ "fieldname":"item",
+ "label": __("Item"),
+ "fieldtype": "Link",
+ "options": "Item",
+ "default": ""
+
+ }
+ ]
+}
diff --git a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.json b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.json
new file mode 100644
index 0000000..00e89f0
--- /dev/null
+++ b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.json
@@ -0,0 +1,18 @@
+{
+ "add_total_row": 0,
+ "apply_user_permissions": 1,
+ "creation": "2016-07-21 08:31:05.890362",
+ "disabled": 0,
+ "docstatus": 0,
+ "doctype": "Report",
+ "idx": 0,
+ "is_standard": "Yes",
+ "modified": "2016-07-21 12:32:45.733155",
+ "modified_by": "Administrator",
+ "module": "Buying",
+ "name": "Quoted Item Comparison",
+ "owner": "Administrator",
+ "ref_doctype": "Supplier Quotation",
+ "report_name": "Quoted Item Comparison",
+ "report_type": "Script Report"
+}
\ No newline at end of file
diff --git a/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py
new file mode 100644
index 0000000..5bf9c7b
--- /dev/null
+++ b/erpnext/buying/report/quoted_item_comparison/quoted_item_comparison.py
@@ -0,0 +1,100 @@
+# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import frappe
+
+def execute(filters=None):
+
+ qty_list = get_quantity_list(filters.item)
+
+ data = get_quote_list(filters.item, qty_list)
+
+ columns = get_columns(qty_list)
+
+ return columns, data
+
+
+def get_quote_list(item, qty_list):
+
+ out = []
+
+ if item:
+ price_data = []
+ suppliers = []
+ # Get the list of suppliers
+ for root in frappe.db.sql("""select parent, qty, rate from `tabSupplier Quotation Item` where item_code=%s and docstatus < 2""", item, as_dict=1):
+ for splr in frappe.db.sql("""SELECT supplier from `tabSupplier Quotation` where name =%s and docstatus < 2""", root.parent, as_dict=1):
+ ip = frappe._dict({
+ "supplier": splr.supplier,
+ "qty": root.qty,
+ "parent": root.parent,
+ "rate": root.rate})
+ price_data.append(ip)
+ suppliers.append(splr.supplier)
+
+ #Add a row for each supplier
+ for root in set(suppliers):
+ row = frappe._dict({
+ "supplier_name": root
+ })
+ for col in qty_list:
+ # Get the quantity for this row
+ for item_price in price_data:
+ if str(item_price.qty) == col.key and item_price.supplier == root:
+ row[col.key] = item_price.rate
+ row[col.key + "QUOTE"] = item_price.parent
+ break
+ else:
+ row[col.key] = ""
+ row[col.key + "QUOTE"] = ""
+ out.append(row)
+
+
+
+ return out
+
+def get_quantity_list(item):
+
+ out = []
+
+
+ if item:
+ qty_list = frappe.db.sql("""select distinct qty from `tabSupplier Quotation Item` where ifnull(item_code,'')=%s and docstatus < 2""", item, as_dict=1)
+ qty_list.sort(reverse=False)
+ for qt in qty_list:
+ col = frappe._dict({
+ "key": str(qt.qty),
+ "label": "Qty: " + str(int(qt.qty))
+ })
+ out.append(col)
+
+ return out
+
+def get_columns(qty_list):
+ columns = [{
+ "fieldname": "supplier_name",
+ "label": "Supplier",
+ "fieldtype": "Link",
+ "options": "Supplier",
+ "width": 200
+ }]
+
+ for qty in qty_list:
+ columns.append({
+ "fieldname": qty.key,
+ "label": qty.label,
+ "fieldtype": "Currency",
+ "options": "currency",
+ "width": 80
+ })
+ columns.append({
+ "fieldname": qty.key + "QUOTE",
+ "label": "Quotation",
+ "fieldtype": "Link",
+ "options": "Supplier Quotation",
+ "width": 90
+ })
+
+
+ return columns
\ No newline at end of file
diff --git a/erpnext/config/desktop.py b/erpnext/config/desktop.py
index df2a0ee..08f9d23 100644
--- a/erpnext/config/desktop.py
+++ b/erpnext/config/desktop.py
@@ -171,7 +171,7 @@
"icon": "octicon octicon-person",
"label": _("Student"),
"link": "List/Student",
- "doctype": "Student",
+ "_doctype": "Student",
"type": "list"
},
{
@@ -180,7 +180,7 @@
"icon": "octicon octicon-organization",
"label": _("Student Group"),
"link": "List/Student Group",
- "doctype": "Student Group",
+ "_doctype": "Student Group",
"type": "list"
},
{
@@ -189,7 +189,7 @@
"icon": "octicon octicon-calendar",
"label": _("Course Schedule"),
"link": "Calendar/Course Schedule",
- "doctype": "Course Schedule",
+ "_doctype": "Course Schedule",
"type": "list"
},
{
@@ -198,7 +198,7 @@
"icon": "octicon octicon-checklist",
"label": _("Student Attendance"),
"link": "List/Student Attendance",
- "doctype": "Student Attendance",
+ "_doctype": "Student Attendance",
"type": "list"
},
{
@@ -207,7 +207,7 @@
"icon": "octicon octicon-book",
"label": _("Course"),
"link": "List/Course",
- "doctype": "Course",
+ "_doctype": "Course",
"type": "list"
},
{
@@ -216,7 +216,7 @@
"icon": "octicon octicon-repo",
"label": _("Program"),
"link": "List/Program",
- "doctype": "Program",
+ "_doctype": "Program",
"type": "list"
},
{
@@ -225,7 +225,7 @@
"icon": "octicon octicon-clippy",
"label": _("Student Applicant"),
"link": "List/Student Applicant",
- "doctype": "Student Applicant",
+ "_doctype": "Student Applicant",
"type": "list"
},
{
@@ -234,7 +234,7 @@
"icon": "icon-file-text-alt",
"label": _("Examination"),
"link": "List/Examination",
- "doctype": "Examination",
+ "_doctype": "Examination",
"type": "list"
},
{
@@ -243,7 +243,7 @@
"icon": "icon-money",
"label": _("Fees"),
"link": "List/Fees",
- "doctype": "Fees",
+ "_doctype": "Fees",
"type": "list"
},
{
@@ -252,7 +252,7 @@
"icon": "octicon octicon-broadcast",
"label": _("Instructor"),
"link": "List/Instructor",
- "doctype": "Instructor",
+ "_doctype": "Instructor",
"type": "list"
},
{
@@ -261,7 +261,7 @@
"icon": "icon-map-marker",
"label": _("Room"),
"link": "List/Room",
- "doctype": "Examination",
+ "_doctype": "Examination",
"type": "list"
},
{
diff --git a/erpnext/controllers/queries.py b/erpnext/controllers/queries.py
index f53ad53..0debe4a 100644
--- a/erpnext/controllers/queries.py
+++ b/erpnext/controllers/queries.py
@@ -85,6 +85,9 @@
fields = ["name", "customer_group", "territory"]
else:
fields = ["name", "customer_name", "customer_group", "territory"]
+
+ meta = frappe.get_meta("Customer")
+ fields = fields + [f for f in meta.get_search_fields() if not f in fields]
fields = ", ".join(fields)
@@ -364,4 +367,4 @@
match_condition=get_match_cond(doctype)), {
'company': filters.get("company", ""),
'txt': "%%%s%%" % frappe.db.escape(txt)
- })
\ No newline at end of file
+ })
diff --git a/erpnext/demo/setup_data.py b/erpnext/demo/setup_data.py
index f5c4eb3..918fd54 100644
--- a/erpnext/demo/setup_data.py
+++ b/erpnext/demo/setup_data.py
@@ -1,6 +1,7 @@
from __future__ import unicode_literals
import random, json
+from frappe.utils.make_random import add_random_children, get_random
from erpnext.demo.domains import data
import frappe, erpnext
from frappe.utils import flt, now_datetime, cstr, nowdate, add_days
@@ -33,6 +34,7 @@
setup_salary_structure_for_timesheet()
setup_account_to_expense_type()
setup_user_roles()
+ setup_budget()
frappe.db.commit()
frappe.clear_cache()
@@ -50,7 +52,7 @@
"fy_start_date": "2015-01-01",
"fy_end_date": "2015-12-31",
"bank_account": "National Bank",
- "industry": domain,
+ "domain": domain,
"company_name": data.get(domain).get('company_name'),
"chart_of_accounts": "Standard",
"company_abbr": ''.join([d[0] for d in data.get(domain).get('company_name').split()]).upper(),
@@ -160,7 +162,7 @@
w = frappe.new_doc('Warehouse')
w.warehouse_name = 'Supplier'
w.insert()
-
+
def setup_asset():
assets = json.loads(open(frappe.get_app_path('erpnext', 'demo', 'data', 'asset.json')).read())
for d in assets:
@@ -305,7 +307,7 @@
})
ss.insert()
-
+
def setup_salary_structure_for_timesheet():
for e in frappe.get_all('Salary Structure', fields=['name'], filters={'is_active': 'Yes'}, limit=2):
ss_doc = frappe.get_doc("Salary Structure", e.name)
@@ -330,7 +332,7 @@
{'name': _('Medical'), "account": "Utility Expenses - WPL"},
{'name': _('Others'), "account": "Miscellaneous Expenses - WPL"},
{'name': _('Travel'), "account": "Travel Expenses - WPL"}]
-
+
for expense_type in expense_types:
doc = frappe.get_doc("Expense Claim Type", expense_type["name"])
doc.append("accounts", {
@@ -338,7 +340,27 @@
"default_account" : expense_type["account"]
})
doc.save(ignore_permissions=True)
-
+
+def setup_budget():
+ fiscal_years = frappe.get_all("Fiscal Year", order_by="year_start_date")[-2:]
+
+ for fy in fiscal_years:
+ budget = frappe.new_doc("Budget")
+ budget.cost_center = get_random("Cost Center")
+ budget.fiscal_year = fy.name
+ budget.action_if_annual_budget_exceeded = "Warn"
+ expense_ledger_count = frappe.db.count("Account", {"is_group": "0", "root_type": "Expense"})
+
+ add_random_children(budget, "accounts", rows=random.randint(10, expense_ledger_count), randomize = { "account": ("Account", {"is_group": "0", "root_type": "Expense"})
+ }, unique="account")
+
+ for d in budget.accounts:
+ d.budget_amount = random.randint(5, 100) * 10000
+
+ budget.save()
+ budget.submit()
+
+
def setup_user_roles():
if not frappe.db.get_global('demo_hr_user'):
user = frappe.get_doc('User', 'CharmaineGaudreau@example.com')
@@ -374,7 +396,7 @@
user = frappe.get_doc('User', 'LeonAbdulov@example.com')
user.add_roles('Accounts User', 'Accounts Manager', 'Sales User', 'Purchase User')
frappe.db.set_global('demo_accounts_user', user.name)
-
+
if not frappe.db.get_global('demo_projects_user'):
user = frappe.get_doc('User', 'panca@example.com')
user.add_roles('HR User', 'Projects User')
diff --git a/erpnext/demo/user/hr.py b/erpnext/demo/user/hr.py
index 50f15bb..219fa20 100644
--- a/erpnext/demo/user/hr.py
+++ b/erpnext/demo/user/hr.py
@@ -113,15 +113,11 @@
sales_invoice = make_sales_invoice(name)
sales_invoice.customer = get_random("Customer")
sales_invoice.append('items', {
- 'item_code': get_random_item(),
+ 'item_code': get_random("Item", {"has_variants": 0, "is_stock_item": 0, "is_fixed_asset": 0}),
'qty': 1,
'rate': 1000
})
sales_invoice.set_missing_values()
sales_invoice.calculate_taxes_and_totals()
sales_invoice.insert()
- sales_invoice.submit()
-
-def get_random_item():
- return frappe.db.sql_list(""" select name from `tabItem` where
- has_variants=0 and is_stock_item=0 and is_fixed_asset=0 order by rand() limit 1""")[0]
+ sales_invoice.submit()
\ No newline at end of file
diff --git a/erpnext/patches/v7_0/fix_duplicate_icons.py b/erpnext/patches/v7_0/fix_duplicate_icons.py
index ee4c3e2..3e762f7 100644
--- a/erpnext/patches/v7_0/fix_duplicate_icons.py
+++ b/erpnext/patches/v7_0/fix_duplicate_icons.py
@@ -2,9 +2,12 @@
from frappe.desk.doctype.desktop_icon.desktop_icon import (sync_desktop_icons,
get_desktop_icons, set_hidden)
+from erpnext.patches.v7_0.migrate_schools_to_erpnext import reload_doctypes_for_schools_icons
def execute():
'''hide new style icons if old ones are set'''
+ reload_doctypes_for_schools_icons()
+
sync_desktop_icons()
for user in frappe.get_all('User', filters={'user_type': 'System User'}):
diff --git a/erpnext/patches/v7_0/migrate_schools_to_erpnext.py b/erpnext/patches/v7_0/migrate_schools_to_erpnext.py
index 4d8dd1e..9933743 100644
--- a/erpnext/patches/v7_0/migrate_schools_to_erpnext.py
+++ b/erpnext/patches/v7_0/migrate_schools_to_erpnext.py
@@ -3,6 +3,12 @@
from erpnext.setup.setup_wizard import domainify
def execute():
+ reload_doctypes_for_schools_icons()
+
+ frappe.reload_doc('website', 'doctype', 'portal_settings')
+ frappe.reload_doc('website', 'doctype', 'portal_menu_item')
+ frappe.reload_doc('buying', 'doctype', 'request_for_quotation')
+
if 'schools' in frappe.get_installed_apps():
frappe.get_doc('Portal Settings', 'Portal Settings').sync_menu()
frappe.db.sql("""delete from `tabDesktop Icon`""")
@@ -17,9 +23,10 @@
remove_from_installed_apps("schools")
domainify.setup_domain('Education')
else:
- frappe.reload_doc('schools', 'doctype', 'announcement')
- frappe.reload_doc('schools', 'doctype', 'course')
- frappe.reload_doc('schools', 'doctype', 'fees')
- frappe.reload_doc('schools', 'doctype', 'examination')
frappe.get_doc('Portal Settings', 'Portal Settings').sync_menu()
domainify.setup_sidebar_items(domainify.get_domain('Manufacturing'))
+
+def reload_doctypes_for_schools_icons():
+ for name in ('student', 'student_group', 'course_schedule', 'student_attendance',
+ 'course', 'program', 'student_applicant', 'examination', 'fees', 'instructor', 'announcement'):
+ frappe.reload_doc('schools', 'doctype', name)
diff --git a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
index ce8c569..9413629 100644
--- a/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
+++ b/erpnext/projects/doctype/timesheet_detail/timesheet_detail.json
@@ -394,7 +394,7 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
- "depends_on": "project",
+ "depends_on": "",
"fieldname": "task",
"fieldtype": "Link",
"hidden": 0,
@@ -532,7 +532,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-18 13:57:29.873073",
+ "modified": "2016-07-21 09:59:01.622745",
"modified_by": "Administrator",
"module": "Projects",
"name": "Timesheet Detail",
diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js
index 236eb82..8405e3d 100644
--- a/erpnext/public/js/controllers/taxes_and_totals.js
+++ b/erpnext/public/js/controllers/taxes_and_totals.js
@@ -75,7 +75,7 @@
this.frm.doc.conversion_rate = flt(this.frm.doc.conversion_rate, precision("conversion_rate"));
var conversion_rate_label = frappe.meta.get_label(this.frm.doc.doctype, "conversion_rate",
this.frm.doc.name);
- var company_currency = this.get_company_currency();
+ var company_currency = this.frm.doc.currency || this.get_company_currency();
if(!this.frm.doc.conversion_rate) {
if(this.frm.doc.currency == company_currency) {
@@ -427,7 +427,7 @@
this.frm.doc.currency, precision("rounded_total"));
}
if(frappe.meta.get_docfield(this.frm.doc.doctype, "base_rounded_total", this.frm.doc.name)) {
- var company_currency = this.get_company_currency();
+ var company_currency = this.frm.doc.currency || this.get_company_currency();
this.frm.doc.base_rounded_total =
round_based_on_smallest_currency_fraction(this.frm.doc.base_grand_total,
@@ -587,7 +587,7 @@
if(data.type == "Cash" && payment_status) {
data.amount = total_amount_to_pay;
payment_status = false;
- }else{
+ }else if(me.frm.doc.paid_amount){
data.amount = 0.0;
}
})
diff --git a/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json b/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json
index 47a71f0..731de83 100644
--- a/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json
+++ b/erpnext/schools/doctype/attendance_tool_student/attendance_tool_student.json
@@ -2,11 +2,13 @@
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
+ "beta": 0,
"creation": "2015-11-10 16:28:51.366668",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -16,14 +18,17 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Student",
+ "length": 0,
"no_copy": 0,
"options": "Student",
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -39,13 +44,16 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Student 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,
@@ -61,14 +69,17 @@
"fieldtype": "Select",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Status",
+ "length": 0,
"no_copy": 0,
"options": "Absent\nPresent\n",
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -79,20 +90,25 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
- "issingle": 1,
+ "issingle": 0,
"istable": 1,
- "modified": "2016-07-18 10:30:50.243271",
+ "max_attachments": 0,
+ "modified": "2016-07-21 12:30:02.983801",
"modified_by": "Administrator",
"module": "Schools",
"name": "Attendance Tool Student",
"name_case": "",
"owner": "Administrator",
"permissions": [],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
- "sort_order": "DESC"
+ "sort_order": "DESC",
+ "track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/examination_result/examination_result.json b/erpnext/schools/doctype/examination_result/examination_result.json
index 4758c29..932dff1 100644
--- a/erpnext/schools/doctype/examination_result/examination_result.json
+++ b/erpnext/schools/doctype/examination_result/examination_result.json
@@ -2,11 +2,13 @@
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
+ "beta": 0,
"creation": "2015-11-13 17:18:06.468332",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -16,14 +18,17 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Student",
+ "length": 0,
"no_copy": 0,
"options": "Student",
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -39,13 +44,16 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Student 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,
@@ -61,12 +69,15 @@
"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,
@@ -82,13 +93,16 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Result",
+ "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,
@@ -99,20 +113,25 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
- "modified": "2016-07-18 10:30:50.243271",
+ "max_attachments": 0,
+ "modified": "2016-07-21 12:27:02.405667",
"modified_by": "Administrator",
"module": "Schools",
"name": "Examination Result",
"name_case": "",
"owner": "Administrator",
"permissions": [],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
- "sort_order": "DESC"
+ "sort_order": "DESC",
+ "track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/fee_amount/fee_amount.json b/erpnext/schools/doctype/fee_amount/fee_amount.json
index d7156cb..942b6ef 100644
--- a/erpnext/schools/doctype/fee_amount/fee_amount.json
+++ b/erpnext/schools/doctype/fee_amount/fee_amount.json
@@ -9,7 +9,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
- "editable_grid": 0,
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -104,8 +104,8 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-18 10:30:50.243271",
- "modified_by": "Administrator",
+ "modified": "2016-07-21 12:25:44.368245",
+ "modified_by": "r@r.com",
"module": "Schools",
"name": "Fee Amount",
"name_case": "",
diff --git a/erpnext/schools/doctype/program_course/program_course.json b/erpnext/schools/doctype/program_course/program_course.json
index 81aad68..e9a397e 100644
--- a/erpnext/schools/doctype/program_course/program_course.json
+++ b/erpnext/schools/doctype/program_course/program_course.json
@@ -2,11 +2,13 @@
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
+ "beta": 0,
"creation": "2015-09-07 14:37:01.886859",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -16,6 +18,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Course",
@@ -25,6 +28,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -40,6 +44,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Academic Term",
@@ -49,6 +54,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -64,6 +70,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -71,6 +78,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -86,6 +94,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Course Code",
@@ -94,6 +103,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
@@ -109,6 +119,7 @@
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Required",
@@ -117,6 +128,7 @@
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
@@ -128,6 +140,7 @@
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
@@ -135,16 +148,17 @@
"istable": 1,
"max_attachments": 0,
"menu_index": 0,
- "modified": "2016-07-18 10:30:50.243271",
+ "modified": "2016-07-21 12:27:02.330118",
"modified_by": "Administrator",
"module": "Schools",
"name": "Program Course",
"name_case": "",
"owner": "Administrator",
"permissions": [],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
"sort_order": "DESC",
- "version": 0
+ "track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.json b/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.json
index 3ed340d..6760384 100644
--- a/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.json
+++ b/erpnext/schools/doctype/program_enrollment_fee/program_enrollment_fee.json
@@ -8,6 +8,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -139,13 +140,14 @@
"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-07-18 10:30:50.243271",
+ "modified": "2016-07-21 12:27:02.547926",
"modified_by": "Administrator",
"module": "Schools",
"name": "Program Enrollment Fee",
diff --git a/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json b/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json
index a72feb4..9e200d7 100644
--- a/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json
+++ b/erpnext/schools/doctype/program_enrollment_tool_student/program_enrollment_tool_student.json
@@ -8,6 +8,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -116,14 +117,15 @@
"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-07-18 10:30:50.243271",
- "modified_by": "Administrator",
+ "modified": "2016-07-21 12:32:12.784608",
+ "modified_by": "r@r.com",
"module": "Schools",
"name": "Program Enrollment Tool Student",
"name_case": "",
diff --git a/erpnext/schools/doctype/program_fee/program_fee.json b/erpnext/schools/doctype/program_fee/program_fee.json
index ef3b9a6..6b320a0 100644
--- a/erpnext/schools/doctype/program_fee/program_fee.json
+++ b/erpnext/schools/doctype/program_fee/program_fee.json
@@ -8,6 +8,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -146,7 +147,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-18 10:30:50.243271",
+ "modified": "2016-07-21 12:27:02.153696",
"modified_by": "Administrator",
"module": "Schools",
"name": "Program Fee",
diff --git a/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json b/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json
index 872b1dc..8814f88 100644
--- a/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json
+++ b/erpnext/schools/doctype/sg_creation_tool_course/sg_creation_tool_course.json
@@ -2,11 +2,13 @@
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
+ "beta": 0,
"creation": "2016-01-04 15:03:57.940079",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -16,6 +18,7 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Course",
@@ -41,6 +44,7 @@
"fieldtype": "Read Only",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Course Code",
@@ -66,6 +70,7 @@
"fieldtype": "Column Break",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"length": 0,
@@ -89,6 +94,7 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Student Group Name",
@@ -113,6 +119,7 @@
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Max Strength",
@@ -133,21 +140,24 @@
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
- "issingle": 1,
+ "issingle": 0,
"istable": 1,
"max_attachments": 0,
- "modified": "2016-07-18 10:30:50.243271",
- "modified_by": "Administrator",
+ "modified": "2016-07-21 12:31:41.252860",
+ "modified_by": "r@r.com",
"module": "Schools",
"name": "SG Creation Tool Course",
"name_case": "",
"owner": "Administrator",
"permissions": [],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
- "sort_order": "DESC"
+ "sort_order": "DESC",
+ "track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/schools/doctype/student_group_student/student_group_student.json b/erpnext/schools/doctype/student_group_student/student_group_student.json
index 1d8a9bb..94493ae 100644
--- a/erpnext/schools/doctype/student_group_student/student_group_student.json
+++ b/erpnext/schools/doctype/student_group_student/student_group_student.json
@@ -2,11 +2,13 @@
"allow_copy": 0,
"allow_import": 0,
"allow_rename": 0,
+ "beta": 0,
"creation": "2015-09-11 15:14:58.501830",
"custom": 0,
"docstatus": 0,
"doctype": "DocType",
"document_type": "",
+ "editable_grid": 1,
"fields": [
{
"allow_on_submit": 0,
@@ -16,14 +18,17 @@
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Student",
+ "length": 0,
"no_copy": 0,
"options": "Student",
"permlevel": 0,
"precision": "",
"print_hide": 0,
+ "print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 1,
@@ -39,12 +44,15 @@
"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,
@@ -60,13 +68,16 @@
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
+ "ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "Student 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,
@@ -77,20 +88,25 @@
],
"hide_heading": 0,
"hide_toolbar": 0,
+ "idx": 0,
+ "image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 0,
"istable": 1,
- "modified": "2016-07-18 10:30:50.243271",
+ "max_attachments": 0,
+ "modified": "2016-07-21 12:27:02.479077",
"modified_by": "Administrator",
"module": "Schools",
"name": "Student Group Student",
"name_case": "",
"owner": "Administrator",
"permissions": [],
+ "quick_entry": 0,
"read_only": 0,
"read_only_onload": 0,
"sort_field": "modified",
- "sort_order": "DESC"
+ "sort_order": "DESC",
+ "track_seen": 0
}
\ No newline at end of file
diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py
index 9ed005e..e35f3d2 100644
--- a/erpnext/stock/doctype/stock_entry/stock_entry.py
+++ b/erpnext/stock/doctype/stock_entry/stock_entry.py
@@ -49,7 +49,7 @@
self.validate_batch()
self.set_actual_qty()
- self.calculate_rate_and_amount()
+ self.calculate_rate_and_amount(update_finished_item_rate=False)
def on_submit(self):
self.update_stock_ledger()
@@ -237,18 +237,20 @@
self.set_actual_qty()
self.calculate_rate_and_amount()
- def calculate_rate_and_amount(self, force=False):
- self.set_basic_rate(force)
+ def calculate_rate_and_amount(self, force=False, update_finished_item_rate=True):
+ self.set_basic_rate(force, update_finished_item_rate)
self.distribute_additional_costs()
self.update_valuation_rate()
self.set_total_incoming_outgoing_value()
self.set_total_amount()
- def set_basic_rate(self, force=False):
+ def set_basic_rate(self, force=False, update_finished_item_rate=True):
"""get stock and incoming rate on posting date"""
raw_material_cost = 0.0
+ fg_basic_rate = 0.0
for d in self.get('items'):
+ if d.t_warehouse: fg_basic_rate = flt(d.basic_rate)
args = frappe._dict({
"item_code": d.item_code,
"warehouse": d.s_warehouse or d.t_warehouse,
@@ -269,13 +271,14 @@
if not d.t_warehouse:
raw_material_cost += flt(d.basic_amount)
- self.set_basic_rate_for_finished_goods(raw_material_cost)
+ number_of_fg_items = len([t.t_warehouse for t in self.get("items") if t.t_warehouse])
+ if (fg_basic_rate == 0.0 and number_of_fg_items == 1) or update_finished_item_rate:
+ self.set_basic_rate_for_finished_goods(raw_material_cost)
def set_basic_rate_for_finished_goods(self, raw_material_cost):
if self.purpose in ["Manufacture", "Repack"]:
- number_of_fg_items = len([t.t_warehouse for t in self.get("items") if t.t_warehouse])
for d in self.get("items"):
- if d.bom_no or (d.t_warehouse and number_of_fg_items == 1):
+ if d.bom_no or d.t_warehouse:
d.basic_rate = flt(raw_material_cost / flt(d.transfer_qty), d.precision("basic_rate"))
d.basic_amount = flt(raw_material_cost, d.precision("basic_amount"))