Skip to content

Commit

Permalink
fix: Issues related to RFQ and Supplier Quotation on Portal (#37565)
Browse files Browse the repository at this point in the history
fix: RFQ and Supplier Quotation for Portal
(cherry picked from commit 2851a41)

# Conflicts:
#	erpnext/accounts/party.py
#	erpnext/templates/pages/order.html
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Oct 18, 2023
1 parent ddec912 commit cba767d
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 13 deletions.
20 changes: 19 additions & 1 deletion erpnext/accounts/party.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@

import frappe
from frappe import _, msgprint, scrub
<<<<<<< HEAD
from frappe.contacts.doctype.address.address import (
get_address_display,
get_company_address,
get_default_address,
)
from frappe.contacts.doctype.contact.contact import get_contact_details
=======
from frappe.contacts.doctype.address.address import get_company_address, get_default_address
>>>>>>> 2851a41310 (fix: Issues related to RFQ and Supplier Quotation on Portal (#37565))
from frappe.core.doctype.user_permission.user_permission import get_permitted_documents
from frappe.model.utils import get_fetch_values
from frappe.utils import (
Expand Down Expand Up @@ -277,7 +281,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):
Expand Down
2 changes: 2 additions & 0 deletions erpnext/templates/includes/rfq.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ rfq = Class.extend({

submit_rfq: function(){
$('.btn-sm').click(function(){
debugger
frappe.freeze();
frappe.call({
type: "POST",
Expand All @@ -82,6 +83,7 @@ rfq = Class.extend({
},
btn: this,
callback: function(r){
debugger
frappe.unfreeze();
if(r.message){
$('.btn-sm').hide()
Expand Down
24 changes: 15 additions & 9 deletions erpnext/templates/includes/rfq/rfq_macros.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
{% from "erpnext/templates/includes/macros.html" import product_image_square, product_image %}

{% macro item_name_and_description(d, doc) %}
<div class="row">
<div class="col-3">
{{ product_image(d.image) }}
</div>
<div class="col-9">
{{ d.item_code }}
<p class="text-muted small">{{ d.description }}</p>
<div class="row">
<div class="col-3">
{% if d.image %}
{{ product_image(d.image) }}
{% else %}
<div class="website-image h-100 w-100" style="background-color:var(--gray-100);text-align: center;line-height: 3.6;">
{{ frappe.utils.get_abbr(d.item_name)}}
</div>
{% endif %}
</div>
<div class="col-9">
{{ d.item_code }}
<p class="text-muted small">{{ d.description }}</p>
{% set supplier_part_no = frappe.db.get_value("Item Supplier", {'parent': d.item_code, 'supplier': doc.supplier}, "supplier_part_no") %}
<p class="text-muted small supplier-part-no">
{% if supplier_part_no %}
{{_("Supplier Part No") + ": "+ supplier_part_no}}
{% endif %}
</p>
</div>
</div>
</div>
</div>
{% endmacro %}
55 changes: 54 additions & 1 deletion erpnext/templates/pages/order.html
Original file line number Diff line number Diff line change
@@ -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" %}
Expand All @@ -12,6 +12,7 @@ <h2 class="m-0">{{ doc.name }}</h2>
{% endblock %}

{% block header_actions %}
<<<<<<< HEAD
<div class="dropdown">
<button class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="font-md">{{ _('Actions') }}</span>
Expand All @@ -26,6 +27,28 @@ <h2 class="m-0">{{ doc.name }}</h2>
{{ _("Print") }}
</a>
</ul>
=======
<div class="row">
<div class="dropdown">
<button class="btn btn-sm btn-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="font-md">{{ _('Actions') }}</span>
<b class="caret"></b>
</button>
<ul class="dropdown-menu dropdown-menu-right" role="menu">
{% if doc.doctype == 'Purchase Order' and show_make_pi_button %}
<a class="dropdown-item"
href="/api/method/erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice_from_portal?purchase_order_name={{ doc.name }}"
data-action="make_purchase_invoice">{{ _("Make Purchase Invoice") }}
</a>
{% endif %}
<a class="dropdown-item"
href='/printview?doctype={{ doc.doctype}}&name={{ doc.name }}&format={{ print_format }}' target="_blank"
rel="noopener noreferrer">
{{ _("Print") }}
</a>
</ul>
</div>
>>>>>>> 2851a41310 (fix: Issues related to RFQ and Supplier Quotation on Portal (#37565))
</div>
{% endblock %}

Expand Down Expand Up @@ -106,6 +129,7 @@ <h2 class="m-0">{{ doc.name }}</h2>
</div>
</div>

<<<<<<< HEAD
{% if enabled_checkout and ((doc.doctype=="Sales Order" and doc.per_billed <= 0)
or (doc.doctype=="Sales Invoice" and doc.outstanding_amount > 0)) %}
<div class="panel panel-default">
Expand Down Expand Up @@ -154,6 +178,8 @@ <h2 class="m-0">{{ doc.name }}</h2>
{% endif %}


=======
>>>>>>> 2851a41310 (fix: Issues related to RFQ and Supplier Quotation on Portal (#37565))
{% if attachments %}
<div class="order-item-table">
<div class="row order-items order-item-header text-muted">
Expand Down Expand Up @@ -181,6 +207,7 @@ <h2 class="m-0">{{ doc.name }}</h2>
{% endif %}
{% endblock %}

<<<<<<< HEAD
{% block script %}
<script> {% include "templates/pages/order.js" %} </script>
<script>
Expand All @@ -193,3 +220,29 @@ <h2 class="m-0">{{ doc.name }}</h2>
}
</script>
{% endblock %}
=======
{% macro item_name_and_description(d) %}
<div class="row item_name_and_description">
<div class="col-xs-4 col-sm-2 order-image-col">
<div class="order-image h-100">
{% if d.thumbnail or d.image %}
{{ product_image(d.thumbnail or d.image, no_border=True) }}
{% else %}
<div class="no-image-cart-item" style="min-height: 100px;">
{{ frappe.utils.get_abbr(d.item_name) or "NA" }}
</div>
{% endif %}
</div>
</div>
<div class="col-xs-8 col-sm-10">
{{ d.item_code }}
<div class="text-muted small item-description">
{{ html2text(d.description) | truncate(140) }}
</div>
<span class="text-muted mt-2 d-l-n order-qty">
{{ _("Qty ") }}({{ d.get_formatted("qty") }})
</span>
</div>
</div>
{% endmacro %}
>>>>>>> 2851a41310 (fix: Issues related to RFQ and Supplier Quotation on Portal (#37565))
4 changes: 2 additions & 2 deletions erpnext/templates/pages/rfq.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "templates/web.html" %}

{% block header %}
<h1>{{ doc.name }}</h1>
<h1 style="margin-top: 10px;">{{ doc.name }}</h1>
{% endblock %}

{% block script %}
Expand All @@ -16,7 +16,7 @@ <h1>{{ doc.name }}</h1>
{% if doc.items %}
<button class="btn btn-primary btn-sm"
type="button">
{{ _("Submit") }}</button>
{{ _("Make Quotation") }}</button>
{% endif %}
{% endblock %}

Expand Down

0 comments on commit cba767d

Please sign in to comment.