Merge branch 'hotfix'

This commit is contained in:
Nabin Hait 2017-11-14 13:58:37 +05:30
commit 66f460ffbc
4 changed files with 43 additions and 24 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.2.10' __version__ = '9.2.11'
def get_default_company(user=None): def get_default_company(user=None):
'''Get default company for user''' '''Get default company for user'''

View File

@ -209,10 +209,10 @@ class AccountsController(TransactionBase):
tax_master_doctype = self.meta.get_field("taxes_and_charges").options tax_master_doctype = self.meta.get_field("taxes_and_charges").options
if not self.get("taxes"): if self.is_new() and not self.get("taxes"):
if not self.get("taxes_and_charges"): if not self.get("taxes_and_charges"):
# get the default tax master # get the default tax master
self.set("taxes_and_charges", frappe.db.get_value(tax_master_doctype, {"is_default": 1})) self.taxes_and_charges = frappe.db.get_value(tax_master_doctype, {"is_default": 1})
self.append_taxes_from_master(tax_master_doctype) self.append_taxes_from_master(tax_master_doctype)
@ -608,7 +608,10 @@ def get_tax_rate(account_head):
@frappe.whitelist() @frappe.whitelist()
def get_default_taxes_and_charges(master_doctype): def get_default_taxes_and_charges(master_doctype):
default_tax = frappe.db.get_value(master_doctype, {"is_default": 1}) default_tax = frappe.db.get_value(master_doctype, {"is_default": 1})
return get_taxes_and_charges(master_doctype, default_tax) return {
'taxes_and_charges': default_tax,
'taxes': get_taxes_and_charges(master_doctype, default_tax)
}
@frappe.whitelist() @frappe.whitelist()
def get_taxes_and_charges(master_doctype, master_name): def get_taxes_and_charges(master_doctype, master_name):

View File

@ -233,8 +233,8 @@ def make_quotation(source_name, target_doc=None):
# get default taxes # get default taxes
taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template") taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template")
if taxes: if taxes.get('taxes'):
quotation.extend("taxes", taxes) quotation.update(taxes)
quotation.run_method("set_missing_values") quotation.run_method("set_missing_values")
quotation.run_method("calculate_taxes_and_totals") quotation.run_method("calculate_taxes_and_totals")

View File

@ -231,8 +231,16 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
}, },
callback: function(r) { callback: function(r) {
if(!r.exc) { if(!r.exc) {
me.frm.set_value("taxes", r.message); frappe.run_serially([
me.calculate_taxes_and_totals(); () => {
// directly set in doc, so as not to call triggers
me.frm.doc.taxes_and_charges = r.message.taxes_and_charges;
// set taxes table
me.frm.set_value("taxes", r.message.taxes);
},
() => me.calculate_taxes_and_totals()
]);
} }
} }
}); });
@ -935,19 +943,27 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
return; return;
} }
if (me.in_apply_price_list == true) return;
me.in_apply_price_list = true;
return this.frm.call({ return this.frm.call({
method: "erpnext.stock.get_item_details.apply_price_list", method: "erpnext.stock.get_item_details.apply_price_list",
args: { args: args }, args: { args: args },
callback: function(r) { callback: function(r) {
if (!r.exc) { if (!r.exc) {
me.in_apply_price_list = true; frappe.run_serially([
me.frm.set_value("price_list_currency", r.message.parent.price_list_currency); () => me.frm.set_value("price_list_currency", r.message.parent.price_list_currency),
me.frm.set_value("plc_conversion_rate", r.message.parent.plc_conversion_rate); () => me.frm.set_value("plc_conversion_rate", r.message.parent.plc_conversion_rate),
me.in_apply_price_list = false; () => {
if(args.items.length) { if(args.items.length) {
me._set_values_for_item_list(r.message.children); me._set_values_for_item_list(r.message.children);
} }
},
() => { me.in_apply_price_list = false; }
]);
} else {
me.in_apply_price_list = false;
} }
} }
}); });
@ -1112,11 +1128,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
filters: {'item': item.item_code} filters: {'item': item.item_code}
} }
} else { } else {
filters = { let filters = {
'item_code': item.item_code, 'item_code': item.item_code,
'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(), 'posting_date': me.frm.doc.posting_date || frappe.datetime.nowdate(),
} }
if(item.warehouse) filters["warehouse"] = item.warehouse if (item.warehouse) filters["warehouse"] = item.warehouse
return { return {
query : "erpnext.controllers.queries.get_batch_no", query : "erpnext.controllers.queries.get_batch_no",