ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Add TAX to shipping costs


#1

Think I must be going mad. Just realised that tax is not added to our shipping charges.

We have tax (VAT) set up at 20%, it is added to the products but not the shipping charges.

I assume I am missing a setting somewhere. Any ideas?


#2

How are you adding the shipping the shipping charge in the first place?


#3

As a shipping rule

On the sales order no TAX rate


#4

Still have not been able to solve this. Any ideas how to add our VAT tax to the shipping cost?


#5

Hi ! I’ve got the same issue, has anyone found a workaround ?
I understand you can add a new row with tax on prrevious row, but it seems risky because one can forget it very easily

Thanks !


#6

I never worked it out so I set up an item called “shipping” and used that instead


#7

We have also found this occurs, and per Pay VAT tax on shipping charges @umair states to place the shipping prior to the tax in the charges table and ensuring the tax is set to apply on the previous row total…

Now although that can work, it is problematic given the default tax templates always place the tax first and you add shipping after, so you need to move the items around and also change the tax to apply on the previous row - which is too error prone for end users. We elected to go the single item route for shipping too, however when doing packing slips you need to remember to remove the item as it is a non-stock item and so the packing slip cannot be saved…


#8

I went that route too, made an item for shipping and made a tax rule for it under its item page.


#9

Hi !

Found a little workaround for this.
We created a button called “Add Shipping and Taxes”, and then a Custom Script to enter what we wanted in a pop-up box and have it saved in the correct order.

In customize form:


In the form:
image

The custom script:



#10

Thanks for your contribution ecollot,

Please could you copy and paste your code here, so others can use it but not have to key it in or contact you.

thank you


#11

Sure, here it is:

/*
Sales Invoice Script

What this does:

  • Handles click on “Add shipping and taxes” button:
    • Empties taxes table
    • Replaces by two items: first item shipping, second item VAT (applies to previous total)

*/
frappe.ui.form.on(“Sales Invoice”, {

refresh: function (frm) {

    frm.add_shipping = function (cost, shipAccount, costCenter, vat) {
        frm.clear_table("taxes");

        var shipping = frm.add_child("taxes");
        frappe.model.set_value(shipping.doctype, shipping.name, "charge_type", "Actual");
        frappe.model.set_value(shipping.doctype, shipping.name, "account_head", shipAccount);
        frappe.model.set_value(shipping.doctype, shipping.name, "cost_center", costCenter);
        frappe.model.set_value(shipping.doctype, shipping.name, "description", "Shipping");
        frappe.model.set_value(shipping.doctype, shipping.name, "tax_amount", cost);

        var taxes = frm.add_child("taxes");
        frappe.model.set_value(taxes.doctype, taxes.name, "charge_type", "On Previous Row Total");
        frappe.model.set_value(taxes.doctype, taxes.name, "row_id", "1");
        frappe.model.set_value(taxes.doctype, taxes.name, "cost_center", costCenter);
        // frappe.model.set_value(taxes.doctype, taxes.name, "description", "Shipping");
        frappe.model.set_value(taxes.doctype, taxes.name, "account_head", vat);

        frm.refresh_field("taxes");
    }
},
add_shipping_and_taxes: function (frm) {
    frappe.prompt([{
            'fieldname': 'cost',
            'fieldtype': 'Currency',
            'label': 'Shipping Cost',
            'reqd': 1,
            'default': 0,
        }, {
            'fieldname': 'costCenter',
            'fieldtype': 'Select',
	'options': 'General - AMF\n' +
		'Automation - AMF\n' +
		'Patch - AMF',
            'label': 'Cost Center',
            'reqd': 1,
            'default': 0,
        },{
            'fieldname': 'shipAccount',
            'fieldtype': 'Select',
	'options': 
		'3410 - Frais de transport et commissions (ex Paypal) - AMF',
            'label': 'Shipping Account',
            'reqd': 1,
        },{
            'fieldname': 'vat',
            'fieldtype': 'Select',
	'options': 
		'VAT 7.7% - AMF\n' + 
		'VAT 0% - AMF\n' + 
		'VAT 2.5% - AMF',
            'label': 'VAT',
            'reqd': 1,
        }],
        function (values) {
            console.log(values);
            frm.add_shipping(values.cost, values.shipAccount, values.costCenter, values.vat);
        },
        'Shipping Cost Entry',
        'Add shipping',
    );
},

});