From 2851a41310a050afee753c8ac396eb808d0d123c Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Wed, 18 Oct 2023 16:31:35 +0530 Subject: [PATCH] fix: Issues related to RFQ and Supplier Quotation on Portal (#37565) fix: RFQ and Supplier Quotation for Portal --- erpnext/accounts/party.py | 17 +++- erpnext/templates/includes/rfq.js | 2 + .../templates/includes/rfq/rfq_macros.html | 24 ++++-- erpnext/templates/pages/order.html | 86 ++++++------------- erpnext/templates/pages/rfq.html | 4 +- 5 files changed, 59 insertions(+), 74 deletions(-) diff --git a/erpnext/accounts/party.py b/erpnext/accounts/party.py index 365aa7f2a3..310e41208f 100644 --- a/erpnext/accounts/party.py +++ b/erpnext/accounts/party.py @@ -7,7 +7,6 @@ from typing import Optional import frappe from frappe import _, msgprint, scrub from frappe.contacts.doctype.address.address import get_company_address, get_default_address -from frappe.contacts.doctype.contact.contact import get_contact_details from frappe.core.doctype.user_permission.user_permission import get_permitted_documents from frappe.model.utils import get_fetch_values from frappe.query_builder.functions import Abs, Date, Sum @@ -294,7 +293,21 @@ def set_contact_details(party_details, party, party_type): } ) else: - party_details.update(get_contact_details(party_details.contact_person)) + fields = [ + "name as contact_person", + "full_name as contact_display", + "email_id as contact_email", + "mobile_no as contact_mobile", + "phone as contact_phone", + "designation as contact_designation", + "department as contact_department", + ] + + contact_details = frappe.db.get_value( + "Contact", party_details.contact_person, fields, as_dict=True + ) + + party_details.update(contact_details) def set_other_values(party_details, party, party_type): diff --git a/erpnext/templates/includes/rfq.js b/erpnext/templates/includes/rfq.js index 37beb5a584..ed0f1b1ff3 100644 --- a/erpnext/templates/includes/rfq.js +++ b/erpnext/templates/includes/rfq.js @@ -73,6 +73,7 @@ rfq = class rfq { submit_rfq(){ $('.btn-sm').click(function(){ + debugger frappe.freeze(); frappe.call({ type: "POST", @@ -82,6 +83,7 @@ rfq = class rfq { }, btn: this, callback: function(r){ + debugger frappe.unfreeze(); if(r.message){ $('.btn-sm').hide() diff --git a/erpnext/templates/includes/rfq/rfq_macros.html b/erpnext/templates/includes/rfq/rfq_macros.html index 88724c30de..78ec6ff5f8 100644 --- a/erpnext/templates/includes/rfq/rfq_macros.html +++ b/erpnext/templates/includes/rfq/rfq_macros.html @@ -1,19 +1,25 @@ {% from "erpnext/templates/includes/macros.html" import product_image_square, product_image %} {% macro item_name_and_description(d, doc) %} -
-
- {{ product_image(d.image) }} -
-
- {{ d.item_code }} -

{{ d.description }}

+
+
+ {% if d.image %} + {{ product_image(d.image) }} + {% else %} +
+ {{ frappe.utils.get_abbr(d.item_name)}} +
+ {% endif %} +
+
+ {{ d.item_code }} +

{{ d.description }}

{% set supplier_part_no = frappe.db.get_value("Item Supplier", {'parent': d.item_code, 'supplier': doc.supplier}, "supplier_part_no") %}

{% if supplier_part_no %} {{_("Supplier Part No") + ": "+ supplier_part_no}} {% endif %}

-
-
+
+
{% endmacro %} diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html index bc34ad5ac5..97bf48727c 100644 --- a/erpnext/templates/pages/order.html +++ b/erpnext/templates/pages/order.html @@ -1,5 +1,5 @@ {% extends "templates/web.html" %} -{% from "erpnext/templates/includes/order/order_macros.html" import item_name_and_description %} +{% from "erpnext/templates/includes/macros.html" import product_image %} {% block breadcrumbs %} {% include "templates/includes/breadcrumbs.html" %} @@ -34,18 +34,6 @@ - {% if show_pay_button %} -
- -
- {% endif %} {% endblock %} @@ -130,42 +118,6 @@ - {% if enabled_checkout and ((doc.doctype=="Sales Order" and doc.per_billed <= 0) - or (doc.doctype=="Sales Invoice" and doc.outstanding_amount> 0)) %} -
-
-
-
-
- {% if available_loyalty_points %} -
-
-
- Loyalty Points -
-
-
- -
-
Enter Loyalty Points
-
-
- -
-

Available Points: {{ - available_loyalty_points }}

-
-
- {% endif %} -
-
-
-
-
- {% endif %} - - {% if attachments %}
@@ -193,15 +145,27 @@ {% endif %} {% endblock %} -{% block script %} - - -{% endblock %} \ No newline at end of file +{% macro item_name_and_description(d) %} +
+
+
+ {% if d.thumbnail or d.image %} + {{ product_image(d.thumbnail or d.image, no_border=True) }} + {% else %} +
+ {{ frappe.utils.get_abbr(d.item_name) or "NA" }} +
+ {% endif %} +
+
+
+ {{ d.item_code }} +
+ {{ html2text(d.description) | truncate(140) }} +
+ + {{ _("Qty ") }}({{ d.get_formatted("qty") }}) + +
+
+{% endmacro %} \ No newline at end of file diff --git a/erpnext/templates/pages/rfq.html b/erpnext/templates/pages/rfq.html index 6516482c23..d371bf2161 100644 --- a/erpnext/templates/pages/rfq.html +++ b/erpnext/templates/pages/rfq.html @@ -1,7 +1,7 @@ {% extends "templates/web.html" %} {% block header %} -

{{ doc.name }}

+

{{ doc.name }}

{% endblock %} {% block script %} @@ -16,7 +16,7 @@ {% if doc.items %} + {{ _("Make Quotation") }} {% endif %} {% endblock %}