Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Shipping Rule Tax calculated based on Total Net Weight #11672

Closed
wants to merge 8 commits into from

Conversation

vishdha
Copy link
Contributor

@vishdha vishdha commented Nov 21, 2017

In Shipping Rule select calculate_based_on: Net Weight and Select condition from value to value.
In Sales Invoice Item Weight, total_weight and weight_uom field are added.
based on qty weight are calculated for eg. weight=20 and qty = 5, total_weight = 100
In Sales invoice on select shipping rule, it will calculate tax based on total_net_weight.
weight

"bold": 0,
"collapsible": 0,
"columns": 0,
"fieldname": "weight",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

weight_per_unit will be more clearer

@vishdha vishdha force-pushed the shipping_rule_weight branch 3 times, most recently from 5e53339 to 54a8341 Compare November 22, 2017 11:35
@vishdha
Copy link
Contributor Author

vishdha commented Nov 23, 2017

anim

@@ -343,6 +343,9 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
cur_frm.pformat.print_heading = __("Purchase Invoice");
}

cur_frm.add_fetch('item_code','weight_per_unit','weight_per_unit');
cur_frm.add_fetch('item_code','weight_uom','weight_uom');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrote same code in every file. Add this code into transaction.js and check child table(eg. sales order item) has field weight_per_unit

@@ -70,6 +70,7 @@ def calculate_item_values(self):
item.net_rate = item.rate
item.amount = flt(item.rate * item.qty, item.precision("amount"))
item.net_amount = item.amount
item.total_weight = flt(item.weight_per_unit * item.qty)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total weight will calculate only if there is taxes? I think this has to be done on qty change trigger?

@@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Total weight calculation must be on qty trigger?

@rohitwaghchaure
Copy link
Collaborator

Duplicate #11770

@nabinhait nabinhait deleted the shipping_rule_weight branch December 25, 2017 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants