diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.js b/erpnext/accounts/doctype/payment_entry/payment_entry.js index 9fc44bc1f0..e117471738 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/assets/doctype/asset/asset.py b/erpnext/assets/doctype/asset/asset.py index 72debb7eba..efdbdb1fbf 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() diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 315d298eb4..31db569a34 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) diff --git a/erpnext/education/doctype/question/question.json b/erpnext/education/doctype/question/question.json index b3a161daa0..e396760616 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 0564482516..aab07a3e6b 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/healthcare/doctype/patient_appointment/patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/patient_appointment.py index 512fb48360..e685b20a8c 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 diff --git a/erpnext/public/js/controllers/accounts.js b/erpnext/public/js/controllers/accounts.js index f4eaad58da..6e97d811fc 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) { diff --git a/erpnext/public/js/education/lms/quiz.js b/erpnext/public/js/education/lms/quiz.js index 91cbbf4d66..4a9d1e34e6 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); } diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.js b/erpnext/stock/doctype/stock_entry/stock_entry.js index 1f95447951..39fd029a89 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;