feat: provision to draft quotation from portal

This commit is contained in:
Anupam 2020-09-23 21:48:48 +05:30
parent 5c04b2eea4
commit c077fac2a6
5 changed files with 65 additions and 49 deletions

View File

@ -25,7 +25,7 @@ def get_transaction_list(doctype, txt=None, filters=None, limit_start=0, limit_p
if not filters: filters = [] if not filters: filters = []
if doctype in ['Supplier Quotation', 'Purchase Invoice']: if doctype in ['Supplier Quotation', 'Purchase Invoice', 'Quotation']:
filters.append((doctype, 'docstatus', '<', 2)) filters.append((doctype, 'docstatus', '<', 2))
else: else:
filters.append((doctype, 'docstatus', '=', 1)) filters.append((doctype, 'docstatus', '=', 1))

View File

@ -96,7 +96,7 @@ def place_order():
def request_for_quotation(): def request_for_quotation():
quotation = _get_cart_quotation() quotation = _get_cart_quotation()
quotation.flags.ignore_permissions = True quotation.flags.ignore_permissions = True
quotation.submit() quotation.save() if get_shopping_cart_settings().draft_quotation else quotation.submit()
return quotation.name return quotation.name
@frappe.whitelist() @frappe.whitelist()

View File

@ -12,6 +12,7 @@
"show_price", "show_price",
"show_stock_availability", "show_stock_availability",
"enable_variants", "enable_variants",
"draft_quotation",
"column_break_7", "column_break_7",
"show_contact_us_button", "show_contact_us_button",
"show_quantity_in_website", "show_quantity_in_website",
@ -166,13 +167,20 @@
"fieldname": "enable_variants", "fieldname": "enable_variants",
"fieldtype": "Check", "fieldtype": "Check",
"label": "Enable Variants" "label": "Enable Variants"
},
{
"default": "0",
"depends_on": "eval: doc.enable_checkout == 0",
"fieldname": "draft_quotation",
"fieldtype": "Check",
"label": "Draft Quotation"
} }
], ],
"icon": "fa fa-shopping-cart", "icon": "fa fa-shopping-cart",
"idx": 1, "idx": 1,
"issingle": 1, "issingle": 1,
"links": [], "links": [],
"modified": "2020-08-02 18:21:43.873303", "modified": "2020-09-23 13:18:09.057707",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Shopping Cart", "module": "Shopping Cart",
"name": "Shopping Cart Settings", "name": "Shopping Cart Settings",

View File

@ -14,7 +14,11 @@
</div> </div>
</div> </div>
<div class="col-sm-3 text-right bold"> <div class="col-sm-3 text-right bold">
{{ doc.get_formatted("grand_total") }} {% if doc.doctype == "Quotation" and not doc.docstatus %}
{{ _("Pending For Approval") }}
{% else %}
{{ doc.get_formatted("grand_total") }}
{% endif %}
</div> </div>
</div> </div>
<a class="transaction-item-link" href="/{{ pathname }}/{{ doc.name }}">Link</a> <a class="transaction-item-link" href="/{{ pathname }}/{{ doc.name }}">Link</a>

View File

@ -12,22 +12,23 @@
{% endblock %} {% endblock %}
{% block header_actions %} {% block header_actions %}
<div class="dropdown"> {% if not(doc.doctype == "Quotation" and not doc.docstatus) %}
<button class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <div class="dropdown">
<span>{{ _('Actions') }}</span> <button class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<b class="caret"></b> <span>{{ _('Actions') }}</span>
</button> <b class="caret"></b>
<ul class="dropdown-menu dropdown-menu-right" role="menu"> </button>
{% if doc.doctype == 'Purchase Order' %} <ul class="dropdown-menu dropdown-menu-right" role="menu">
<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> {% if doc.doctype == 'Purchase Order' %}
{% endif %} <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>
<a class="dropdown-item" href='/printview?doctype={{ doc.doctype}}&name={{ doc.name }}&format={{ print_format }}' {% endif %}
target="_blank" rel="noopener noreferrer"> <a class="dropdown-item" href='/printview?doctype={{ doc.doctype}}&name={{ doc.name }}&format={{ print_format }}'
{{ _("Print") }} target="_blank" rel="noopener noreferrer">
</a> {{ _("Print") }}
</ul> </a>
</div> </ul>
</div>
{% endif %}
{% endblock %} {% endblock %}
{% block page_content %} {% block page_content %}
@ -65,43 +66,46 @@
<div class="order-container"> <div class="order-container">
<!-- items --> <!-- items -->
<div class="order-item-table"> {% if doc.doctype == "Quotation" and not doc.docstatus %}
<div class="row order-items order-item-header text-muted"> {{ _("Pending For Approval") }}
<div class="col-sm-6 col-6 h6 text-uppercase"> {% else %}
{{ _("Item") }} <div class="order-item-table">
<div class="row order-items order-item-header text-muted">
<div class="col-sm-6 col-6 h6 text-uppercase">
{{ _("Item") }}
</div>
<div class="col-sm-3 col-xs-3 text-right h6 text-uppercase">
{{ _("Quantity") }}
</div>
<div class="col-sm-3 col-xs-3 text-right h6 text-uppercase">
{{ _("Amount") }}
</div>
</div> </div>
<div class="col-sm-3 col-xs-3 text-right h6 text-uppercase"> {% for d in doc.items %}
{{ _("Quantity") }} <div class="row order-items">
</div> <div class="col-sm-6 col-6">
<div class="col-sm-3 col-xs-3 text-right h6 text-uppercase"> {{ item_name_and_description(d) }}
{{ _("Amount") }} </div>
<div class="col-sm-3 col-xs-3 text-right">
{{ d.qty }}
{% if d.delivered_qty is defined and d.delivered_qty != None %}
<p class="text-muted small">{{ _("Delivered") }}&nbsp;{{ d.delivered_qty }}</p>
{% endif %}
</div>
<div class="col-sm-3 col-xs-3 text-right">
{{ d.get_formatted("amount") }}
<p class="text-muted small">{{ _("Rate:") }}&nbsp;{{ d.get_formatted("rate") }}</p>
</div>
</div> </div>
{% endfor %}
</div> </div>
{% for d in doc.items %} <!-- taxes -->
<div class="row order-items">
<div class="col-sm-6 col-6">
{{ item_name_and_description(d) }}
</div>
<div class="col-sm-3 col-xs-3 text-right">
{{ d.qty }}
{% if d.delivered_qty is defined and d.delivered_qty != None %}
<p class="text-muted small">{{ _("Delivered") }}&nbsp;{{ d.delivered_qty }}</p>
{% endif %}
</div>
<div class="col-sm-3 col-xs-3 text-right">
{{ d.get_formatted("amount") }}
<p class="text-muted small">{{ _("Rate:") }}&nbsp;{{ d.get_formatted("rate") }}</p>
</div>
</div>
{% endfor %}
</div>
<!-- taxes -->
<div class="order-taxes d-flex justify-content-end"> <div class="order-taxes d-flex justify-content-end">
<table> <table>
{% include "erpnext/templates/includes/order/order_taxes.html" %} {% include "erpnext/templates/includes/order/order_taxes.html" %}
</table> </table>
</div> </div>
{% endif %}
</div> </div>
{% if enabled_checkout and ((doc.doctype=="Sales Order" and doc.per_billed <= 0) {% if enabled_checkout and ((doc.doctype=="Sales Order" and doc.per_billed <= 0)