Merge branch 'develop'

This commit is contained in:
Rushabh Mehta 2016-08-10 14:34:39 +05:30
commit c9501eb460
24 changed files with 352 additions and 110 deletions

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
__version__ = '7.0.23'
__version__ = '7.0.24'
def get_default_company(user=None):
'''Get default company for user'''

View File

@ -47,7 +47,7 @@ cur_frm.cscript.account_type = function(doc, cdt, cdn) {
cur_frm.cscript.add_toolbar_buttons = function(doc) {
cur_frm.add_custom_button(__('Chart of Accounts'),
function() { frappe.set_route("Tree", "Account"); }, __("View"))
function() { frappe.set_route("Tree", "Account"); });
if (doc.is_group == 1) {
cur_frm.add_custom_button(__('Group to Non-Group'),
@ -61,7 +61,7 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
"company": doc.company
};
frappe.set_route("query-report", "General Ledger");
}, __("View"));
});
cur_frm.add_custom_button(__('Non-Group to Group'),
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet', 'btn-default')

View File

@ -1,5 +1,6 @@
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
{% include "erpnext/public/js/controllers/accounts.js" %}
frappe.ui.form.on('Payment Entry', {
onload: function(frm) {
@ -257,22 +258,6 @@ frappe.ui.form.on('Payment Entry', {
}
},
mode_of_payment: function(frm) {
return frappe.call({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
args: {
"mode_of_payment": frm.doc.mode_of_payment,
"company": frm.doc.company
},
callback: function(r, rt) {
if(r.message) {
var payment_account_field = frm.doc.payment_type == "Receive" ? "paid_to" : "paid_from";
frm.set_value(payment_account_field, r.message['account']);
}
}
});
},
paid_from: function(frm) {
if(frm.set_party_account_based_on_party) return;

View File

@ -1,6 +1,8 @@
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
{% include "erpnext/public/js/controllers/accounts.js" %}
frappe.ui.form.on("POS Profile", "onload", function(frm) {
frm.set_query("selling_price_list", function() {
return { filters: { selling: 1 } };

View File

@ -9,6 +9,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Document",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 1,
@ -117,6 +118,33 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "bill_no",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Supplier Invoice No",
"length": 0,
"no_copy": 0,
"oldfieldname": "bill_no",
"oldfieldtype": "Data",
"permlevel": 0,
"print_hide": 1,
"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,
@ -142,6 +170,32 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "0",
"fieldname": "is_return",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Return",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"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
},
{
"allow_on_submit": 0,
"bold": 0,
@ -198,19 +252,18 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "",
"fieldname": "bill_no",
"fieldtype": "Data",
"fieldname": "bill_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Supplier Invoice No",
"label": "Supplier Invoice Date",
"length": 0,
"no_copy": 0,
"oldfieldname": "bill_no",
"oldfieldtype": "Data",
"oldfieldname": "bill_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 1,
"print_hide_if_no_value": 0,
@ -225,17 +278,17 @@
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "bill_date",
"fieldname": "due_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Supplier Invoice Date",
"label": "Due Date",
"length": 0,
"no_copy": 0,
"oldfieldname": "bill_date",
"oldfieldname": "due_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 1,
@ -299,32 +352,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"default": "0",
"fieldname": "is_return",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Is Return",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"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
},
{
"allow_on_submit": 0,
"bold": 0,
@ -2497,32 +2524,6 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "due_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 1,
"in_list_view": 0,
"label": "Due Date",
"length": 0,
"no_copy": 0,
"oldfieldname": "due_date",
"oldfieldtype": "Date",
"permlevel": 0,
"print_hide": 1,
"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,
@ -3031,7 +3032,7 @@
"istable": 0,
"max_attachments": 0,
"menu_index": 0,
"modified": "2016-06-30 13:40:39.440648",
"modified": "2016-08-10 02:45:28.746569",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice",

View File

@ -25,6 +25,9 @@ def execute(filters=None):
return columns, res
def validate_filters(filters, account_details):
if not filters.get('company'):
frappe.throw(_('{0} is mandatory').format(_('Company')))
if filters.get("account") and not account_details.get(filters.account):
frappe.throw(_("Account {0} does not exists").format(filters.account))

View File

@ -0,0 +1,132 @@
<head>
<link href="/assets/frappe/css/c3.min.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/assets/frappe/js/lib/d3.min.js"></script>
<script type="text/javascript" src="/assets/frappe/js/lib/c3.min.js"></script>
<script type="text/javascript">
onReady("#chart_div", function() {
var chartData = [];
{% var q = 0; %}
{% for(var j=0, m=data.length+1; j<m; j++) { %}
var tempData{%=j%} = [];
{% for(var i=1, l=report.columns.length; i<l; i++) { %}
{% if(__(report.columns[i].label) != __("Quotation")) { %}
{% if(j == 0) { %}
{% if(i == 1) { %}
tempData{%=j%}[{%=i%}-1] = \"x\";
{% } else { %}
tempData{%=j%}[{%=i%}-1] = Math.log(parseInt(\"{%= report.columns[i].label %}\".replace(\"Qty: \",\"\"))) / Math.LN10;
{% } %}
{% } else { %}
{% if(i == 1) { %}
tempData{%=j%}[{%=i%}-1] = \"{%= data[j-1][report.columns[i].field] %} \";
{% } else { %}
tempData{%=j%}[{%=i%}-1] = {% if(data[j-1][report.columns[i].field] == "") { if (i > 2) { %}
tempData{%=j%}[{%=i%}-2]
{% } else { %}
0
{% } } else { %}
{%= data[j-1][report.columns[i].field] %}
{% } %};
{% } %};
{% } %}
{% } else { %}
{% if(j == 0) { %}
{% if(i < l-1) { %}
tempData{%=j%}[{%=i%}-1] = Math.log(parseInt(\"{%= report.columns[i+1].label %}\".replace(\"Qty: \",\"\"))-1) / Math.LN10;
{% } else { %}
tempData{%=j%}[{%=i%}-1] = Math.log(2*parseInt(\"{%= report.columns[i-1].label %}\".replace(\"Qty: \",\"\"))) / Math.LN10;
{% } %}
{% } else { %}
tempData{%=j%}[{%=i%}-1] = tempData{%=j%}[{%=i%}-2];
{% } %}
{% } %}
{% } %}
chartData[{%=j%}] = tempData{%=j%};
{% } %}
console.log(chartData);
hold = {
bindto: "#chart_div" ,data: {
x: "x",
columns: chartData
},
axis: {
x: {
tick: {
format: function (x22) { return Math.pow(10,x22).toFixed(0); },
culling: {
max: {%=report.columns.length%} / 2
}
}
}
},
point: {
show: false
}
};
console.log(hold);
var chart = c3.generate(hold);
});
function onReady(selector, callback) {
var intervalID = window.setInterval(function() {
if (document.querySelector(selector) !== undefined) {
window.clearInterval(intervalID);
callback.call(this);
}
}, 500);}
</script>
</head>
<div style="margin-bottom: 7px;" class="text-center">
{%= frappe.boot.letter_heads[frappe.defaults.get_default("letter_head")] %}
</div>
<h2 class="text-center">{%= __(report.report_name) %}</h2>
<h4 class="text-center">{%= filters.item %} </h4>
<hr>
<table class="table table-bordered">
<thead>
<tr>
{% for(var i=0, l=report.columns.length; i<l; i++) { %}
<th style="width: 15%">{%= report.columns[i].label %}</th>
{% } %}
</tr>
</thead>
<tbody>
{% for(var i=0, l=data.length; i<l; i++) { %}
<tr>
{% for(var j=0,m=report.columns.length; j<m; j++) { %}
<td style="width: 15%">{%= data[i][report.columns[j].field] %}</td>
{% } %}
</tr>
{% } %}
</tbody>
</table>
<h4 class="text-center"> Analysis Chart </h4>
<div id="chart_div"></div>
<p class="text-right text-muted">Printed On {%= dateutil.str_to_user(dateutil.get_datetime_as_string()) %}</p>

View File

@ -2,6 +2,8 @@
# For license information, please see license.txt
from __future__ import unicode_literals
from erpnext.setup.utils import get_exchange_rate
import frappe
def execute(filters=None):
@ -22,6 +24,7 @@ def get_quote_list(item, qty_list):
if item:
price_data = []
suppliers = []
company_currency = frappe.db.get_default("currency")
# 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):
@ -35,6 +38,9 @@ def get_quote_list(item, qty_list):
#Add a row for each supplier
for root in set(suppliers):
supplier_currency = frappe.db.get_value("Supplier",root,"default_currency")
exg = get_exchange_rate(supplier_currency,company_currency)
row = frappe._dict({
"supplier_name": root
})
@ -42,7 +48,7 @@ def get_quote_list(item, 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] = item_price.rate * exg
row[col.key + "QUOTE"] = item_price.parent
break
else:

View File

@ -101,7 +101,7 @@ portal_menu_items = [
{"title": _("Addresses"), "route": "/addresses", "reference_doctype": "Address"},
{"title": _("Announcements"), "route": "/announcement", "reference_doctype": "Announcement"},
{"title": _("Courses"), "route": "/course", "reference_doctype": "Course"},
{"title": _("Assessment Schedule"), "route": "/Assessment", "reference_doctype": "Assessment"},
{"title": _("Assessment Schedule"), "route": "/assessment", "reference_doctype": "Assessment"},
{"title": _("Fees"), "route": "/fees", "reference_doctype": "Fees"}
]

View File

@ -308,5 +308,6 @@ erpnext.patches.v7_0.make_guardian
erpnext.patches.v7_0.update_refdoc_in_landed_cost_voucher
erpnext.patches.v7_0.set_material_request_type_in_item
erpnext.patches.v7_0.rename_examination_to_assessment
erpnext.patches.v7_0.set_portal_settings
erpnext.patches.v7_0.repost_future_gle_for_purchase_invoice
erpnext.patches.v7_0.fix_duplicate_icons

View File

@ -1,6 +1,5 @@
from __future__ import unicode_literals
import frappe
from erpnext.setup.setup_wizard import domainify
def execute():
reload_doctypes_for_schools_icons()
@ -10,7 +9,6 @@ def execute():
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`""")
if not frappe.db.exists('Module Def', 'Schools'):
frappe.get_doc({
@ -21,12 +19,7 @@ def execute():
frappe.db.sql("""update `tabDocType` set module='Schools' where module='Academics'""")
from frappe.installer import remove_from_installed_apps
remove_from_installed_apps("schools")
domainify.setup_domain('Education')
else:
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', 'room', 'program_enrollment',
'course', 'program', 'student_applicant', 'examination', 'fees', 'instructor', 'announcement'):
frappe.reload_doc('schools', 'doctype', name)
for d in frappe.get_all('DocType', filters={'module': 'Schools'}):
frappe.reload_doc('schools', 'doctype', d.name)

View File

@ -13,3 +13,4 @@ def execute():
rename_field("Assessment", "exam_name", "assessment_name")
rename_field("Assessment", "exam_code", "assessment_code")
frappe.db.sql("delete from `tabPortal Menu Item` where route = '/examination'")

View File

@ -0,0 +1,18 @@
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from erpnext.setup.setup_wizard import domainify
def execute():
for dt in ("assessment", "announcement", "course", "fees"):
frappe.reload_doc("schools", "doctype", dt)
frappe.get_doc('Portal Settings').sync_menu()
if 'schools' in frappe.get_installed_apps():
domainify.setup_domain('Education')
else:
domainify.setup_sidebar_items(domainify.get_domain('Manufacturing'))

View File

@ -9,6 +9,7 @@
"docstatus": 0,
"doctype": "DocType",
"document_type": "Setup",
"editable_grid": 0,
"fields": [
{
"allow_on_submit": 0,
@ -36,6 +37,31 @@
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "title",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "TItle",
"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,
@ -145,13 +171,14 @@
"hide_heading": 0,
"hide_toolbar": 0,
"idx": 0,
"image_view": 0,
"in_create": 0,
"in_dialog": 0,
"is_submittable": 0,
"issingle": 1,
"istable": 0,
"max_attachments": 0,
"modified": "2016-05-12 14:19:41.689519",
"modified": "2016-08-09 05:01:30.287861",
"modified_by": "Administrator",
"module": "Portal",
"name": "Homepage",

View File

@ -95,6 +95,31 @@
"unique": 0,
"width": "150"
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "view",
"fieldtype": "Button",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_list_view": 1,
"label": "View",
"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,
@ -260,7 +285,7 @@
"issingle": 0,
"istable": 1,
"max_attachments": 0,
"modified": "2016-07-11 03:28:00.729983",
"modified": "2016-08-09 06:09:34.731971",
"modified_by": "Administrator",
"module": "Portal",
"name": "Homepage Featured Product",

View File

@ -46,9 +46,10 @@
line-height: 0;
color: #d1d8dd;
font-size: 30px;
background-size: cover;
background-size: contain;
border: 1px solid transparent;
background-position: top center;
background-position: center;
background-repeat: no-repeat;
}
.pos-item-area {
border: 1px solid #d1d8dd;

View File

@ -55,6 +55,48 @@ frappe.ui.form.on(cur_frm.doctype, {
}
});
frappe.ui.form.on('Sales Invoice Payment', {
mode_of_payment: function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
get_payment_mode_account(frm, d.mode_of_payment, function(account){
frappe.model.set_value(cdt, cdn, 'account', account)
})
}
})
frappe.ui.form.on('Purchase Invoice', {
mode_of_payment: function(frm) {
get_payment_mode_account(frm, frm.doc.mode_of_payment, function(account){
frm.set_value('cash_bank_account', account);
})
}
})
frappe.ui.form.on('Payment Entry', {
mode_of_payment: function(frm) {
get_payment_mode_account(frm, frm.doc.mode_of_payment, function(account){
var payment_account_field = frm.doc.payment_type == "Receive" ? "paid_to" : "paid_from";
frm.set_value(payment_account_field, account);
})
}
})
get_payment_mode_account = function(frm, mode_of_payment, callback){
return frappe.call({
method: "erpnext.accounts.doctype.sales_invoice.sales_invoice.get_bank_cash_account",
args: {
"mode_of_payment": mode_of_payment,
"company": frm.doc.company
},
callback: function(r, rt) {
if(r.message) {
callback(r.message.account)
}
}
});
}
cur_frm.cscript.account_head = function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(!d.charge_type && d.account_head){

View File

@ -311,6 +311,8 @@ function load_erpnext_slides() {
slide.fields.push({fieldtype: "Section Break"});
slide.fields.push({fieldtype: "Check", fieldname: "add_sample_data",
label: __("Add a few sample records"), "default": 1});
slide.fields.push({fieldtype: "Check", fieldname: "setup_website",
label: __("Setup a simple website for my organization"), "default": 1});
},
css_class: "two-column"
},

View File

@ -58,9 +58,10 @@
line-height: 0;
color: @text-extra-muted;
font-size: 30px;
background-size: cover;
background-size: contain;
border: 1px solid transparent;
background-position: top center;
background-position: center;
background-repeat: no-repeat;
}
.pos-item-area {

View File

@ -14,9 +14,9 @@ def get_sg_list(doctype, txt, filters, limit_start, limit_page_length=20):
user = frappe.session.user
student = frappe.db.sql("select name from `tabStudent` where student_email_id= %s", user)
if student:
return frappe.db.sql('''select group_name, course, academic_term, academic_year, SG.name from `tabStudent Group`
as SG, `tabStudent Group Student` as SGS where SG.group_name = SGS.parent and SGS.student = %s
order by SG.group_name asc limit {0} , {1}'''.format(limit_start, limit_page_length), student, as_dict=True)
return frappe.db.sql('''select course, academic_term, academic_year, SG.name from `tabStudent Group`
as SG, `tabStudent Group Student` as SGS where SG.name = SGS.parent and SGS.student = %s
order by SG.name asc limit {0} , {1}'''.format(limit_start, limit_page_length), student, as_dict=True)
def get_list_context(context=None):
return {

View File

@ -41,7 +41,9 @@ def setup_complete(args=None):
create_instructor(args)
create_room(args)
if args.get('setup_website'):
website_maker(args)
create_logo(args)
frappe.local.message_log = []

View File

@ -5,7 +5,7 @@
{{ doc.course }}
</div>
<div class="col-xs-3">
{{ doc.group_name }}
{{ doc.name }}
</div>
<div class="col-xs-2">
{{doc.academic_term }}

View File

@ -15,6 +15,8 @@ def get_context(context):
if route:
item.route = '/' + route
context.title = homepage.title or homepage.company
# show atleast 3 products
if len(homepage.products) < 3:
for i in xrange(3 - len(homepage.products)):
@ -24,6 +26,4 @@ def get_context(context):
'route': '#'
})
return {
'homepage': homepage
}
context.homepage = homepage

View File

@ -6,7 +6,7 @@ import unittest, frappe
from frappe.utils import sel
from frappe.utils import formatdate
selenium_tests = True
#selenium_tests = True
# class TestLogin(unittest.TestCase):
# def setUp(self):