Merge pull request #5615 from rohitwaghchaure/v7_rfq_fixes
[RFQ Enhancement] Added button on supplier row to download PDF for particular supplier
This commit is contained in:
commit
2be94f7675
@ -2363,6 +2363,31 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"fieldname": "language",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Print Language",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -3006,7 +3031,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2016-06-08 17:30:39.470490",
|
"modified": "2016-06-30 13:40:39.440646",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Accounts",
|
"module": "Accounts",
|
||||||
"name": "Purchase Invoice",
|
"name": "Purchase Invoice",
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
cur_frm.add_fetch('contact', 'email_id', 'email_id')
|
cur_frm.add_fetch('contact', 'email_id', 'email_id')
|
||||||
|
|
||||||
frappe.ui.form.on("Request for Quotation",{
|
frappe.ui.form.on("Request for Quotation",{
|
||||||
setup: function(frm){
|
setup: function(frm) {
|
||||||
frm.fields_dict["suppliers"].grid.get_field("contact").get_query = function(doc, cdt, cdn){
|
frm.fields_dict["suppliers"].grid.get_field("contact").get_query = function(doc, cdt, cdn){
|
||||||
var d =locals[cdt][cdn];
|
var d =locals[cdt][cdn];
|
||||||
return {
|
return {
|
||||||
@ -29,7 +29,7 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
onload: function(frm){
|
onload: function(frm) {
|
||||||
frm.add_fetch('standard_reply', 'response', 'response');
|
frm.add_fetch('standard_reply', 'response', 'response');
|
||||||
|
|
||||||
if(!frm.doc.message_for_supplier) {
|
if(!frm.doc.message_for_supplier) {
|
||||||
@ -37,7 +37,7 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
refresh: function(frm, cdt, cdn){
|
refresh: function(frm, cdt, cdn) {
|
||||||
if (frm.doc.docstatus === 1) {
|
if (frm.doc.docstatus === 1) {
|
||||||
frm.add_custom_button(__("Make Supplier Quotation"),
|
frm.add_custom_button(__("Make Supplier Quotation"),
|
||||||
function(){ frm.trigger("make_suppplier_quotation") });
|
function(){ frm.trigger("make_suppplier_quotation") });
|
||||||
@ -54,7 +54,7 @@ frappe.ui.form.on("Request for Quotation",{
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
make_suppplier_quotation: function(frm){
|
make_suppplier_quotation: function(frm) {
|
||||||
var doc = frm.doc;
|
var doc = frm.doc;
|
||||||
var dialog = new frappe.ui.Dialog({
|
var dialog = new frappe.ui.Dialog({
|
||||||
title: __("For Supplier"),
|
title: __("For Supplier"),
|
||||||
@ -93,10 +93,24 @@ 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.model.set_value(cdt, cdn, 'contact', '')
|
||||||
frappe.model.set_value(cdt, cdn, 'email_id', '')
|
frappe.model.set_value(cdt, cdn, 'email_id', '')
|
||||||
|
},
|
||||||
|
|
||||||
|
download_pdf: function(frm, cdt, cdn) {
|
||||||
|
var child = locals[cdt][cdn]
|
||||||
|
|
||||||
|
var w = window.open(
|
||||||
|
frappe.urllib.get_full_url("/api/method/erpnext.buying.doctype.request_for_quotation.request_for_quotation.get_pdf?"
|
||||||
|
+"doctype="+encodeURIComponent(frm.doc.doctype)
|
||||||
|
+"&name="+encodeURIComponent(frm.doc.name)
|
||||||
|
+"&supplier_idx="+encodeURIComponent(child.idx)
|
||||||
|
+"&no_letterhead=0"));
|
||||||
|
if(!w) {
|
||||||
|
msgprint(__("Please enable pop-ups")); return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@ from __future__ import unicode_literals
|
|||||||
import frappe, json
|
import frappe, json
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
from frappe.utils import get_url, random_string
|
from frappe.utils import get_url, random_string, cint
|
||||||
from frappe.utils.user import get_user_fullname
|
from frappe.utils.user import get_user_fullname
|
||||||
|
from frappe.utils.print_format import download_pdf
|
||||||
from frappe.desk.form.load import get_attachments
|
from frappe.desk.form.load import get_attachments
|
||||||
from frappe.core.doctype.communication.email import make
|
from frappe.core.doctype.communication.email import make
|
||||||
from erpnext.accounts.party import get_party_account_currency, get_party_details
|
from erpnext.accounts.party import get_party_account_currency, get_party_details
|
||||||
@ -136,15 +137,20 @@ class RequestforQuotation(BuyingController):
|
|||||||
|
|
||||||
def get_attachments(self):
|
def get_attachments(self):
|
||||||
attachments = [d.name for d in get_attachments(self.doctype, self.name)]
|
attachments = [d.name for d in get_attachments(self.doctype, self.name)]
|
||||||
attachments.append(frappe.attach_print('Request for Quotation', self.name, doc=self))
|
attachments.append(frappe.attach_print(self.doctype, self.name, doc=self))
|
||||||
return attachments
|
return attachments
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def send_supplier_emails(rfq_name):
|
def send_supplier_emails(rfq_name):
|
||||||
|
check_portal_enabled('Request for Quotation')
|
||||||
rfq = frappe.get_doc("Request for Quotation", rfq_name)
|
rfq = frappe.get_doc("Request for Quotation", rfq_name)
|
||||||
if rfq.docstatus==1:
|
if rfq.docstatus==1:
|
||||||
rfq.send_to_supplier()
|
rfq.send_to_supplier()
|
||||||
|
|
||||||
|
def check_portal_enabled(reference_doctype):
|
||||||
|
if not frappe.db.get_value('Portal Menu Item',
|
||||||
|
{'reference_doctype': reference_doctype}, 'enabled'):
|
||||||
|
frappe.throw(_("Request for Quotation is disabled to access from portal, for more check portal settings."))
|
||||||
|
|
||||||
def get_list_context(context=None):
|
def get_list_context(context=None):
|
||||||
from erpnext.controllers.website_list_for_contact import get_list_context
|
from erpnext.controllers.website_list_for_contact import get_list_context
|
||||||
@ -152,7 +158,6 @@ def get_list_context(context=None):
|
|||||||
list_context["show_sidebar"] = True
|
list_context["show_sidebar"] = True
|
||||||
return list_context
|
return list_context
|
||||||
|
|
||||||
|
|
||||||
# This method is used to make supplier quotation from material request form.
|
# This method is used to make supplier quotation from material request form.
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_supplier_quotation(source_name, for_supplier, target_doc=None):
|
def make_supplier_quotation(source_name, for_supplier, target_doc=None):
|
||||||
@ -226,3 +231,16 @@ def create_rfq_items(sq_doc, supplier, data):
|
|||||||
"request_for_quotation_item": data.name,
|
"request_for_quotation_item": data.name,
|
||||||
"request_for_quotation": data.parent
|
"request_for_quotation": data.parent
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_pdf(doctype, name, supplier_idx):
|
||||||
|
doc = get_rfq_doc(doctype, name, supplier_idx)
|
||||||
|
if doc:
|
||||||
|
download_pdf(doctype, name, doc=doc)
|
||||||
|
|
||||||
|
def get_rfq_doc(doctype, name, supplier_idx):
|
||||||
|
if cint(supplier_idx):
|
||||||
|
doc = frappe.get_doc(doctype, name)
|
||||||
|
args = doc.get('suppliers')[cint(supplier_idx) - 1]
|
||||||
|
doc.update_supplier_part_no(args)
|
||||||
|
return doc
|
@ -162,6 +162,31 @@
|
|||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 1,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"fieldname": "download_pdf",
|
||||||
|
"fieldtype": "Button",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Download PDF",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"hide_heading": 0,
|
"hide_heading": 0,
|
||||||
@ -174,7 +199,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-06-30 02:01:54.130809",
|
"modified": "2016-06-30 12:47:23.564189",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Request for Quotation Supplier",
|
"name": "Request for Quotation Supplier",
|
||||||
|
@ -2193,6 +2193,31 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"fieldname": "language",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Print Language",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 1,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -2419,7 +2444,7 @@
|
|||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"menu_index": 0,
|
"menu_index": 0,
|
||||||
"modified": "2016-06-09 15:11:04.042369",
|
"modified": "2016-06-30 13:42:23.310309",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Purchase Receipt",
|
"name": "Purchase Receipt",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user