[Fixes] RFQ contact and multiple creation of supplier quotation issue
This commit is contained in:
parent
e739c0cf4e
commit
f154c611bb
@ -100,8 +100,19 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
frappe.ui.form.on("Request for Quotation Supplier",{
|
frappe.ui.form.on("Request for Quotation Supplier",{
|
||||||
supplier: function(frm, cdt, cdn) {
|
supplier: function(frm, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn]
|
var d = locals[cdt][cdn]
|
||||||
frappe.model.set_value(cdt, cdn, 'contact', '')
|
frappe.call({
|
||||||
frappe.model.set_value(cdt, cdn, 'email_id', '')
|
method:"erpnext.accounts.party.get_party_details",
|
||||||
|
args:{
|
||||||
|
party: d.supplier,
|
||||||
|
party_type: 'Supplier'
|
||||||
|
},
|
||||||
|
callback: function(r){
|
||||||
|
if(r.message){
|
||||||
|
frappe.model.set_value(cdt, cdn, 'contact', r.message.contact_person)
|
||||||
|
frappe.model.set_value(cdt, cdn, 'email_id', r.message.contact_email)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
download_pdf: function(frm, cdt, cdn) {
|
download_pdf: function(frm, cdt, cdn) {
|
||||||
|
@ -192,6 +192,8 @@ def create_supplier_quotation(doc):
|
|||||||
if isinstance(doc, basestring):
|
if isinstance(doc, basestring):
|
||||||
doc = json.loads(doc)
|
doc = json.loads(doc)
|
||||||
|
|
||||||
|
validate_duplicate_supplier_quotation(doc)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
sq_doc = frappe.get_doc({
|
sq_doc = frappe.get_doc({
|
||||||
"doctype": "Supplier Quotation",
|
"doctype": "Supplier Quotation",
|
||||||
@ -242,4 +244,14 @@ def get_rfq_doc(doctype, name, supplier_idx):
|
|||||||
doc = frappe.get_doc(doctype, name)
|
doc = frappe.get_doc(doctype, name)
|
||||||
args = doc.get('suppliers')[cint(supplier_idx) - 1]
|
args = doc.get('suppliers')[cint(supplier_idx) - 1]
|
||||||
doc.update_supplier_part_no(args)
|
doc.update_supplier_part_no(args)
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def validate_duplicate_supplier_quotation(args):
|
||||||
|
data = frappe.db.sql("""select sq.name as name from `tabSupplier Quotation` sq,
|
||||||
|
`tabSupplier Quotation Item` sqi where sqi.parent = sq.name and sq.supplier = %(supplier)s
|
||||||
|
and sqi.request_for_quotation = %(rfq)s and sq.docstatus < 2""",
|
||||||
|
{'supplier': args.get('supplier'), 'rfq': args.get('name')}, as_dict=True)
|
||||||
|
|
||||||
|
if data and data[0] and data[0].name:
|
||||||
|
frappe.throw(_("Already supplier quotation has created"))
|
||||||
|
@ -79,6 +79,7 @@ rfq = Class.extend({
|
|||||||
},
|
},
|
||||||
btn: this,
|
btn: this,
|
||||||
callback: function(r){
|
callback: function(r){
|
||||||
|
$('.btn-sm').hide()
|
||||||
frappe.unfreeze();
|
frappe.unfreeze();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user