fix: data pulling based on quotation_to and party_name

This commit is contained in:
Saurabh
2019-05-02 14:12:10 +05:30
parent a4bbc68945
commit 1417c7e828
3 changed files with 19 additions and 6 deletions

View File

@@ -103,7 +103,7 @@ erpnext.utils.get_address_display = function(frm, address_field, display_field,
erpnext.utils.set_taxes = function(frm, address_field, display_field, is_your_company_address) {
if(frappe.meta.get_docfield(frm.doc.doctype, "taxes") && !is_your_company_address) {
if(!erpnext.utils.validate_mandatory(frm, "Lead/Customer/Supplier",
frm.doc.customer || frm.doc.supplier || frm.doc.lead, address_field)) {
frm.doc.customer || frm.doc.supplier || frm.doc.lead || frm.doc.party_name , address_field)) {
return;
}
@@ -125,6 +125,9 @@ erpnext.utils.set_taxes = function(frm, address_field, display_field, is_your_co
} else if (frm.doc.supplier) {
party_type = 'Supplier';
party = frm.doc.supplier;
} else if (frm.doc.quotation_to){
party_type = frm.doc.quotation_to;
party = frm.doc.party_name;
}
frappe.call({

View File

@@ -127,14 +127,24 @@ erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
// to overwrite the customer_filter trigger from queries.js
this.frm.toggle_reqd("party_name", this.frm.doc.quotation_to);
this.frm.set_query('customer_address', erpnext.queries.address_query);
this.frm.set_query('shipping_address_name', erpnext.queries.address_query);
this.frm.set_query('customer_address', this.address_query);
this.frm.set_query('shipping_address_name', this.address_query);
},
tc_name: function() {
this.get_terms();
},
address_query: function(doc) {
return {
query: 'frappe.contacts.doctype.address.address.address_query',
filters: {
link_doctype: frappe.dynamic_link.doctype,
link_name: doc.party_name
}
};
},
validate_company_and_party: function(party_field) {
if(!this.frm.doc.quotation_to) {
frappe.msgprint(__("Please select a value for {0} quotation_to {1}", [this.frm.doc.doctype, this.frm.doc.name]));

View File

@@ -441,7 +441,7 @@
"collapsible": 1,
"collapsible_depends_on": "",
"columns": 0,
"depends_on": "eval:(doc.customer || doc.lead)",
"depends_on": "eval:doc.party_name",
"fetch_if_empty": 0,
"fieldname": "contact_section",
"fieldtype": "Section Break",
@@ -542,7 +542,7 @@
"bold": 0,
"collapsible": 0,
"columns": 0,
"depends_on": "eval:doc.customer",
"depends_on": "eval:doc.quotaion_to=='Customer' && doc.party_name",
"fetch_if_empty": 0,
"fieldname": "contact_person",
"fieldtype": "Link",
@@ -3224,7 +3224,7 @@
"istable": 0,
"max_attachments": 1,
"menu_index": 0,
"modified": "2019-04-25 15:26:21.983298",
"modified": "2019-05-02 14:10:43.355616",
"modified_by": "Administrator",
"module": "Selling",
"name": "Quotation",