brotherton-erpnext/erpnext/regional/india/taxes.js
Deepesh Garg b4be292217
fix: Item valuation for internal stock transfers (#24200)
* fix: Item valuation for internal stocktransfers

* fix: Consider conversion factor for invoices

* fix: Add missing set warehouse fields

* fix: Add validations and other fixes

* fix: Fixes in flow

* fix: Internal sales item link in Purchase Invoice

* fix: Debugging

* fix: Debug travis

* fix: Remove commented code

* fix: Rate forcing in sales order

* fix: Unreallized profit in Sales Register

* fix: Item wise gst sales register fix

* fix: From warehouse in Purchase Order

* fix: Target field in Sales Invoice

* fix: remove self

* fix: GST Purchasse register and other fixes

* fix: Add shipping_address to no field map

* fix: Ref doc map

* fix: Test Cases

* fix: address mapping between sales and purchase document

* fix: Import Error

* fix: Tax updation for internal invoices

* fix: Purchase Order and Invoice linking

* fix: Internal Party validation fix

* fix: validation

* fix(india): GST Taxes for intra state transfer

* fix(india): GST Taxes for intra state transfer

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
2021-01-28 13:09:56 +05:30

52 lines
1.4 KiB
JavaScript

erpnext.setup_auto_gst_taxation = (doctype) => {
frappe.ui.form.on(doctype, {
company_address: function(frm) {
frm.trigger('get_tax_template');
},
shipping_address: function(frm) {
frm.trigger('get_tax_template');
},
supplier_address: function(frm) {
frm.trigger('get_tax_template');
},
tax_category: function(frm) {
frm.trigger('get_tax_template');
},
customer_address: function(frm) {
frm.trigger('get_tax_template');
},
get_tax_template: function(frm) {
if (!frm.doc.company) return;
let party_details = {
'shipping_address': frm.doc.shipping_address || '',
'shipping_address_name': frm.doc.shipping_address_name || '',
'customer_address': frm.doc.customer_address || '',
'supplier_address': frm.doc.supplier_address,
'customer': frm.doc.customer,
'supplier': frm.doc.supplier,
'supplier_gstin': frm.doc.supplier_gstin,
'company_gstin': frm.doc.company_gstin,
'tax_category': frm.doc.tax_category
};
frappe.call({
method: 'erpnext.regional.india.utils.get_regional_address_details',
args: {
party_details: JSON.stringify(party_details),
doctype: frm.doc.doctype,
company: frm.doc.company
},
callback: function(r) {
if(r.message) {
frm.set_value('taxes_and_charges', r.message.taxes_and_charges);
frm.set_value('taxes', r.message.taxes);
frm.set_value('place_of_supply', r.message.place_of_supply);
}
}
});
}
});
}