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
from erpnext.hooks import regional_overrides
__version__ = '9.2.10'
__version__ = '9.2.11'
def get_default_company(user=None):
'''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
if not self.get("taxes"):
if self.is_new() and not self.get("taxes"):
if not self.get("taxes_and_charges"):
# 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)
@ -608,7 +608,10 @@ def get_tax_rate(account_head):
@frappe.whitelist()
def get_default_taxes_and_charges(master_doctype):
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()
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
taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template")
if taxes:
quotation.extend("taxes", taxes)
if taxes.get('taxes'):
quotation.update(taxes)
quotation.run_method("set_missing_values")
quotation.run_method("calculate_taxes_and_totals")

View File

@ -231,8 +231,16 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
},
callback: function(r) {
if(!r.exc) {
me.frm.set_value("taxes", r.message);
me.calculate_taxes_and_totals();
frappe.run_serially([
() => {
// 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;
}
if (me.in_apply_price_list == true) return;
me.in_apply_price_list = true;
return this.frm.call({
method: "erpnext.stock.get_item_details.apply_price_list",
args: { args: args },
callback: function(r) {
if (!r.exc) {
me.in_apply_price_list = true;
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.in_apply_price_list = false;
frappe.run_serially([
() => 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),
() => {
if(args.items.length) {
me._set_values_for_item_list(r.message.children);
}
},
() => { me.in_apply_price_list = false; }
]);
if(args.items.length) {
me._set_values_for_item_list(r.message.children);
}
} else {
me.in_apply_price_list = false;
}
}
});
@ -1112,11 +1128,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
filters: {'item': item.item_code}
}
} else {
filters = {
let filters = {
'item_code': item.item_code,
'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 {
query : "erpnext.controllers.queries.get_batch_no",