fix: place of supply change on address change
This commit is contained in:
parent
642819b955
commit
6b10d87d46
@ -135,6 +135,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
|||||||
supplier_address: function() {
|
supplier_address: function() {
|
||||||
erpnext.utils.get_address_display(this.frm);
|
erpnext.utils.get_address_display(this.frm);
|
||||||
erpnext.utils.set_taxes_from_address(this.frm, "supplier_address", "supplier_address", "supplier_address");
|
erpnext.utils.set_taxes_from_address(this.frm, "supplier_address", "supplier_address", "supplier_address");
|
||||||
|
erpnext.utils.set_place_of_supply(this.frm)
|
||||||
},
|
},
|
||||||
|
|
||||||
buying_price_list: function() {
|
buying_price_list: function() {
|
||||||
|
|||||||
@ -116,6 +116,19 @@ $.extend(erpnext.utils, {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
set_place_of_supply: function(frm){
|
||||||
|
frappe.call({
|
||||||
|
method: "erpnext.regional.india.utils.get_place_of_supply",
|
||||||
|
args: {
|
||||||
|
"party_details": frm.doc,
|
||||||
|
"doctype": frm.doc.doctype
|
||||||
|
},
|
||||||
|
callback: function(r){
|
||||||
|
frm.set_value("place_of_supply", r.message)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
add_indicator_for_multicompany: function(frm, info) {
|
add_indicator_for_multicompany: function(frm, info) {
|
||||||
frm.dashboard.stats_area.removeClass('hidden');
|
frm.dashboard.stats_area.removeClass('hidden');
|
||||||
frm.dashboard.stats_area_row.addClass('flex');
|
frm.dashboard.stats_area_row.addClass('flex');
|
||||||
@ -304,21 +317,6 @@ $.extend(erpnext.utils, {
|
|||||||
}
|
}
|
||||||
frappe.ui.form.make_quick_entry(doctype, null, null, new_doc);
|
frappe.ui.form.make_quick_entry(doctype, null, null, new_doc);
|
||||||
});
|
});
|
||||||
},
|
|
||||||
|
|
||||||
set_place_of_supply: function(frm){
|
|
||||||
frappe.call({
|
|
||||||
method: "erpnext.regional.india.utils.get_place_of_supply",
|
|
||||||
args: {
|
|
||||||
"party_details": frm.doc,
|
|
||||||
"doctype": frm.doc.doctype
|
|
||||||
},
|
|
||||||
callback: function(r){
|
|
||||||
if(r.message){
|
|
||||||
frm.set_value("place_of_supply", r.message)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -138,6 +138,9 @@ def test_method():
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_place_of_supply(party_details, doctype):
|
def get_place_of_supply(party_details, doctype):
|
||||||
if not frappe.get_meta('Address').has_field('gst_state'): return
|
if not frappe.get_meta('Address').has_field('gst_state'): return
|
||||||
|
if isinstance(party_details, string_types):
|
||||||
|
party_details = json.loads(party_details)
|
||||||
|
party_details = frappe._dict(party_details)
|
||||||
|
|
||||||
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
|
if doctype in ("Sales Invoice", "Delivery Note", "Sales Order"):
|
||||||
address_name = party_details.customer_address or party_details.shipping_address_name
|
address_name = party_details.customer_address or party_details.shipping_address_name
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user