From c077fac2a6f481e0f4014182b760f9408538dfdb Mon Sep 17 00:00:00 2001 From: Anupam Date: Wed, 23 Sep 2020 21:48:48 +0530 Subject: [PATCH 1/6] feat: provision to draft quotation from portal --- .../controllers/website_list_for_contact.py | 2 +- erpnext/shopping_cart/cart.py | 2 +- .../shopping_cart_settings.json | 10 +- .../templates/includes/transaction_row.html | 6 +- erpnext/templates/pages/order.html | 94 ++++++++++--------- 5 files changed, 65 insertions(+), 49 deletions(-) diff --git a/erpnext/controllers/website_list_for_contact.py b/erpnext/controllers/website_list_for_contact.py index ecf041efd1..801c405732 100644 --- a/erpnext/controllers/website_list_for_contact.py +++ b/erpnext/controllers/website_list_for_contact.py @@ -25,7 +25,7 @@ def get_transaction_list(doctype, txt=None, filters=None, limit_start=0, limit_p if not filters: filters = [] - if doctype in ['Supplier Quotation', 'Purchase Invoice']: + if doctype in ['Supplier Quotation', 'Purchase Invoice', 'Quotation']: filters.append((doctype, 'docstatus', '<', 2)) else: filters.append((doctype, 'docstatus', '=', 1)) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index a7e8388be9..414b3defe7 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -96,7 +96,7 @@ def place_order(): def request_for_quotation(): quotation = _get_cart_quotation() quotation.flags.ignore_permissions = True - quotation.submit() + quotation.save() if get_shopping_cart_settings().draft_quotation else quotation.submit() return quotation.name @frappe.whitelist() diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json index 32004efdca..b3286edc15 100644 --- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json +++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json @@ -12,6 +12,7 @@ "show_price", "show_stock_availability", "enable_variants", + "draft_quotation", "column_break_7", "show_contact_us_button", "show_quantity_in_website", @@ -166,13 +167,20 @@ "fieldname": "enable_variants", "fieldtype": "Check", "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", "idx": 1, "issingle": 1, "links": [], - "modified": "2020-08-02 18:21:43.873303", + "modified": "2020-09-23 13:18:09.057707", "modified_by": "Administrator", "module": "Shopping Cart", "name": "Shopping Cart Settings", diff --git a/erpnext/templates/includes/transaction_row.html b/erpnext/templates/includes/transaction_row.html index 80a542f74b..c3b717d093 100644 --- a/erpnext/templates/includes/transaction_row.html +++ b/erpnext/templates/includes/transaction_row.html @@ -14,7 +14,11 @@
- {{ doc.get_formatted("grand_total") }} + {% if doc.doctype == "Quotation" and not doc.docstatus %} + {{ _("Pending For Approval") }} + {% else %} + {{ doc.get_formatted("grand_total") }} + {% endif %}
Link diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html index 9e3c58b45b..19a10279bc 100644 --- a/erpnext/templates/pages/order.html +++ b/erpnext/templates/pages/order.html @@ -12,22 +12,23 @@ {% endblock %} {% block header_actions %} - - + {% if not(doc.doctype == "Quotation" and not doc.docstatus) %} + + {% endif %} {% endblock %} {% block page_content %} @@ -65,43 +66,46 @@
-
-
-
- {{ _("Item") }} + {% if doc.doctype == "Quotation" and not doc.docstatus %} + {{ _("Pending For Approval") }} + {% else %} +
+
+
+ {{ _("Item") }} +
+
+ {{ _("Quantity") }} +
+
+ {{ _("Amount") }} +
-
- {{ _("Quantity") }} -
-
- {{ _("Amount") }} + {% for d in doc.items %} +
+
+ {{ item_name_and_description(d) }} +
+
+ {{ d.qty }} + {% if d.delivered_qty is defined and d.delivered_qty != None %} +

{{ _("Delivered") }} {{ d.delivered_qty }}

+ {% endif %} +
+
+ {{ d.get_formatted("amount") }} +

{{ _("Rate:") }} {{ d.get_formatted("rate") }}

+
+ {% endfor %}
- {% for d in doc.items %} -
-
- {{ item_name_and_description(d) }} -
-
- {{ d.qty }} - {% if d.delivered_qty is defined and d.delivered_qty != None %} -

{{ _("Delivered") }} {{ d.delivered_qty }}

- {% endif %} -
-
- {{ d.get_formatted("amount") }} -

{{ _("Rate:") }} {{ d.get_formatted("rate") }}

-
-
- {% endfor %} -
- - +
{% include "erpnext/templates/includes/order/order_taxes.html" %}
+ {% endif %}
{% if enabled_checkout and ((doc.doctype=="Sales Order" and doc.per_billed <= 0) From 09775bbdaad34c6b11bc301e8d9bd061bf174668 Mon Sep 17 00:00:00 2001 From: Anupam Date: Thu, 24 Sep 2020 11:19:32 +0530 Subject: [PATCH 2/6] feat: showing UOM even item price is hidden --- erpnext/templates/generators/item/item_add_to_cart.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/erpnext/templates/generators/item/item_add_to_cart.html b/erpnext/templates/generators/item/item_add_to_cart.html index 40bc0c749b..c619963a91 100644 --- a/erpnext/templates/generators/item/item_add_to_cart.html +++ b/erpnext/templates/generators/item/item_add_to_cart.html @@ -10,7 +10,10 @@ {{ product_info.price.formatted_price_sales_uom }} ({{ product_info.price.formatted_price }} / {{ product_info.uom }}) + {% else %} + {{ _("UOM") }} : {{ product_info.uom }} {% endif %} + {% if cart_settings.show_stock_availability %}
{% if product_info.in_stock == 0 %} From a4df1058136753f6c5afe0f06fe2be584cb8d6c4 Mon Sep 17 00:00:00 2001 From: Anupam Date: Thu, 24 Sep 2020 13:21:54 +0530 Subject: [PATCH 3/6] fix: UI fixes --- .../templates/includes/transaction_row.html | 2 +- erpnext/templates/pages/order.html | 98 +++++++++---------- 2 files changed, 49 insertions(+), 51 deletions(-) diff --git a/erpnext/templates/includes/transaction_row.html b/erpnext/templates/includes/transaction_row.html index c3b717d093..fd4835ed99 100644 --- a/erpnext/templates/includes/transaction_row.html +++ b/erpnext/templates/includes/transaction_row.html @@ -15,7 +15,7 @@
{% if doc.doctype == "Quotation" and not doc.docstatus %} - {{ _("Pending For Approval") }} + {{ _("Pending") }} {% else %} {{ doc.get_formatted("grand_total") }} {% endif %} diff --git a/erpnext/templates/pages/order.html b/erpnext/templates/pages/order.html index 19a10279bc..01b5f6df6c 100644 --- a/erpnext/templates/pages/order.html +++ b/erpnext/templates/pages/order.html @@ -12,23 +12,21 @@ {% endblock %} {% block header_actions %} - {% if not(doc.doctype == "Quotation" and not doc.docstatus) %} - - {% endif %} + {% endblock %} {% block page_content %} @@ -36,7 +34,11 @@
- {{ _(doc.get('indicator_title')) or _(doc.status) or _("Submitted") }} + {% if doc.doctype == "Quotation" and not doc.docstatus %} + {{ _("Pending") }} + {% else %} + {{ _(doc.get('indicator_title')) or _(doc.status) or _("Submitted") }} + {% endif %}
@@ -66,46 +68,42 @@
- {% if doc.doctype == "Quotation" and not doc.docstatus %} - {{ _("Pending For Approval") }} - {% else %} -
-
-
- {{ _("Item") }} -
-
- {{ _("Quantity") }} -
-
- {{ _("Amount") }} -
+
+
+
+ {{ _("Item") }}
- {% for d in doc.items %} -
-
- {{ item_name_and_description(d) }} -
-
- {{ d.qty }} - {% if d.delivered_qty is defined and d.delivered_qty != None %} -

{{ _("Delivered") }} {{ d.delivered_qty }}

- {% endif %} -
-
- {{ d.get_formatted("amount") }} -

{{ _("Rate:") }} {{ d.get_formatted("rate") }}

-
+
+ {{ _("Quantity") }} +
+
+ {{ _("Amount") }}
- {% endfor %}
- + {% for d in doc.items %} +
+
+ {{ item_name_and_description(d) }} +
+
+ {{ d.qty }} + {% if d.delivered_qty is defined and d.delivered_qty != None %} +

{{ _("Delivered") }} {{ d.delivered_qty }}

+ {% endif %} +
+
+ {{ d.get_formatted("amount") }} +

{{ _("Rate:") }} {{ d.get_formatted("rate") }}

+
+
+ {% endfor %} +
+
{% include "erpnext/templates/includes/order/order_taxes.html" %}
- {% endif %}
{% if enabled_checkout and ((doc.doctype=="Sales Order" and doc.per_billed <= 0) From 78ee75d744cac330267a7d21dec794b181e5bb30 Mon Sep 17 00:00:00 2001 From: Anupam Date: Thu, 24 Sep 2020 16:17:02 +0530 Subject: [PATCH 4/6] fix: review changes --- erpnext/shopping_cart/cart.py | 4 +++- .../shopping_cart_settings/shopping_cart_settings.json | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 414b3defe7..9439f6af4c 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -96,7 +96,9 @@ def place_order(): def request_for_quotation(): quotation = _get_cart_quotation() quotation.flags.ignore_permissions = True - quotation.save() if get_shopping_cart_settings().draft_quotation else quotation.submit() + quotation.save() + if not get_shopping_cart_settings().draft_quotation: + quotation.submit() return quotation.name @frappe.whitelist() diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json index b3286edc15..2a7b86bdae 100644 --- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json +++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json @@ -12,7 +12,6 @@ "show_price", "show_stock_availability", "enable_variants", - "draft_quotation", "column_break_7", "show_contact_us_button", "show_quantity_in_website", @@ -28,6 +27,7 @@ "enable_checkout", "payment_success_url", "column_break_11", + "draft_quotation", "payment_gateway_account" ], "fields": [ @@ -173,14 +173,14 @@ "depends_on": "eval: doc.enable_checkout == 0", "fieldname": "draft_quotation", "fieldtype": "Check", - "label": "Draft Quotation" + "label": "Save Quotations as Draft" } ], "icon": "fa fa-shopping-cart", "idx": 1, "issingle": 1, "links": [], - "modified": "2020-09-23 13:18:09.057707", + "modified": "2020-09-24 16:07:04.862183", "modified_by": "Administrator", "module": "Shopping Cart", "name": "Shopping Cart Settings", From dd2f547c3bf845cd37e8f8cb064d71d2982e574d Mon Sep 17 00:00:00 2001 From: Anupam Date: Thu, 24 Sep 2020 16:37:08 +0530 Subject: [PATCH 5/6] fix: Ui fixes --- erpnext/shopping_cart/cart.py | 2 +- .../shopping_cart_settings/shopping_cart_settings.json | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index 9439f6af4c..0ccc0252c3 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -97,7 +97,7 @@ def request_for_quotation(): quotation = _get_cart_quotation() quotation.flags.ignore_permissions = True quotation.save() - if not get_shopping_cart_settings().draft_quotation: + if not get_shopping_cart_settings().save_quotations_as_draft: quotation.submit() return quotation.name diff --git a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json index 2a7b86bdae..9d61e7d0ec 100644 --- a/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json +++ b/erpnext/shopping_cart/doctype/shopping_cart_settings/shopping_cart_settings.json @@ -27,7 +27,7 @@ "enable_checkout", "payment_success_url", "column_break_11", - "draft_quotation", + "save_quotations_as_draft", "payment_gateway_account" ], "fields": [ @@ -171,7 +171,7 @@ { "default": "0", "depends_on": "eval: doc.enable_checkout == 0", - "fieldname": "draft_quotation", + "fieldname": "save_quotations_as_draft", "fieldtype": "Check", "label": "Save Quotations as Draft" } @@ -180,7 +180,7 @@ "idx": 1, "issingle": 1, "links": [], - "modified": "2020-09-24 16:07:04.862183", + "modified": "2020-09-24 16:28:07.192525", "modified_by": "Administrator", "module": "Shopping Cart", "name": "Shopping Cart Settings", From 5b3af82e75f60aeb9f9a9c8a4523ab8a5c1e273b Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Mon, 28 Sep 2020 10:59:43 +0530 Subject: [PATCH 6/6] Update item_add_to_cart.html --- erpnext/templates/generators/item/item_add_to_cart.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/templates/generators/item/item_add_to_cart.html b/erpnext/templates/generators/item/item_add_to_cart.html index c619963a91..dbf15de1e4 100644 --- a/erpnext/templates/generators/item/item_add_to_cart.html +++ b/erpnext/templates/generators/item/item_add_to_cart.html @@ -11,7 +11,7 @@ ({{ product_info.price.formatted_price }} / {{ product_info.uom }}) {% else %} - {{ _("UOM") }} : {{ product_info.uom }} + {{ _("Unit of Measurement") }} : {{ product_info.uom }} {% endif %} {% if cart_settings.show_stock_availability %}