[Feature] Shipping Rule Calculation based on Net Weight (#11770)

* [new] Calculate shipping tax based on weight

* [fix] Change field name weight to weight_per_unit in SI Item

* [new] Shipping Rule based tax for selling module

* [new] Shipping rule based on weight added to Buying module

* [fix] Conflict in jsons

* [fix] Removed Redudant add_fetch

* [fix] Codacy fixed

* [fix] Print hide added
This commit is contained in:
Vishal Dhayagude
2017-11-29 16:09:59 +05:30
committed by Nabin Hait
parent 2d1cbd0b2e
commit d42242df22
24 changed files with 32124 additions and 30853 deletions

View File

@@ -92,6 +92,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
item.amount = flt(item.rate * item.qty, precision("amount", item));
item.net_amount = item.amount;
item.item_tax_amount = 0.0;
item.total_weight = flt(item.weight_per_unit * item.qty);
me.set_in_company_currency(item, ["price_list_rate", "rate", "amount", "net_rate", "net_amount"]);
});
@@ -199,15 +200,17 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
calculate_net_total: function() {
var me = this;
this.frm.doc.total = this.frm.doc.base_total = this.frm.doc.net_total = this.frm.doc.base_net_total = 0.0;
this.frm.doc.total = this.frm.doc.base_total = this.frm.doc.net_total = this.frm.doc.base_net_total = this.frm.doc.total_net_weight= 0.0;
$.each(this.frm.doc["items"] || [], function(i, item) {
me.frm.doc.total += item.amount;
me.frm.doc.base_total += item.base_amount;
me.frm.doc.net_total += item.net_amount;
me.frm.doc.base_net_total += item.base_net_amount;
me.frm.doc.total_net_weight += item.total_weight;
});
frappe.model.round_floats_in(this.frm.doc, ["total", "base_total", "net_total", "base_net_total"]);
},