Merge branch 'hotfix'

This commit is contained in:
Nabin Hait 2018-03-09 16:38:51 +05:30
commit 3dea6589d7
20 changed files with 234 additions and 61 deletions

View File

@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
from frappe.utils import getdate from frappe.utils import getdate
__version__ = '10.1.6' __version__ = '10.1.7'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -159,6 +159,36 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "include_pos_transactions",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Include POS Transactions",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -292,7 +322,7 @@
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"menu_index": 0, "menu_index": 0,
"modified": "2017-04-21 16:58:26.902732", "modified": "2018-03-07 18:58:48.658687",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Bank Reconciliation", "name": "Bank Reconciliation",

View File

@ -53,10 +53,26 @@ class BankReconciliation(Document):
posting_date ASC, name DESC posting_date ASC, name DESC
""".format(condition), """.format(condition),
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1) {"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
entries = sorted(list(payment_entries)+list(journal_entries), pos_entries = []
if self.include_pos_transactions:
pos_entries = frappe.db.sql("""
select
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
si.posting_date, si.debit_to as against_account, sip.clearance_date,
account.account_currency, 0 as credit
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
where
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
and account.name = sip.account and si.posting_date >= %(from)s and si.posting_date <= %(to)s {0}
order by
si.posting_date ASC, si.name DESC
""".format(condition),
{"account":self.bank_account, "from":self.from_date, "to":self.to_date}, as_dict=1)
entries = sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
key=lambda k: k['posting_date'] or getdate(nowdate())) key=lambda k: k['posting_date'] or getdate(nowdate()))
self.set('payment_entries', []) self.set('payment_entries', [])
self.total_amount = 0.0 self.total_amount = 0.0

View File

@ -0,0 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
from __future__ import unicode_literals
import unittest
class TestBankReconciliation(unittest.TestCase):
pass

View File

@ -684,6 +684,24 @@ def get_company_defaults(company):
return ret return ret
def get_outstanding_on_journal_entry(name):
res = frappe.db.sql(
'SELECT '
'CASE WHEN party_type IN ("Customer", "Student") '
'THEN ifnull(sum(debit_in_account_currency - credit_in_account_currency), 0) '
'ELSE ifnull(sum(credit_in_account_currency - debit_in_account_currency), 0) '
'END as outstanding_amount '
'FROM `tabGL Entry` WHERE (voucher_no=%s OR against_voucher=%s) '
'AND party_type IS NOT NULL '
'AND party_type != ""',
(name, name), as_dict=1
)
outstanding_amount = res[0].get('outstanding_amount', 0) if res else 0
return outstanding_amount
@frappe.whitelist() @frappe.whitelist()
def get_reference_details(reference_doctype, reference_name, party_account_currency): def get_reference_details(reference_doctype, reference_name, party_account_currency):
total_amount = outstanding_amount = exchange_rate = None total_amount = outstanding_amount = exchange_rate = None
@ -694,6 +712,13 @@ def get_reference_details(reference_doctype, reference_name, party_account_curre
total_amount = ref_doc.get("grand_total") total_amount = ref_doc.get("grand_total")
exchange_rate = 1 exchange_rate = 1
outstanding_amount = ref_doc.get("outstanding_amount") outstanding_amount = ref_doc.get("outstanding_amount")
elif reference_doctype == "Journal Entry" and ref_doc.docstatus == 1:
total_amount = ref_doc.get("total_amount")
if ref_doc.multi_currency:
exchange_rate = get_exchange_rate(party_account_currency, company_currency, ref_doc.posting_date)
else:
exchange_rate = 1
outstanding_amount = get_outstanding_on_journal_entry(reference_name)
elif reference_doctype != "Journal Entry": elif reference_doctype != "Journal Entry":
if party_account_currency == company_currency: if party_account_currency == company_currency:
if ref_doc.doctype == "Expense Claim": if ref_doc.doctype == "Expense Claim":

View File

@ -227,6 +227,36 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "clearance_date",
"fieldtype": "Date",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Clearance Date",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"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
} }
], ],
"has_web_view": 0, "has_web_view": 0,
@ -239,7 +269,7 @@
"issingle": 0, "issingle": 0,
"istable": 1, "istable": 1,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-07-24 17:25:03.765856", "modified": "2018-03-07 18:34:39.552769",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice Payment", "name": "Sales Invoice Payment",

View File

