Merge branch 'master' into develop

This commit is contained in:
Nabin Hait 2017-10-21 11:29:40 +05:30
commit 7533101d4b
4 changed files with 17 additions and 8 deletions

View File

@ -4,7 +4,7 @@ import inspect
import frappe import frappe
from erpnext.hooks import regional_overrides from erpnext.hooks import regional_overrides
__version__ = '9.1.6' __version__ = '9.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

@ -88,7 +88,7 @@ def update_pos_profile_data(doc, pos_profile, company_data):
doc.naming_series = pos_profile.get('naming_series') or 'SINV-' doc.naming_series = pos_profile.get('naming_series') or 'SINV-'
doc.letter_head = pos_profile.get('letter_head') or company_data.default_letter_head doc.letter_head = pos_profile.get('letter_head') or company_data.default_letter_head
doc.ignore_pricing_rule = pos_profile.get('ignore_pricing_rule') or 0 doc.ignore_pricing_rule = pos_profile.get('ignore_pricing_rule') or 0
doc.apply_discount_on = pos_profile.get('apply_discount_on') or '' doc.apply_discount_on = pos_profile.get('apply_discount_on') or 'Grand Total'
doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group') doc.customer_group = pos_profile.get('customer_group') or get_root('Customer Group')
doc.territory = pos_profile.get('territory') or get_root('Territory') doc.territory = pos_profile.get('territory') or get_root('Territory')
doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms') or doc.terms or '' doc.terms = frappe.db.get_value('Terms and Conditions', pos_profile.get('tc_name'), 'terms') or doc.terms or ''

View File

@ -84,6 +84,7 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.get_data_from_server(function () { this.get_data_from_server(function () {
me.make_control(); me.make_control();
me.create_new(); me.create_new();
me.make();
}); });
}, },
@ -382,7 +383,6 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
}, },
setup: function () { setup: function () {
this.make();
this.set_primary_action(); this.set_primary_action();
this.party_field.$input.attr('disabled', false); this.party_field.$input.attr('disabled', false);
if(this.selected_row) { if(this.selected_row) {
@ -1341,6 +1341,12 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
this.wrapper.find('input.discount-percentage').on("change", function () { this.wrapper.find('input.discount-percentage').on("change", function () {
me.frm.doc.additional_discount_percentage = flt($(this).val(), precision("additional_discount_percentage")); me.frm.doc.additional_discount_percentage = flt($(this).val(), precision("additional_discount_percentage"));
if(me.frm.doc.additional_discount_percentage && me.frm.doc.discount_amount) {
// Reset discount amount
me.frm.doc.discount_amount = 0;
}
var total = me.frm.doc.grand_total var total = me.frm.doc.grand_total
if (me.frm.doc.apply_discount_on == 'Net Total') { if (me.frm.doc.apply_discount_on == 'Net Total') {
@ -1348,15 +1354,15 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
} }
me.frm.doc.discount_amount = flt(total * flt(me.frm.doc.additional_discount_percentage) / 100, precision("discount_amount")); me.frm.doc.discount_amount = flt(total * flt(me.frm.doc.additional_discount_percentage) / 100, precision("discount_amount"));
me.wrapper.find('input.discount-amount').val(me.frm.doc.discount_amount)
me.refresh(); me.refresh();
me.wrapper.find('input.discount-amount').val(me.frm.doc.discount_amount)
}); });
this.wrapper.find('input.discount-amount').on("change", function () { this.wrapper.find('input.discount-amount').on("change", function () {
me.frm.doc.discount_amount = flt($(this).val(), precision("discount_amount")); me.frm.doc.discount_amount = flt($(this).val(), precision("discount_amount"));
me.frm.doc.additional_discount_percentage = 0.0; me.frm.doc.additional_discount_percentage = 0.0;
me.wrapper.find('input.discount-percentage').val(0);
me.refresh(); me.refresh();
me.wrapper.find('input.discount-percentage').val(0);
}); });
}, },
@ -1517,6 +1523,8 @@ erpnext.pos.PointOfSale = erpnext.taxes_and_totals.extend({
var me = this; var me = this;
this.wrapper.find(".net-total").text(format_currency(me.frm.doc.total, me.frm.doc.currency)); this.wrapper.find(".net-total").text(format_currency(me.frm.doc.total, me.frm.doc.currency));
this.wrapper.find(".grand-total").text(format_currency(me.frm.doc.grand_total, me.frm.doc.currency)); this.wrapper.find(".grand-total").text(format_currency(me.frm.doc.grand_total, me.frm.doc.currency));
this.wrapper.find('input.discount-percentage').val(this.frm.doc.additional_discount_percentage);
this.wrapper.find('input.discount-amount').val(this.frm.doc.discount_amount);
}, },
set_primary_action: function () { set_primary_action: function () {

View File

@ -12,6 +12,7 @@ def execute():
domains = frappe.db.sql_list("select domain from tabCompany") domains = frappe.db.sql_list("select domain from tabCompany")
if "Education" not in domains: if "Education" not in domains:
role = frappe.get_doc("Role", "Instructor") if frappe.db.exists("Role", "Instructor"):
role.disabled = 1 role = frappe.get_doc("Role", "Instructor")
role.save(ignore_permissions=True) role.disabled = 1
role.save(ignore_permissions=True)