From c077fac2a6f481e0f4014182b760f9408538dfdb Mon Sep 17 00:00:00 2001 From: Anupam Date: Wed, 23 Sep 2020 21:48:48 +0530 Subject: [PATCH 01/14] 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 ecf041efd17..801c405732c 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 a7e8388be9d..414b3defe70 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 32004efdca3..b3286edc15b 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 80a542f74bf..c3b717d093a 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 9e3c58b45be..19a10279bcd 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 02/14] 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 40bc0c749b7..c619963a918 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 8370d9b997c4fb9368b29102a6fd2fa9ceb73a96 Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 24 Sep 2020 11:51:03 +0530 Subject: [PATCH 03/14] fix: Check Company in Payment Entry before selecting values --- .../doctype/payment_entry/payment_entry.js | 18 ++++++++++++++++-- erpnext/public/js/controllers/accounts.js | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 9fc44bc1f07..e1174717382 100644 --- a/erpnext/accounts/doctype/payment_entry/payment_entry.js +++ b/erpnext/accounts/doctype/payment_entry/payment_entry.js @@ -12,9 +12,10 @@ frappe.ui.form.on('Payment Entry', { setup: function(frm) { frm.set_query("paid_from", function() { + frm.events.validate_company(frm); + var account_types = in_list(["Pay", "Internal Transfer"], frm.doc.payment_type) ? ["Bank", "Cash"] : [frappe.boot.party_account_types[frm.doc.party_type]]; - return { filters: { "account_type": ["in", account_types], @@ -23,13 +24,16 @@ frappe.ui.form.on('Payment Entry', { } } }); + frm.set_query("party_type", function() { + frm.events.validate_company(frm); return{ filters: { "name": ["in", Object.keys(frappe.boot.party_account_types)], } } }); + frm.set_query("party_bank_account", function() { return { filters: { @@ -39,6 +43,7 @@ frappe.ui.form.on('Payment Entry', { } } }); + frm.set_query("bank_account", function() { return { filters: { @@ -47,6 +52,7 @@ frappe.ui.form.on('Payment Entry', { } } }); + frm.set_query("contact_person", function() { if (frm.doc.party) { return { @@ -58,10 +64,12 @@ frappe.ui.form.on('Payment Entry', { }; } }); + frm.set_query("paid_to", function() { + frm.events.validate_company(frm); + var account_types = in_list(["Receive", "Internal Transfer"], frm.doc.payment_type) ? ["Bank", "Cash"] : [frappe.boot.party_account_types[frm.doc.party_type]]; - return { filters: { "account_type": ["in", account_types], @@ -150,6 +158,12 @@ frappe.ui.form.on('Payment Entry', { frm.events.show_general_ledger(frm); }, + validate_company: (frm) => { + if (!frm.doc.company){ + frappe.throw({message:__("Please select a Company first."), title: __("Mandatory")}); + } + }, + company: function(frm) { frm.events.hide_unhide_fields(frm); frm.events.set_dynamic_labels(frm); diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index f4eaad58dae..6e97d811fc1 100644 --- a/erpnext/public/js/controllers/accounts.js +++ b/erpnext/public/js/controllers/accounts.js @@ -120,7 +120,7 @@ frappe.ui.form.on('Salary Structure', { var get_payment_mode_account = function(frm, mode_of_payment, callback) { if(!frm.doc.company) { - frappe.throw(__("Please select the Company first")); + frappe.throw({message:__("Please select a Company first."), title: __("Mandatory")}); } if(!mode_of_payment) { From 4f395cce54579e02804bc3678b35ff4cc0fcd8d2 Mon Sep 17 00:00:00 2001 From: marination Date: Thu, 24 Sep 2020 12:43:41 +0530 Subject: [PATCH 04/14] chore: Add Filter Group to dialogs --- erpnext/public/js/utils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 87982f14a6e..9ed500932f3 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -480,7 +480,7 @@ erpnext.utils.update_child_items = function(opts) { callback: r => { if(!r.exc) { if (this.doc.conversion_factor == r.message.conversion_factor) return; - + const docname = this.doc.docname; dialog.fields_dict.trans_items.df.data.some(doc => { if (doc.docname == docname) { @@ -677,6 +677,7 @@ erpnext.utils.map_current_doc = function(opts) { date_field: opts.date_field || undefined, setters: opts.setters, get_query: opts.get_query, + add_filters_group: 1, action: function(selections, args) { let values = selections; if(values.length === 0){ From a4df1058136753f6c5afe0f06fe2be584cb8d6c4 Mon Sep 17 00:00:00 2001 From: Anupam Date: Thu, 24 Sep 2020 13:21:54 +0530 Subject: [PATCH 05/14] 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 c3b717d093a..fd4835ed99e 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 19a10279bcd..01b5f6df6c5 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 2fa2a40b3f37a83380dc52a493c8a3a628fcb8c4 Mon Sep 17 00:00:00 2001 From: Saqib Date: Thu, 24 Sep 2020 15:07:29 +0530 Subject: [PATCH 06/14] chore: make asset movement transaction date match with purchase date & time (#23423) --- erpnext/assets/doctype/asset/asset.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 72debb7ebaa..efdbdb1fbfc 100644 --- a/erpnext/assets/doctype/asset/asset.py +++ b/erpnext/assets/doctype/asset/asset.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import frappe, erpnext, math, json from frappe import _ from six import string_types -from frappe.utils import flt, add_months, cint, nowdate, getdate, today, date_diff, month_diff, add_days, get_last_day +from frappe.utils import flt, add_months, cint, nowdate, getdate, today, date_diff, month_diff, add_days, get_last_day, get_datetime from frappe.model.document import Document from erpnext.assets.doctype.asset_category.asset_category import get_asset_category_account from erpnext.assets.doctype.asset.depreciation \ @@ -140,6 +140,10 @@ class Asset(AccountsController): def make_asset_movement(self): reference_doctype = 'Purchase Receipt' if self.purchase_receipt else 'Purchase Invoice' reference_docname = self.purchase_receipt or self.purchase_invoice + transaction_date = getdate(self.purchase_date) + if reference_docname: + posting_date, posting_time = frappe.db.get_value(reference_doctype, reference_docname, ["posting_date", "posting_time"]) + transaction_date = get_datetime("{} {}".format(posting_date, posting_time)) assets = [{ 'asset': self.name, 'asset_name': self.asset_name, @@ -151,7 +155,7 @@ class Asset(AccountsController): 'assets': assets, 'purpose': 'Receipt', 'company': self.company, - 'transaction_date': getdate(self.purchase_date), + 'transaction_date': transaction_date, 'reference_doctype': reference_doctype, 'reference_name': reference_docname }).insert() From 78ee75d744cac330267a7d21dec794b181e5bb30 Mon Sep 17 00:00:00 2001 From: Anupam Date: Thu, 24 Sep 2020 16:17:02 +0530 Subject: [PATCH 07/14] 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 414b3defe70..9439f6af4ca 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 b3286edc15b..2a7b86bdae8 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 08/14] 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 9439f6af4ca..0ccc0252c31 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 2a7b86bdae8..9d61e7d0ece 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 751256518483252771bc47a4452800a0b2c5fb03 Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Fri, 25 Sep 2020 12:45:47 +0530 Subject: [PATCH 09/14] fix: Patient Appointment not able to save (#23434) Co-authored-by: Rucha Mahabal --- .../doctype/patient_appointment/patient_appointment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py index 512fb48360f..e685b20a8c8 100755 --- a/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py +++ b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py @@ -6,7 +6,7 @@ from __future__ import unicode_literals import frappe from frappe.model.document import Document import json -from frappe.utils import getdate, get_time +from frappe.utils import getdate, get_time, flt from frappe.model.mapper import get_mapped_doc from frappe import _ import datetime @@ -45,7 +45,7 @@ class PatientAppointment(Document): def validate_overlaps(self): end_time = datetime.datetime.combine(getdate(self.appointment_date), get_time(self.appointment_time)) \ - + datetime.timedelta(minutes=float(self.duration)) + + datetime.timedelta(minutes=flt(self.duration)) overlaps = frappe.db.sql(""" select From fec4ea56430eb7c27b6a6ac54ad23c42c7d2c8c5 Mon Sep 17 00:00:00 2001 From: prssanna Date: Thu, 24 Sep 2020 17:08:22 +0530 Subject: [PATCH 10/14] fix: set stock uom in tem while creating material request from stock entry --- erpnext/stock/doctype/stock_entry/stock_entry.js | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 1f95447951d..39fd029a89b 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.js +++ b/erpnext/stock/doctype/stock_entry/stock_entry.js @@ -156,6 +156,7 @@ frappe.ui.form.on('Stock Entry', { mr_item.item_code = item.item_code; mr_item.item_name = item.item_name; mr_item.uom = item.uom; + mr_item.stock_uom = item.stock_uom; mr_item.conversion_factor = item.conversion_factor; mr_item.item_group = item.item_group; mr_item.description = item.description; From 5b3af82e75f60aeb9f9a9c8a4523ab8a5c1e273b Mon Sep 17 00:00:00 2001 From: Anupam Kumar Date: Mon, 28 Sep 2020 10:59:43 +0530 Subject: [PATCH 11/14] 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 c619963a918..dbf15de1e48 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 %} From 519a00ce44ebb2462d8ff2ffa9e1afa505d5c0ae Mon Sep 17 00:00:00 2001 From: Anupam Date: Mon, 28 Sep 2020 13:09:37 +0530 Subject: [PATCH 12/14] fix: flushing contact details, generating assignment rule issues --- erpnext/crm/doctype/lead/lead.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 315d298eb43..31db569a34d 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -27,9 +27,6 @@ class Lead(SellingController): def after_insert(self): self.update_links() - # after the address and contact are created, flush the field values - # to avoid inconsistent reporting in case the documents are changed - self.flush_address_and_contact_fields() def validate(self): self.set_lead_name() @@ -210,14 +207,6 @@ class Lead(SellingController): }) self.contact_doc.save() - def flush_address_and_contact_fields(self): - fields = ['address_type', 'address_line1', 'address_line2', 'address_title', - 'city', 'county', 'country', 'fax', 'pincode', 'state'] - - for field in fields: - self.set(field, None) - - @frappe.whitelist() def make_customer(source_name, target_doc=None): return _make_customer(source_name, target_doc) From ce39323a0afb06ec3391659f4f3305f6c91bbdbf Mon Sep 17 00:00:00 2001 From: madar2020 <59777434+madar2020@users.noreply.github.com> Date: Mon, 28 Sep 2020 15:06:25 +0300 Subject: [PATCH 13/14] feat: Allow rich text edit for questions (#23402) * rich text * Update question.json As to make sense for rich text * Update quiz_question.json * Update question.json * Update quiz_question.json * Update macros.html fix: cards in second row of homepage section overlapps the row before. * Revert "Update macros.html" This reverts commit b649b507e5d546b5b4a78fbf68053493a71c7af2. Co-authored-by: Rucha Mahabal --- erpnext/education/doctype/question/question.json | 6 +++--- erpnext/education/doctype/quiz_question/quiz_question.json | 6 +++--- erpnext/public/js/education/lms/quiz.js | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/erpnext/education/doctype/question/question.json b/erpnext/education/doctype/question/question.json index b3a161daa07..e3967606161 100644 --- a/erpnext/education/doctype/question/question.json +++ b/erpnext/education/doctype/question/question.json @@ -13,7 +13,7 @@ "fields": [ { "fieldname": "question", - "fieldtype": "Small Text", + "fieldtype": "Text Editor", "in_list_view": 1, "label": "Question", "reqd": 1 @@ -34,7 +34,7 @@ "read_only": 1 } ], - "modified": "2019-05-30 18:39:21.880974", + "modified": "2020-09-24 18:39:21.880974", "modified_by": "Administrator", "module": "Education", "name": "Question", @@ -77,4 +77,4 @@ "quick_entry": 1, "sort_field": "modified", "sort_order": "DESC" -} \ No newline at end of file +} diff --git a/erpnext/education/doctype/quiz_question/quiz_question.json b/erpnext/education/doctype/quiz_question/quiz_question.json index 0564482516f..aab07a3e6bb 100644 --- a/erpnext/education/doctype/quiz_question/quiz_question.json +++ b/erpnext/education/doctype/quiz_question/quiz_question.json @@ -20,14 +20,14 @@ { "fetch_from": "question_link.question", "fieldname": "question", - "fieldtype": "Data", + "fieldtype": "Text Editor", "in_list_view": 1, "label": "Question", "read_only": 1 } ], "istable": 1, - "modified": "2019-06-12 12:24:02.312577", + "modified": "2020-09-24 12:24:02.312577", "modified_by": "Administrator", "module": "Education", "name": "Quiz Question", @@ -37,4 +37,4 @@ "sort_field": "modified", "sort_order": "DESC", "track_changes": 1 -} \ No newline at end of file +} diff --git a/erpnext/public/js/education/lms/quiz.js b/erpnext/public/js/education/lms/quiz.js index 91cbbf4d662..4a9d1e34e6f 100644 --- a/erpnext/public/js/education/lms/quiz.js +++ b/erpnext/public/js/education/lms/quiz.js @@ -140,7 +140,7 @@ class Question { make_question() { let question_wrapper = document.createElement('h5'); question_wrapper.classList.add('mt-3'); - question_wrapper.innerText = this.question; + question_wrapper.innerHTML = this.question; this.wrapper.appendChild(question_wrapper); } From 77cf53201aec3f4f07af2a5270ea6f66aaf72b34 Mon Sep 17 00:00:00 2001 From: Anupam Date: Mon, 28 Sep 2020 18:38:41 +0530 Subject: [PATCH 14/14] feat: open lead status on next contact date --- erpnext/crm/doctype/lead/lead.py | 5 +++++ erpnext/hooks.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 31db569a34d..99fa703feec 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -365,3 +365,8 @@ def get_lead_with_phone_number(number): lead = leads[0].name if leads else None return lead + +def daily_open_lead(): + leads = frappe.get_all("Lead", filters = [["contact_date", "Between", [nowdate(), nowdate()]]]) + for lead in leads: + frappe.db.set_value("Lead", lead.name, "status", "Open") \ No newline at end of file diff --git a/erpnext/hooks.py b/erpnext/hooks.py index f8b6be70ca0..4e05076a3d2 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -336,7 +336,8 @@ scheduler_events = { "erpnext.hr.doctype.leave_ledger_entry.leave_ledger_entry.process_expired_allocation", "erpnext.hr.utils.generate_leave_encashment", "erpnext.loan_management.doctype.loan_security_shortfall.loan_security_shortfall.create_process_loan_security_shortfall", - "erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual.process_loan_interest_accrual_for_term_loans" + "erpnext.loan_management.doctype.loan_interest_accrual.loan_interest_accrual.process_loan_interest_accrual_for_term_loans", + "erpnext.crm.doctype.lead.lead.daily_open_lead" ], "monthly_long": [ "erpnext.accounts.deferred_revenue.process_deferred_accounting",