@ -393,7 +393,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.frm = {} this.frm = {}
this.frm.doc = this.doc this.frm.doc = this.doc
this.set_transaction_defaults("Customer"); this.set_transaction_defaults("Customer");
this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false, this.frm.doc["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false;
this.frm.doc["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
this.wrapper.html(frappe.render_template("pos", this.frm.doc)); this.wrapper.html(frappe.render_template("pos", this.frm.doc));
this.make_search(); this.make_search();
this.make_customer(); this.make_customer();
@ -1256,6 +1257,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
$(this.wrapper).find('.selected-item').empty(); $(this.wrapper).find('.selected-item').empty();
if(this.child_doc.length) { if(this.child_doc.length) {
this.child_doc[0]["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false, this.child_doc[0]["allow_user_to_edit_rate"] = this.pos_profile_data["allow_user_to_edit_rate"] ? true : false,
this.child_doc[0]["allow_user_to_edit_discount"] = this.pos_profile_data["allow_user_to_edit_discount"] ? true : false;
this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0])) this.selected_row = $(frappe.render_template("pos_selected_item", this.child_doc[0]))
$(this.wrapper).find('.selected-item').html(this.selected_row) $(this.wrapper).find('.selected-item').html(this.selected_row)
} }
@ -1683,7 +1685,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
setInterval(function () { setInterval(function () {
me.freeze_screen = false; me.freeze_screen = false;
me.sync_sales_invoice() me.sync_sales_invoice()
}, 60000) }, 180000)
}, },
sync_sales_invoice: function () { sync_sales_invoice: function () {

View File

@ -28,5 +28,10 @@ frappe.query_reports["Bank Reconciliation Statement"] = {
"default": frappe.datetime.get_today(), "default": frappe.datetime.get_today(),
"reqd": 1 "reqd": 1
}, },
{
"fieldname":"include_pos_transactions",
"label": __("Include POS Transactions"),
"fieldtype": "Check"
},
] ]
} }

View File

@ -138,7 +138,23 @@ def get_entries(filters):
and ifnull(clearance_date, '4000-01-01') > %(report_date)s and ifnull(clearance_date, '4000-01-01') > %(report_date)s
""", filters, as_dict=1) """, filters, as_dict=1)
return sorted(list(payment_entries)+list(journal_entries), pos_entries = []
if filters.include_pos_transactions:
pos_entries = frappe.db.sql("""
select
"Sales Invoice Payment" as payment_document, sip.name as payment_entry, sip.amount as debit,
si.posting_date, si.debit_to as against_account, sip.clearance_date,
account.account_currency, 0 as credit
from `tabSales Invoice Payment` sip, `tabSales Invoice` si, `tabAccount` account
where
sip.account=%(account)s and si.docstatus=1 and sip.parent = si.name
and account.name = sip.account and si.posting_date <= %(report_date)s and
ifnull(sip.clearance_date, '4000-01-01') > %(report_date)s
order by
si.posting_date ASC, si.name DESC
""", filters, as_dict=1)
return sorted(list(payment_entries)+list(journal_entries+list(pos_entries)),
key=lambda k: k['posting_date'] or getdate(nowdate())) key=lambda k: k['posting_date'] or getdate(nowdate()))
def get_amounts_not_reflected_in_system(filters): def get_amounts_not_reflected_in_system(filters):

View File

@ -126,6 +126,11 @@ def get_data():
"link": "Tree/Sales Person", "link": "Tree/Sales Person",
"description": _("Manage Sales Person Tree."), "description": _("Manage Sales Person Tree."),
}, },
{
"type": "doctype",
"name": "Lead Source",
"description": _("Track Leads by Lead Source.")
},
] ]
}, },
{ {

View File

@ -173,6 +173,11 @@ def get_data():
"name": "Industry Type", "name": "Industry Type",
"description": _("Track Leads by Industry Type.") "description": _("Track Leads by Industry Type.")
}, },
{
"type": "doctype",
"name": "Lead Source",
"description": _("Track Leads by Lead Source.")
},
] ]
}, },
{ {

View File

@ -92,7 +92,10 @@ def validate_is_incremental(numeric_attribute, attribute, value, item):
InvalidItemAttributeValueError, title=_('Invalid Attribute')) InvalidItemAttributeValueError, title=_('Invalid Attribute'))
def validate_item_attribute_value(attributes_list, attribute, attribute_value, item): def validate_item_attribute_value(attributes_list, attribute, attribute_value, item):
if attribute_value not in attributes_list: allow_rename_attribute_value = frappe.db.get_single_value('Item Variant Settings', 'allow_rename_attribute_value')
if allow_rename_attribute_value:
pass
elif attribute_value not in attributes_list:
frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values for Item {2}").format( frappe.throw(_("Value {0} for Attribute {1} does not exist in the list of valid Item Attribute Values for Item {2}").format(
attribute_value, attribute, item), InvalidItemAttributeValueError, title=_('Invalid Attribute')) attribute_value, attribute, item), InvalidItemAttributeValueError, title=_('Invalid Attribute'))

