brotherton-erpnext/erpnext/regional/india/taxes.js
Deepesh Garg 15ff6a594b
feat: Inter warehouse stock transfer on valuation rate with taxation (#20083)
* fix: Validation for target warehouse

* feat: Get items on valuation rate in delivery note on Internal transfers

* fix: Create Inter company purchase receipt from delivery note

* feat: Inter company stock transfer on valuation rate with taxation

* fix: Add from warehouse in purchase invoice

* fix: Use get_value instead of get_cached_value

* fix: Get incoming rate instead of valuation rate

* fix: GL entry for from warehouse in purchase receipt

* fix: GL Entries fixes in purchase invoice

* fix: Address and tax fetching fixes

* fix: Add test case for stock transfer via purchase receipt

* fix: Code cleanup, added validations and test cases

* fix: Validation for supplier warehouse

* fix: Test Cases

* fix: Change validation condition

* fix: Address fixes while creating Purchase Receipt from delivery note

* fix: Set taxes while creating Purchase Receipt from Delivery Note

* fix: Update set_missing_value function

Co-authored-by: Nabin Hait <nabinhait@gmail.com>
2020-02-18 12:28:41 +05:30

45 lines
1.3 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');
},
tax_category: function(frm) {
frm.trigger('get_tax_template');
},
get_tax_template: function(frm) {
let party_details = {
'shipping_address': frm.doc.shipping_address || '',
'shipping_address_name': frm.doc.shipping_address_name || '',
'customer_address': frm.doc.customer_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,
return_taxes: 1
},
callback: function(r) {
if(r.message) {
frm.set_value('taxes_and_charges', r.message.taxes_and_charges);
} else if (frm.doc.is_internal_supplier || frm.doc.is_internal_customer) {
frm.set_value('taxes_and_charges', '');
frm.set_value('taxes', []);
}
}
});
}
});
};