From edee530d4cba4d6395e5a6f680fa5c33d962b175 Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Fri, 4 Dec 2020 12:13:26 +0530 Subject: [PATCH 01/12] fix: paid amount in Sales Invoice POS return resets to 0 --- erpnext/controllers/taxes_and_totals.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/controllers/taxes_and_totals.py b/erpnext/controllers/taxes_and_totals.py index 81d07c1327..ad58f137ee 100644 --- a/erpnext/controllers/taxes_and_totals.py +++ b/erpnext/controllers/taxes_and_totals.py @@ -641,7 +641,8 @@ class calculate_taxes_and_totals(object): if default_mode_of_payment: self.doc.append('payments', { 'mode_of_payment': default_mode_of_payment.mode_of_payment, - 'amount': total_amount_to_pay + 'amount': total_amount_to_pay, + 'default': 1 }) else: self.doc.is_pos = 0 From 2e4faf96f22bcb0180ae6a16b8567a28cd53e873 Mon Sep 17 00:00:00 2001 From: Anuja P Date: Sat, 5 Dec 2020 13:36:43 +0530 Subject: [PATCH 02/12] fix: Added TDS Payable account number and an error message --- .../standard_chart_of_accounts_with_account_number.py | 3 +++ erpnext/accounts/utils.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py index 6c83e3bd67..acb11e557a 100644 --- a/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py +++ b/erpnext/accounts/doctype/account/chart_of_accounts/verified/standard_chart_of_accounts_with_account_number.py @@ -245,6 +245,9 @@ def get(): "account_number": "2200" }, _("Duties and Taxes"): { + _("TDS Payable"): { + "account_number": "2310" + }, "account_type": "Tax", "is_group": 1, "account_number": "2300" diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 53677cde8a..267c26d47b 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -78,7 +78,10 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb else: return ((fy.name, fy.year_start_date, fy.year_end_date),) - error_msg = _("""{0} {1} not in any active Fiscal Year.""").format(label, formatdate(transaction_date)) + error_msg = _("""{0} {1} not in any active Fiscal Year""").format(label, formatdate(transaction_date)) + if company: + error_msg = _("""{0} for {1}""").format(error_msg, company) + if verbose==1: frappe.msgprint(error_msg) raise FiscalYearError(error_msg) From b6cf75d2a8b0ee03e00e5efcc4263c273b53ab3d Mon Sep 17 00:00:00 2001 From: Anuja P Date: Sat, 5 Dec 2020 22:25:17 +0530 Subject: [PATCH 03/12] fix: error messsage indent fix --- erpnext/accounts/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 267c26d47b..73e610abb8 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -78,7 +78,7 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb else: return ((fy.name, fy.year_start_date, fy.year_end_date),) - error_msg = _("""{0} {1} not in any active Fiscal Year""").format(label, formatdate(transaction_date)) + error_msg = _("""{0} {1} not in any active Fiscal Year""").format(label, formatdate(transaction_date)) if company: error_msg = _("""{0} for {1}""").format(error_msg, company) From 063be69b580ca1691767799744b90943906f1a7c Mon Sep 17 00:00:00 2001 From: Rucha Mahabal Date: Mon, 7 Dec 2020 10:41:05 +0530 Subject: [PATCH 04/12] fix(patch): set update_modified to False while setting issue/opportunity metrics (#24073) --- erpnext/patches/v13_0/rename_issue_doctype_fields.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/patches/v13_0/rename_issue_doctype_fields.py b/erpnext/patches/v13_0/rename_issue_doctype_fields.py index 96a63623c0..fa1dfed643 100644 --- a/erpnext/patches/v13_0/rename_issue_doctype_fields.py +++ b/erpnext/patches/v13_0/rename_issue_doctype_fields.py @@ -29,7 +29,7 @@ def execute(): 'response_by_variance': response_by_variance, 'resolution_by_variance': resolution_by_variance, 'first_response_time': mins_to_first_response - }) + }, update_modified=False) # commit after every 100 updates count += 1 if count%100 == 0: @@ -44,7 +44,7 @@ def execute(): count = 0 for entry in opportunities: mins_to_first_response = convert_to_seconds(entry.mins_to_first_response, 'Minutes') - frappe.db.set_value('Opportunity', entry.name, 'first_response_time', mins_to_first_response) + frappe.db.set_value('Opportunity', entry.name, 'first_response_time', mins_to_first_response, update_modified=False) # commit after every 100 updates count += 1 if count%100 == 0: From 550cb9c78fe2167a43deb9f3a65237a01ebecd17 Mon Sep 17 00:00:00 2001 From: Anuja P Date: Mon, 7 Dec 2020 11:11:00 +0530 Subject: [PATCH 05/12] fix: suggested changes --- erpnext/accounts/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index 73e610abb8..550aaef404 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -78,9 +78,9 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb else: return ((fy.name, fy.year_start_date, fy.year_end_date),) - error_msg = _("""{0} {1} not in any active Fiscal Year""").format(label, formatdate(transaction_date)) + error_msg = _("""{0} {1} is not in any active Fiscal Year""").format(label, formatdate(transaction_date)) if company: - error_msg = _("""{0} for {1}""").format(error_msg, company) + error_msg = _("""{0} for {1}""").format(error_msg, frappe.bold(company)) if verbose==1: frappe.msgprint(error_msg) raise FiscalYearError(error_msg) From 01eca12fa7a38a5f207df0b150e2813b93dd3e64 Mon Sep 17 00:00:00 2001 From: Afshan <33727827+AfshanKhan@users.noreply.github.com> Date: Tue, 8 Dec 2020 09:27:56 +0530 Subject: [PATCH 06/12] fix: overriding po (#24022) * fix: overriding po * fix: po * fix: refactor condition * fix: condition * fix: missing code --- erpnext/controllers/selling_controller.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext/controllers/selling_controller.py b/erpnext/controllers/selling_controller.py index 515239a982..4dbd7bfa18 100644 --- a/erpnext/controllers/selling_controller.py +++ b/erpnext/controllers/selling_controller.py @@ -42,7 +42,7 @@ class SellingController(StockController): self.validate_max_discount() self.validate_selling_price() self.set_qty_as_per_stock_uom() - self.set_po_nos() + self.set_po_nos(for_validate=True) self.set_gross_profit() set_default_income_account_for_item(self) self.set_customer_address() @@ -370,20 +370,28 @@ class SellingController(StockController): })) self.make_sl_entries(sl_entries) - def set_po_nos(self): + def set_po_nos(self, for_validate=False): if self.doctype == 'Sales Invoice' and hasattr(self, "items"): + if for_validate and self.po_no: + return self.set_pos_for_sales_invoice() if self.doctype == 'Delivery Note' and hasattr(self, "items"): + if for_validate and self.po_no: + return self.set_pos_for_delivery_note() def set_pos_for_sales_invoice(self): po_nos = [] + if self.po_no: + po_nos.append(self.po_no) self.get_po_nos('Sales Order', 'sales_order', po_nos) self.get_po_nos('Delivery Note', 'delivery_note', po_nos) self.po_no = ', '.join(list(set(x.strip() for x in ','.join(po_nos).split(',')))) def set_pos_for_delivery_note(self): po_nos = [] + if self.po_no: + po_nos.append(self.po_no) self.get_po_nos('Sales Order', 'against_sales_order', po_nos) self.get_po_nos('Sales Invoice', 'against_sales_invoice', po_nos) self.po_no = ', '.join(list(set(x.strip() for x in ','.join(po_nos).split(',')))) From 749d36a4dd5b2c0134f022c6ef2c4da427839582 Mon Sep 17 00:00:00 2001 From: Afshan <33727827+AfshanKhan@users.noreply.github.com> Date: Tue, 8 Dec 2020 09:32:04 +0530 Subject: [PATCH 07/12] fix: double exception in payroll (#24078) --- erpnext/payroll/doctype/payroll_entry/payroll_entry.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/payroll/doctype/payroll_entry/payroll_entry.py b/erpnext/payroll/doctype/payroll_entry/payroll_entry.py index 67ee231e40..8c2d9740ec 100644 --- a/erpnext/payroll/doctype/payroll_entry/payroll_entry.py +++ b/erpnext/payroll/doctype/payroll_entry/payroll_entry.py @@ -289,7 +289,9 @@ class PayrollEntry(Document): jv_name = journal_entry.name self.update_salary_slip_status(jv_name = jv_name) except Exception as e: - frappe.msgprint(e) + if type(e) in (str, list, tuple): + frappe.msgprint(e) + raise return jv_name From 797f0cfa6108f9bae9dfa776413cd6e2fc4b48f9 Mon Sep 17 00:00:00 2001 From: Jannat Patel <31363128+pateljannat@users.noreply.github.com> Date: Tue, 8 Dec 2020 09:33:13 +0530 Subject: [PATCH 08/12] fix: sales invoice add button from sales order dashboard (#24077) Co-authored-by: pateljannat --- erpnext/selling/doctype/sales_order/sales_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 1d890bb91a..d4fb07cc27 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -8,7 +8,7 @@ frappe.ui.form.on("Sales Order", { frm.custom_make_buttons = { 'Delivery Note': 'Delivery Note', 'Pick List': 'Pick List', - 'Sales Invoice': 'Invoice', + 'Sales Invoice': 'Sales Invoice', 'Material Request': 'Material Request', 'Purchase Order': 'Purchase Order', 'Project': 'Project', From d369710c654f65149f6138301cc9d0c4434e2e79 Mon Sep 17 00:00:00 2001 From: Anuja Pawar <60467153+Anuja-pawar@users.noreply.github.com> Date: Tue, 8 Dec 2020 09:40:08 +0530 Subject: [PATCH 09/12] fix: fixed home desk page (#24075) * fix: fixed home desk page * fix: suggested changes Co-authored-by: Marica * fix: suggested changes Co-authored-by: Marica --- erpnext/setup/desk_page/home/home.json | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/erpnext/setup/desk_page/home/home.json b/erpnext/setup/desk_page/home/home.json index 9cf9f41907..0fbd0eccda 100644 --- a/erpnext/setup/desk_page/home/home.json +++ b/erpnext/setup/desk_page/home/home.json @@ -1,25 +1,5 @@ { "cards": [ - { - "hidden": 0, - "label": "Healthcare", - "links": "[\n {\n \"label\": \"Patient\",\n \"name\": \"Patient\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Diagnosis\",\n \"name\": \"Diagnosis\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]" - }, - { - "hidden": 0, - "label": "Agriculture", - "links": "[\n {\n \"label\": \"Crop\",\n \"name\": \"Crop\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Crop Cycle\",\n \"name\": \"Crop Cycle\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Location\",\n \"name\": \"Location\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Fertilizer\",\n \"name\": \"Fertilizer\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]" - }, - { - "hidden": 0, - "label": "Education", - "links": "[\n {\n \"label\": \"Student\",\n \"name\": \"Student\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Course\",\n \"name\": \"Course\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Instructor\",\n \"name\": \"Instructor\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"label\": \"Room\",\n \"name\": \"Room\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]" - }, - { - "hidden": 0, - "label": "Non Profit", - "links": "[\n {\n \"description\": \"Member information.\",\n \"label\": \"Member\",\n \"name\": \"Member\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Volunteer information.\",\n \"label\": \"Volunteer\",\n \"name\": \"Volunteer\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Chapter information.\",\n \"label\": \"Chapter\",\n \"name\": \"Chapter\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n },\n {\n \"description\": \"Donor information.\",\n \"label\": \"Donor\",\n \"name\": \"Donor\",\n \"onboard\": 1,\n \"type\": \"doctype\"\n }\n]" - }, { "hidden": 0, "label": "Stock", @@ -54,10 +34,11 @@ "docstatus": 0, "doctype": "Desk Page", "extends_another_page": 0, + "hide_custom": 0, "idx": 0, "is_standard": 1, "label": "Home", - "modified": "2020-05-11 10:20:37.358701", + "modified": "2020-12-07 14:22:38.667767", "modified_by": "Administrator", "module": "Setup", "name": "Home", @@ -96,4 +77,4 @@ "type": "Page" } ] -} \ No newline at end of file +} From 0baebbdafec4309124787af32c187645811252b8 Mon Sep 17 00:00:00 2001 From: Walstan Baptista <38958184+walstanb@users.noreply.github.com> Date: Tue, 8 Dec 2020 09:43:29 +0530 Subject: [PATCH 10/12] fix: added Purchase Order to Global Search (#24055) --- .../purchase_order/purchase_order.json | 3 +- erpnext/hooks.py | 73 ++++++++++--------- erpnext/patches.txt | 1 + .../patches/v13_0/add_po_to_global_search.py | 17 +++++ 4 files changed, 57 insertions(+), 37 deletions(-) create mode 100644 erpnext/patches/v13_0/add_po_to_global_search.py diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index 71231f68c8..75da71ceff 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -168,6 +168,7 @@ "bold": 1, "fieldname": "supplier", "fieldtype": "Link", + "in_global_search": 1, "in_standard_filter": 1, "label": "Supplier", "oldfieldname": "supplier", @@ -1106,7 +1107,7 @@ "idx": 105, "is_submittable": 1, "links": [], - "modified": "2020-10-30 13:58:14.697921", + "modified": "2020-12-03 16:46:44.229351", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 987345697a..1e3bb6a5cf 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -441,42 +441,43 @@ global_search_doctypes = { {"doctype": "Sales Order", "index": 8}, {"doctype": "Quotation", "index": 9}, {"doctype": "Work Order", "index": 10}, - {"doctype": "Purchase Receipt", "index": 11}, - {"doctype": "Purchase Invoice", "index": 12}, - {"doctype": "Delivery Note", "index": 13}, - {"doctype": "Stock Entry", "index": 14}, - {"doctype": "Material Request", "index": 15}, - {"doctype": "Delivery Trip", "index": 16}, - {"doctype": "Pick List", "index": 17}, - {"doctype": "Salary Slip", "index": 18}, - {"doctype": "Leave Application", "index": 19}, - {"doctype": "Expense Claim", "index": 20}, - {"doctype": "Payment Entry", "index": 21}, - {"doctype": "Lead", "index": 22}, - {"doctype": "Opportunity", "index": 23}, - {"doctype": "Item Price", "index": 24}, - {"doctype": "Purchase Taxes and Charges Template", "index": 25}, - {"doctype": "Sales Taxes and Charges", "index": 26}, - {"doctype": "Asset", "index": 27}, - {"doctype": "Project", "index": 28}, - {"doctype": "Task", "index": 29}, - {"doctype": "Timesheet", "index": 30}, - {"doctype": "Issue", "index": 31}, - {"doctype": "Serial No", "index": 32}, - {"doctype": "Batch", "index": 33}, - {"doctype": "Branch", "index": 34}, - {"doctype": "Department", "index": 35}, - {"doctype": "Employee Grade", "index": 36}, - {"doctype": "Designation", "index": 37}, - {"doctype": "Job Opening", "index": 38}, - {"doctype": "Job Applicant", "index": 39}, - {"doctype": "Job Offer", "index": 40}, - {"doctype": "Salary Structure Assignment", "index": 41}, - {"doctype": "Appraisal", "index": 42}, - {"doctype": "Loan", "index": 43}, - {"doctype": "Maintenance Schedule", "index": 44}, - {"doctype": "Maintenance Visit", "index": 45}, - {"doctype": "Warranty Claim", "index": 46}, + {"doctype": "Purchase Order", "index": 11}, + {"doctype": "Purchase Receipt", "index": 12}, + {"doctype": "Purchase Invoice", "index": 13}, + {"doctype": "Delivery Note", "index": 14}, + {"doctype": "Stock Entry", "index": 15}, + {"doctype": "Material Request", "index": 16}, + {"doctype": "Delivery Trip", "index": 17}, + {"doctype": "Pick List", "index": 18}, + {"doctype": "Salary Slip", "index": 19}, + {"doctype": "Leave Application", "index": 20}, + {"doctype": "Expense Claim", "index": 21}, + {"doctype": "Payment Entry", "index": 22}, + {"doctype": "Lead", "index": 23}, + {"doctype": "Opportunity", "index": 24}, + {"doctype": "Item Price", "index": 25}, + {"doctype": "Purchase Taxes and Charges Template", "index": 26}, + {"doctype": "Sales Taxes and Charges", "index": 27}, + {"doctype": "Asset", "index": 28}, + {"doctype": "Project", "index": 29}, + {"doctype": "Task", "index": 30}, + {"doctype": "Timesheet", "index": 31}, + {"doctype": "Issue", "index": 32}, + {"doctype": "Serial No", "index": 33}, + {"doctype": "Batch", "index": 34}, + {"doctype": "Branch", "index": 35}, + {"doctype": "Department", "index": 36}, + {"doctype": "Employee Grade", "index": 37}, + {"doctype": "Designation", "index": 38}, + {"doctype": "Job Opening", "index": 39}, + {"doctype": "Job Applicant", "index": 40}, + {"doctype": "Job Offer", "index": 41}, + {"doctype": "Salary Structure Assignment", "index": 42}, + {"doctype": "Appraisal", "index": 43}, + {"doctype": "Loan", "index": 44}, + {"doctype": "Maintenance Schedule", "index": 45}, + {"doctype": "Maintenance Visit", "index": 46}, + {"doctype": "Warranty Claim", "index": 47}, ], "Healthcare": [ {'doctype': 'Patient', 'index': 1}, diff --git a/erpnext/patches.txt b/erpnext/patches.txt index a5c5254b7f..86ac613ae5 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -739,4 +739,5 @@ erpnext.patches.v13_0.update_custom_fields_for_shopify execute:frappe.delete_doc("Report", "Quoted Item Comparison") erpnext.patches.v13_0.updates_for_multi_currency_payroll erpnext.patches.v13_0.create_leave_policy_assignment_based_on_employee_current_leave_policy +erpnext.patches.v13_0.add_po_to_global_search erpnext.patches.v13_0.update_returned_qty_in_pr_dn diff --git a/erpnext/patches/v13_0/add_po_to_global_search.py b/erpnext/patches/v13_0/add_po_to_global_search.py new file mode 100644 index 0000000000..1c60b18e5b --- /dev/null +++ b/erpnext/patches/v13_0/add_po_to_global_search.py @@ -0,0 +1,17 @@ +from __future__ import unicode_literals +import frappe + + +def execute(): + global_search_settings = frappe.get_single("Global Search Settings") + + if "Purchase Order" in ( + dt.document_type for dt in global_search_settings.allowed_in_global_search + ): + return + + global_search_settings.append( + "allowed_in_global_search", {"document_type": "Purchase Order"} + ) + + global_search_settings.save(ignore_permissions=True) From 727b2f9b97bc6f267c58aa29e297f7d744ab9436 Mon Sep 17 00:00:00 2001 From: Afshan <33727827+AfshanKhan@users.noreply.github.com> Date: Tue, 8 Dec 2020 09:45:19 +0530 Subject: [PATCH 11/12] fix: throw an error when no pos profile exist (#24025) * fix: throw an error when no pos profile exist * fix: throw an error when no pos profile exist * fix: test cases * fix: tests * fix: test * fix: space as indent * fix: travis --- .../doctype/bank_transaction/test_bank_transaction.py | 5 +++++ erpnext/accounts/doctype/pos_profile/test_pos_profile.py | 1 + erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 2 ++ .../accounts/doctype/sales_invoice/test_sales_invoice.py | 6 ++++-- .../healthcare/doctype/fee_validity/test_fee_validity.py | 2 ++ .../doctype/patient_appointment/test_patient_appointment.py | 2 ++ .../patient_medical_record/test_patient_medical_record.py | 2 ++ 7 files changed, 18 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py index 27546335c9..e9fc5f0a1d 100644 --- a/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py +++ b/erpnext/accounts/doctype/bank_transaction/test_bank_transaction.py @@ -9,11 +9,13 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice from erpnext.accounts.doctype.payment_entry.test_payment_entry import get_payment_entry from erpnext.accounts.page.bank_reconciliation.bank_reconciliation import reconcile, get_linked_payments +from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile test_dependencies = ["Item", "Cost Center"] class TestBankTransaction(unittest.TestCase): def setUp(self): + make_pos_profile() add_transactions() add_payments() @@ -27,6 +29,9 @@ class TestBankTransaction(unittest.TestCase): frappe.db.sql("""delete from `tabPayment Entry Reference`""") frappe.db.sql("""delete from `tabPayment Entry`""") + # Delete POS Profile + frappe.db.sql("delete from `tabPOS Profile`") + frappe.flags.test_bank_transactions_created = False frappe.flags.test_payments_created = False diff --git a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py index edf86590c8..62dc1fcb20 100644 --- a/erpnext/accounts/doctype/pos_profile/test_pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/test_pos_profile.py @@ -70,6 +70,7 @@ def get_items_list(pos_profile, company): """.format(cond=cond), tuple([company] + args_list), as_dict=1) def make_pos_profile(**args): + frappe.db.sql("delete from `tabPOS Payment Method`") frappe.db.sql("delete from `tabPOS Profile`") args = frappe._dict(args) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 0b16763110..81f425f868 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -405,6 +405,8 @@ class SalesInvoice(SellingController): from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile if not self.pos_profile: pos_profile = get_pos_profile(self.company) or {} + if not pos_profile: + frappe.throw(_("No POS Profile found. Please create a New POS Profile first")) self.pos_profile = pos_profile.get('name') pos = {} diff --git a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py index 9660c9570e..46e954d948 100644 --- a/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/test_sales_invoice.py @@ -690,7 +690,8 @@ class TestSalesInvoice(unittest.TestCase): self.assertTrue(gle) def test_pos_gl_entry_with_perpetual_inventory(self): - make_pos_profile() + make_pos_profile(company="_Test Company with perpetual inventory", income_account = "Sales - TCP1", + expense_account = "Cost of Goods Sold - TCP1", warehouse="Stores - TCP1", cost_center = "Main - TCP1", write_off_account="_Test Write Off - TCP1") pr = make_purchase_receipt(company= "_Test Company with perpetual inventory", item_code= "_Test FG Item",warehouse= "Stores - TCP1",cost_center= "Main - TCP1") @@ -746,7 +747,8 @@ class TestSalesInvoice(unittest.TestCase): self.assertEqual(pos_return.get('payments')[0].amount, -1000) def test_pos_change_amount(self): - make_pos_profile() + make_pos_profile(company="_Test Company with perpetual inventory", income_account = "Sales - TCP1", + expense_account = "Cost of Goods Sold - TCP1", warehouse="Stores - TCP1", cost_center = "Main - TCP1", write_off_account="_Test Write Off - TCP1") pr = make_purchase_receipt(company= "_Test Company with perpetual inventory", item_code= "_Test FG Item",warehouse= "Stores - TCP1", cost_center= "Main - TCP1") diff --git a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py index cdf692e68b..7e7fd82411 100644 --- a/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py +++ b/erpnext/healthcare/doctype/fee_validity/test_fee_validity.py @@ -7,6 +7,7 @@ import frappe import unittest from frappe.utils import nowdate, add_days from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_healthcare_docs, create_appointment, create_healthcare_service_items +from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile test_dependencies = ["Company"] @@ -15,6 +16,7 @@ class TestFeeValidity(unittest.TestCase): frappe.db.sql("""delete from `tabPatient Appointment`""") frappe.db.sql("""delete from `tabFee Validity`""") frappe.db.sql("""delete from `tabPatient`""") + make_pos_profile() def test_fee_validity(self): item = create_healthcare_service_items() diff --git a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py index eeed157291..3df7ba1531 100644 --- a/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py +++ b/erpnext/healthcare/doctype/patient_appointment/test_patient_appointment.py @@ -7,12 +7,14 @@ import frappe from erpnext.healthcare.doctype.patient_appointment.patient_appointment import update_status, make_encounter from frappe.utils import nowdate, add_days from frappe.utils.make_random import get_random +from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile class TestPatientAppointment(unittest.TestCase): def setUp(self): frappe.db.sql("""delete from `tabPatient Appointment`""") frappe.db.sql("""delete from `tabFee Validity`""") frappe.db.sql("""delete from `tabPatient Encounter`""") + make_pos_profile() def test_status(self): patient, medical_department, practitioner = create_healthcare_docs() diff --git a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py index aa85a23113..419d956425 100644 --- a/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py +++ b/erpnext/healthcare/doctype/patient_medical_record/test_patient_medical_record.py @@ -6,11 +6,13 @@ import unittest import frappe from frappe.utils import nowdate from erpnext.healthcare.doctype.patient_appointment.test_patient_appointment import create_encounter, create_healthcare_docs, create_appointment +from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile class TestPatientMedicalRecord(unittest.TestCase): def setUp(self): frappe.db.set_value('Healthcare Settings', None, 'enable_free_follow_ups', 0) frappe.db.set_value('Healthcare Settings', None, 'automate_appointment_invoicing', 1) + make_pos_profile() def test_medical_record(self): patient, medical_department, practitioner = create_healthcare_docs() From 59dffb96b3b21288854fbecfa2b5fff4ea623ca5 Mon Sep 17 00:00:00 2001 From: Mohammad Hasnain Date: Tue, 8 Dec 2020 11:13:00 +0530 Subject: [PATCH 12/12] fix(Production Planning): incorrect required qty --- .../production_planning_report/production_planning_report.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/manufacturing/report/production_planning_report/production_planning_report.py b/erpnext/manufacturing/report/production_planning_report/production_planning_report.py index ebc01c65af..806d268ffd 100644 --- a/erpnext/manufacturing/report/production_planning_report/production_planning_report.py +++ b/erpnext/manufacturing/report/production_planning_report/production_planning_report.py @@ -124,7 +124,7 @@ class ProductionPlanReport(object): if self.filters.include_subassembly_raw_materials else "(bom_item.qty / bom.quantity)") raw_materials = frappe.db.sql(""" SELECT bom_item.parent, bom_item.item_code, - bom_item.item_name as raw_material_name, {0} as required_qty + bom_item.item_name as raw_material_name, {0} as required_qty_per_unit FROM `tabBOM` as bom, `tab{1}` as bom_item WHERE @@ -208,7 +208,7 @@ class ProductionPlanReport(object): warehouses = self.mrp_warehouses or [] for d in self.raw_materials_dict.get(key): if self.filters.based_on != "Work Order": - d.required_qty = d.required_qty * data.qty_to_manufacture + d.required_qty = d.required_qty_per_unit * data.qty_to_manufacture if not warehouses: warehouses = [data.warehouse]