View File

@ -27,26 +27,27 @@ def execute(filters=None):
course_dict = values.get("course_dict") course_dict = values.get("course_dict")
for student in args.students: for student in args.students:
student_row = {} if student_details.get(student):
student_row["student"] = student student_row = {}
student_row["student_name"] = student_details[student] student_row["student"] = student
for course in course_dict: student_row["student_name"] = student_details[student]
scrub_course = frappe.scrub(course) for course in course_dict:
if assessment_group in assessment_result[student][course]: scrub_course = frappe.scrub(course)
student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"] if assessment_group in assessment_result[student][course]:
student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"] student_row["grade_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["grade"]
student_row["score_" + scrub_course] = assessment_result[student][course][assessment_group]["Total Score"]["score"]
# create the list of possible grades # create the list of possible grades
if student_row["grade_" + scrub_course] not in grades: if student_row["grade_" + scrub_course] not in grades:
grades.append(student_row["grade_" + scrub_course]) grades.append(student_row["grade_" + scrub_course])
# create the dict of for gradewise analysis # create the dict of for gradewise analysis
if student_row["grade_" + scrub_course] not in course_wise_analysis[course]: if student_row["grade_" + scrub_course] not in course_wise_analysis[course]:
course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1 course_wise_analysis[course][student_row["grade_" + scrub_course]] = 1
else: else:
course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1 course_wise_analysis[course][student_row["grade_" + scrub_course]] += 1
data.append(student_row) data.append(student_row)
course_list = [d for d in course_dict] course_list = [d for d in course_dict]
columns = get_column(course_dict) columns = get_column(course_dict)

View File

@ -23,11 +23,6 @@ frappe.ui.form.on('Consultation', {
patient: frm.doc.patient patient: frm.doc.patient
}, },
callback: function (data) { callback: function (data) {
var age = null;
if(data.message.dob){
age = calculate_age(data.message.dob);
}
frappe.model.set_value(frm.doctype,frm.docname, "patient_age", age);
show_details(data.message); show_details(data.message);
} }
}); });

View File

@ -37,20 +37,22 @@
<div class="cell price-cell text-right tax-table"> <div class="cell price-cell text-right tax-table">
</div> </div>
</div> </div>
<div class="pos-list-row discount-amount-area"> {% if(allow_user_to_edit_discount) { %}
<div class="cell"></div> <div class="pos-list-row discount-amount-area">
<div class="cell text-right">{%= __("Discount") %}</div> <div class="cell"></div>
<div class="cell price-cell discount-field-col"> <div class="cell text-right">{%= __("Discount") %}</div>
<div class="input-group input-group-sm"> <div class="cell price-cell discount-field-col">
<span class="input-group-addon">%</span> <div class="input-group input-group-sm">
<input type="text" class="form-control discount-percentage text-right"> <span class="input-group-addon">%</span>
</div> <input type="text" class="form-control discount-percentage text-right">
<div class="input-group input-group-sm"> </div>
<span class="input-group-addon">{%= get_currency_symbol(currency) %}</span> <div class="input-group input-group-sm">
<input type="text" class="form-control discount-amount text-right" placeholder="{%= 0.00 %}"> <span class="input-group-addon">{%= get_currency_symbol(currency) %}</span>
<input type="text" class="form-control discount-amount text-right" placeholder="{%= 0.00 %}">
</div>
</div> </div>
</div> </div>
</div> {% } %}
<div class="pos-list-row grand-total-area collapse-btn" style="border-bottom:1px solid #d1d8dd;"> <div class="pos-list-row grand-total-area collapse-btn" style="border-bottom:1px solid #d1d8dd;">
<div class="cell"> <div class="cell">
<a class=""> <a class="">
@ -71,7 +73,7 @@
{% for(var j=i*3; j {% for(var j=i*3; j
<(i+1)*3; j++) { %} <button type="button" class="btn btn-default numeric-keypad" val="{{j+1}}">{{j+1}}</button> <(i+1)*3; j++) { %} <button type="button" class="btn btn-default numeric-keypad" val="{{j+1}}">{{j+1}}</button>
{% } %} {% } %}
<button type="button" {% if(!allow_user_to_edit_rate && chartData[i] == __("Price")) { %} disabled {% } %} id="pos-item-{{ chartData[i].toLowerCase() }}" class="btn text-center btn-default numeric-keypad pos-operation">{{ __(chartData[i]) }}</button> <button type="button" {% if((!allow_user_to_edit_rate && chartData[i] == __("Price")) || (!allow_user_to_edit_discount && chartData[i] == __("Disc"))) { %} disabled {% } %} id="pos-item-{{ chartData[i].toLowerCase() }}" class="btn text-center btn-default numeric-keypad pos-operation">{{ __(chartData[i]) }}</button>
</div> </div>
{% } %} {% } %}
<div class="row text-right"> <div class="row text-right">

