[Enhancement] Supplier quotation added on supplier portal

This commit is contained in:
Rohit Waghchaure 2016-09-21 16:49:58 +05:30
parent 0be6073f10
commit 21499e820d
6 changed files with 35 additions and 6 deletions

View File

@ -210,7 +210,7 @@ def create_supplier_quotation(doc):
frappe.msgprint(_("Supplier Quotation {0} created").format(sq_doc.name))
return sq_doc.name
except Exception:
return
return None
def add_items(sq_doc, supplier, items):
for data in items:

View File

@ -3,6 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt
from frappe.model.mapper import get_mapped_doc
@ -54,6 +55,18 @@ class SupplierQuotation(BuyingController):
pc = frappe.get_doc('Purchase Common')
pc.validate_for_items(self)
def get_list_context(context=None):
from erpnext.controllers.website_list_for_contact import get_list_context
list_context = get_list_context(context)
list_context.update({
'show_sidebar': True,
'show_search': True,
'no_breadcrumbs': True,
'title': _('Supplier Quotation'),
})
return list_context
@frappe.whitelist()
def make_purchase_order(source_name, target_doc=None):
def set_missing_values(source, target):

View File

@ -25,7 +25,10 @@ def get_transaction_list(doctype, txt=None, filters=None, limit_start=0, limit_p
if not filters: filters = []
filters.append((doctype, "docstatus", "=", 1))
if doctype == 'Supplier Quotation':
filters.append((doctype, "docstatus", "<", 2))
else:
filters.append((doctype, "docstatus", "=", 1))
if user != "Guest" and is_website_user():
parties_doctype = 'Request for Quotation Supplier' if doctype == 'Request for Quotation' else doctype
@ -112,7 +115,8 @@ def has_website_permission(doc, ptype, user, verbose=False):
return frappe.get_all(doctype, filters=[(doctype, "customer", "in", customers),
(doctype, "name", "=", doc.name)]) and True or False
elif suppliers:
return frappe.get_all(doctype, filters=[(doctype, "suppliers", "in", suppliers),
fieldname = 'suppliers' if doctype == 'Request for Quotation' else 'supplier'
return frappe.get_all(doctype, filters=[(doctype, fieldname, "in", suppliers),
(doctype, "name", "=", doc.name)]) and True or False
else:
return False

View File

@ -67,6 +67,13 @@ website_route_rules = [
"parents": [{"title": _("Invoices"), "name": "invoices"}]
}
},
{"from_route": "/quotations", "to_route": "Supplier Quotation"},
{"from_route": "/quotations/<path:name>", "to_route": "order",
"defaults": {
"doctype": "Supplier Quotation",
"parents": [{"title": _("Supplier Quotation"), "name": "quotations"}]
}
},
{"from_route": "/shipments", "to_route": "Delivery Note"},
{"from_route": "/shipments/<path:name>", "to_route": "order",
"defaults": {
@ -95,6 +102,7 @@ website_route_rules = [
portal_menu_items = [
{"title": _("Projects"), "route": "/project", "reference_doctype": "Project"},
{"title": _("Request for Quotations"), "route": "/rfq", "reference_doctype": "Request for Quotation"},
{"title": _("Supplier Quotation"), "route": "/quotations", "reference_doctype": "Supplier Quotation"},
{"title": _("Orders"), "route": "/orders", "reference_doctype": "Sales Order"},
{"title": _("Invoices"), "route": "/invoices", "reference_doctype": "Sales Invoice"},
{"title": _("Shipments"), "route": "/shipments", "reference_doctype": "Delivery Note"},
@ -109,6 +117,7 @@ portal_menu_items = [
has_website_permission = {
"Sales Order": "erpnext.controllers.website_list_for_contact.has_website_permission",
"Sales Invoice": "erpnext.controllers.website_list_for_contact.has_website_permission",
"Supplier Quotation": "erpnext.controllers.website_list_for_contact.has_website_permission",
"Delivery Note": "erpnext.controllers.website_list_for_contact.has_website_permission",
"Issue": "erpnext.support.doctype.issue.issue.has_website_permission",
"Address": "erpnext.utilities.doctype.address.address.has_website_permission",

View File

@ -81,8 +81,11 @@ rfq = Class.extend({
},
btn: this,
callback: function(r){
$('.btn-sm').hide()
frappe.unfreeze();
if(r.message){
$('.btn-sm').hide()
window.location.href = "/quotations/" + encodeURIComponent(r.message);
}
}
})
})

View File

@ -16,8 +16,8 @@ def get_context(context):
context.parents = frappe.form_dict.parents
context.payment_ref = frappe.db.get_value("Payment Request",
{"reference_name": frappe.form_dict.name}, "name")
context.enabled_checkout = frappe.get_doc("Shopping Cart Settings").enable_checkout
if not context.doc.has_website_permission("read"):
frappe.throw(_("Not Permitted"), frappe.PermissionError)