Merge branch 'hotfix'

This commit is contained in:
Nabin Hait 2017-05-24 09:07:26 +05:30
commit cf1e0508af
3 changed files with 12 additions and 8 deletions

View File

@ -2,7 +2,7 @@
from __future__ import unicode_literals
import frappe
__version__ = '8.0.36'
__version__ = '8.0.37'
def get_default_company(user=None):

View File

@ -15,9 +15,9 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
// if rate is greater than price_list_rate, set margin
// or set discount
item.discount_percentage = 0;
item.margin_type = 'Percentage';
item.margin_rate_or_amount = flt(Math.abs(1 - item.rate / item.price_list_rate) * 100.0,
precision("discount_percentage", item));
item.margin_type = 'Amount';
item.margin_rate_or_amount = flt(item.rate - item.price_list_rate,
precision("margin_rate_or_amount", item));
item.rate_with_margin = item.rate;
} else {
item.discount_percentage = flt((1 - item.rate / item.price_list_rate) * 100.0,

View File

@ -348,10 +348,14 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
margin_type: function(doc, cdt, cdn){
// calculate the revised total margin and rate on margin type changes
item = locals[cdt][cdn];
if(!item.margin_type) {
frappe.model.set_value(cdt, cdn, "margin_rate_or_amount", 0);
} else {
this.apply_pricing_rule_on_item(item, doc,cdt, cdn)
this.calculate_taxes_and_totals();
cur_frm.refresh_fields();
}
}
});
frappe.ui.form.on(cur_frm.doctype,"project", function(frm) {