View File

@ -9,7 +9,7 @@
</div> </div>
<div class="pos-list-row"> <div class="pos-list-row">
<div class="cell">{{ __("Discount") }}: %</div> <div class="cell">{{ __("Discount") }}: %</div>
<input type="tel" class="form-control cell pos-item-disc" value="{%= discount_percentage %}"> <input type="tel" class="form-control cell pos-item-disc" {% if !allow_user_to_edit_discount %} disabled {% endif %} value="{%= discount_percentage %}">
</div> </div>
<div class="pos-list-row"> <div class="pos-list-row">
<div class="cell">{{ __("Price") }}:</div> <div class="cell">{{ __("Price") }}:</div>

View File

@ -64,7 +64,7 @@ $.extend(shopping_cart, {
}, },
set_cart_count: function() { set_cart_count: function() {
var cart_count = getCookie("cart_count"); var cart_count = frappe.get_cookie("cart_count");
if(frappe.session.user==="Guest") { if(frappe.session.user==="Guest") {
cart_count = 0; cart_count = 0;
} }

View File

@ -48,6 +48,15 @@ frappe.ui.form.on("Sales Order", {
}); });
frappe.ui.form.on("Sales Order Item", { frappe.ui.form.on("Sales Order Item", {
item_code: function(frm,cdt,cdn) {
var row = locals[cdt][cdn];
if (frm.doc.delivery_date) {
row.delivery_date = frm.doc.delivery_date;
refresh_field("delivery_date", cdn, "items");
} else {
this.frm.script_manager.copy_from_first_row("items", row, ["delivery_date"]);
}
},
delivery_date: function(frm, cdt, cdn) { delivery_date: function(frm, cdt, cdn) {
if(!frm.doc.delivery_date) { if(!frm.doc.delivery_date) {
erpnext.utils.copy_value_in_all_row(frm.doc, cdt, cdn, "items", "delivery_date"); erpnext.utils.copy_value_in_all_row(frm.doc, cdt, cdn, "items", "delivery_date");
@ -433,17 +442,6 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
if(cint(frappe.boot.notification_settings.sales_order)) { if(cint(frappe.boot.notification_settings.sales_order)) {
this.frm.email_doc(frappe.boot.notification_settings.sales_order_message); this.frm.email_doc(frappe.boot.notification_settings.sales_order_message);
} }
},
items_add: function(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
if(doc.delivery_date) {
row.delivery_date = doc.delivery_date;
refresh_field("delivery_date", cdn, "items");
} else {
this.frm.script_manager.copy_from_first_row("items", row, ["delivery_date"]);
}
} }
}); });
$.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm})); $.extend(cur_frm.cscript, new erpnext.selling.SalesOrderController({frm: cur_frm}));

View File

@ -72,6 +72,38 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_bulk_edit": 0,
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"columns": 0,
"default": "",
"description": "Rename Attribute Value in Item Attribute.",
"fieldname": "allow_rename_attribute_value",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"ignore_xss_filter": 0,
"in_filter": 0,
"in_global_search": 0,
"in_list_view": 0,
"in_standard_filter": 0,
"label": "Allow Rename Attribute Value",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"remember_last_selected_value": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_bulk_edit": 0, "allow_bulk_edit": 0,
"allow_on_submit": 0, "allow_on_submit": 0,
@ -144,7 +176,7 @@
"issingle": 1, "issingle": 1,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2017-11-14 15:54:12.190518", "modified": "2018-02-19 11:39:54.401128",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Item Variant Settings", "name": "Item Variant Settings",

View File

@ -51,7 +51,7 @@ def get_consumed_items(condition):
sum(se_item.transfer_qty) as 'consume_qty' sum(se_item.transfer_qty) as 'consume_qty'
from `tabStock Entry` se, `tabStock Entry Detail` se_item from `tabStock Entry` se, `tabStock Entry Detail` se_item
where se.name = se_item.parent and se.docstatus = 1 where se.name = se_item.parent and se.docstatus = 1
and ifnull(se_item.t_warehouse, '') = '' %s and (ifnull(se_item.t_warehouse, '') = '' or se.purpose = 'Subcontract') %s
group by se_item.item_code""" % (condition), as_dict=1) group by se_item.item_code""" % (condition), as_dict=1)
cn_items_map = {} cn_items_map = {}