[enhancement] get valuation rate and gross profit on sales order item

This commit is contained in:
Saurabh
2016-02-25 18:59:20 +05:30
parent 27e9b77a3d
commit d313553ae3
7 changed files with 91 additions and 31 deletions

View File

@@ -603,6 +603,7 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
callback: function(r) {
if (!r.exc && r.message) {
me._set_values_for_item_list(r.message);
if(item) me.gross_profit(item);
if(calculate_taxes_and_totals) me.calculate_taxes_and_totals();
}
}
@@ -876,6 +877,10 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
refresh_field('to_date');
}
}
},
gross_profit: function(item) {
item.gross_profit = flt((((item.rate - item.valuation_rate) * item.qty) * (this.frm.doc.conversion_rate || 1)), precision("amount", item));
}
});
@@ -888,7 +893,8 @@ frappe.ui.form.on(cur_frm.doctype + " Item", "rate", function(frm, cdt, cdn) {
} else {
item.discount_percentage = 0.0;
}
cur_frm.cscript.gross_profit(item);
cur_frm.cscript.calculate_taxes_and_totals();
})