diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 22580091600..bbab88fe16d 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -387,5 +387,5 @@ def validate_inclusive_tax(tax, doc): not all([cint(t.included_in_print_rate) for t in doc.get("taxes")[:cint(tax.row_id) - 1]]): # all rows about the reffered tax should be inclusive _on_previous_row_error("1 - %d" % (tax.row_id,)) - elif tax.category == "Valuation": + elif tax.get("category") == "Valuation": frappe.throw(_("Valuation type charges can not marked as Inclusive")) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index c786d2ab20e..28499c12df9 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -214,10 +214,10 @@ class calculate_taxes_and_totals(object): # note: grand_total_for_current_item contains the contribution of # item's amount, previously applied tax and the current tax on that item if i==0: - tax.grand_total_for_current_item = flt(item.net_amount + current_tax_amount) + tax.grand_total_for_current_item = flt(item.net_amount + current_tax_amount, tax.precision("total")) else: tax.grand_total_for_current_item = \ - self.doc.get("taxes")[i-1].grand_total_for_current_item + current_tax_amount + flt(self.doc.get("taxes")[i-1].grand_total_for_current_item + current_tax_amount, tax.precision("total_taxes_and_charges")) # in tax.total, accumulate grand total of each item tax.total += tax.grand_total_for_current_item @@ -249,7 +249,7 @@ class calculate_taxes_and_totals(object): current_tax_amount = (tax_rate / 100.0) * \ self.doc.get("taxes")[cint(tax.row_id) - 1].grand_total_for_current_item - # current_tax_amount = flt(current_tax_amount, tax.precision("tax_amount", tax)) + current_tax_amount = flt(current_tax_amount, tax.precision("tax_amount")) self.set_item_wise_tax(item, tax, tax_rate, current_tax_amount) diff --git a/erpnext/public/js/controllers/taxes_and_totals.js b/erpnext/public/js/controllers/taxes_and_totals.js index a3fff913873..d07c91737e0 100644 --- a/erpnext/public/js/controllers/taxes_and_totals.js +++ b/erpnext/public/js/controllers/taxes_and_totals.js @@ -238,10 +238,10 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ // note: grand_total_for_current_item contains the contribution of // item's amount, previously applied tax and the current tax on that item if(i==0) { - tax.grand_total_for_current_item = flt(item.net_amount + current_tax_amount); + tax.grand_total_for_current_item = flt(item.net_amount + current_tax_amount, precision("total", tax)); } else { tax.grand_total_for_current_item = - flt(me.frm.doc["taxes"][i-1].grand_total_for_current_item + current_tax_amount); + flt(me.frm.doc["taxes"][i-1].grand_total_for_current_item + current_tax_amount, precision("total", tax)); } // in tax.total, accumulate grand total for each item @@ -285,7 +285,7 @@ erpnext.taxes_and_totals = erpnext.stock.StockController.extend({ this.frm.doc["taxes"][cint(tax.row_id) - 1].grand_total_for_current_item; } - // current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); + current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax)); this.set_item_wise_tax(item, tax, tax_rate, current_tax_amount); diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index a1c4fb223d0..3669211b589 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -685,7 +685,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({ } }); -frappe.ui.form.on(cur_frm.doctype + "Item", "rate", function(frm, cdt, cdn) { +frappe.ui.form.on(cur_frm.doctype + " Item", "rate", function(frm, cdt, cdn) { var item = frappe.get_doc(cdt, cdn); frappe.model.round_floats_in(item, ["rate", "price_list_rate"]); diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 100675eff51..72d655aa866 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -3,7 +3,6 @@ from __future__ import unicode_literals import frappe -from frappe.utils import cstr from frappe.model.mapper import get_mapped_doc from frappe import _ @@ -18,21 +17,12 @@ class Quotation(SellingController): super(Quotation, self).validate() self.set_status() self.validate_order_type() - self.validate_for_items() self.validate_uom_is_integer("stock_uom", "qty") self.validate_quotation_to() def has_sales_order(self): return frappe.db.get_value("Sales Order Item", {"prevdoc_docname": self.name, "docstatus": 1}) - def validate_for_items(self): - chk_dupl_itm = [] - for d in self.get('items'): - if [cstr(d.item_code),cstr(d.description)] in chk_dupl_itm: - frappe.throw(_("Item {0} with same description entered twice").format(d.item_code)) - else: - chk_dupl_itm.append([cstr(d.item_code),cstr(d.description)]) - def validate_order_type(self): super(Quotation, self).validate_order_type() @@ -169,7 +159,6 @@ def _make_customer(source_name, ignore_permissions=False): else: raise except frappe.MandatoryError: - from frappe.utils import get_url_to_form frappe.throw(_("Please create Customer from Lead {0}").format(lead_name)) else: return customer_name