From ab46f0f5bb8096b3cc5b805d8ada0f3751a3f926 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 10 Jul 2019 18:49:41 +0530 Subject: [PATCH 01/13] fix: Add module map for breadcrumbs --- erpnext/public/js/conf.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js index ec71df33515..622e1abd62a 100644 --- a/erpnext/public/js/conf.js +++ b/erpnext/public/js/conf.js @@ -52,3 +52,11 @@ $.extend(frappe.breadcrumbs.preferred, { "Sales Partner": "Selling", "Brand": "Selling" }); + +$.extend(frappe.breadcrumbs.module_map, { + 'ERPNext Integrations': 'Integrations', + 'Geo': 'Settings', + 'Accounts': 'Accounting', + 'Portal': 'Website', + 'Utilities': 'Settings' +}) From a7a6987c4213079428e68f9aedd9e9117ddcb768 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 10 Jul 2019 19:22:16 +0530 Subject: [PATCH 02/13] fix: Add Shopping Cart and Contacts --- erpnext/public/js/conf.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js index 622e1abd62a..dfee2b5578b 100644 --- a/erpnext/public/js/conf.js +++ b/erpnext/public/js/conf.js @@ -58,5 +58,7 @@ $.extend(frappe.breadcrumbs.module_map, { 'Geo': 'Settings', 'Accounts': 'Accounting', 'Portal': 'Website', - 'Utilities': 'Settings' + 'Utilities': 'Settings', + 'Shopping Cart': 'Website', + 'Contacts': 'CRM' }) From 7837fbe231e2c442f21f0c6bcaac26a4800c4f34 Mon Sep 17 00:00:00 2001 From: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> Date: Wed, 10 Jul 2019 19:39:40 +0530 Subject: [PATCH 03/13] style: Add missing semicolon --- erpnext/public/js/conf.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/public/js/conf.js b/erpnext/public/js/conf.js index dfee2b5578b..095e744926b 100644 --- a/erpnext/public/js/conf.js +++ b/erpnext/public/js/conf.js @@ -61,4 +61,4 @@ $.extend(frappe.breadcrumbs.module_map, { 'Utilities': 'Settings', 'Shopping Cart': 'Website', 'Contacts': 'CRM' -}) +}); From 870cbad5b2d1eca579806ca16227a6cff7a1fe48 Mon Sep 17 00:00:00 2001 From: Jignesh Greycube Date: Thu, 11 Jul 2019 13:56:43 +0530 Subject: [PATCH 04/13] fix: navigation link updated for Item Shortage Report Item Shortage Report navigation link was incorrect , hence updated. --- erpnext/config/stock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/config/stock.py b/erpnext/config/stock.py index 84aa8474d38..f5e48b3b144 100644 --- a/erpnext/config/stock.py +++ b/erpnext/config/stock.py @@ -281,9 +281,9 @@ def get_data(): }, { "type": "report", + "is_query_report": True, "name": "Item Shortage Report", - "route": "#Report/Bin/Item Shortage Report", - "doctype": "Purchase Receipt" + "doctype": "Bin" }, { "type": "report", From 6bbb726769bba3cca3f211fdba3e1b2c0d5a0c09 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 11 Jul 2019 18:04:41 +0530 Subject: [PATCH 05/13] fix: Remove unused imports --- .../doctype/quickbooks_migrator/quickbooks_migrator.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py index 29a1a2b0bb8..d201a9e7b8a 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py @@ -7,7 +7,7 @@ import frappe from frappe import _ from frappe.model.document import Document from requests_oauthlib import OAuth2Session -import json, requests +import json, requests, traceback from erpnext import encode_company_abbr # QuickBooks requires a redirect URL, User will be redirect to this URL @@ -32,7 +32,6 @@ def callback(*args, **kwargs): class QuickBooksMigrator(Document): def __init__(self, *args, **kwargs): super(QuickBooksMigrator, self).__init__(*args, **kwargs) - from pprint import pprint self.oauth = OAuth2Session( client_id=self.client_id, redirect_uri=self.redirect_url, @@ -1252,8 +1251,6 @@ class QuickBooksMigrator(Document): def _log_error(self, execption, data=""): - import json, traceback - traceback.print_exc() frappe.log_error(title="QuickBooks Migration Error", message="\n".join([ "Data", From dfeb6bef8c778e7ee75764063469f0a32f5197fd Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 11 Jul 2019 18:08:46 +0530 Subject: [PATCH 06/13] style: Remove whitespace before : --- .../quickbooks_migrator/quickbooks_migrator.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py index d201a9e7b8a..9f3e50c26db 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py @@ -497,12 +497,12 @@ class QuickBooksMigrator(Document): erpcustomer = frappe.get_doc({ "doctype": "Customer", "quickbooks_id": customer["Id"], - "customer_name" : encode_company_abbr(customer["DisplayName"], self.company), - "customer_type" : "Individual", - "customer_group" : "Commercial", + "customer_name": encode_company_abbr(customer["DisplayName"], self.company), + "customer_type": "Individual", + "customer_group": "Commercial", "default_currency": customer["CurrencyRef"]["value"], "accounts": [{"company": self.company, "account": receivable_account}], - "territory" : "All Territories", + "territory": "All Territories", "company": self.company, }).insert() if "BillAddr" in customer: @@ -520,7 +520,7 @@ class QuickBooksMigrator(Document): item_dict = { "doctype": "Item", "quickbooks_id": item["Id"], - "item_code" : encode_company_abbr(item["Name"], self.company), + "item_code": encode_company_abbr(item["Name"], self.company), "stock_uom": "Unit", "is_stock_item": 0, "item_group": "All Item Groups", @@ -548,8 +548,8 @@ class QuickBooksMigrator(Document): erpsupplier = frappe.get_doc({ "doctype": "Supplier", "quickbooks_id": vendor["Id"], - "supplier_name" : encode_company_abbr(vendor["DisplayName"], self.company), - "supplier_group" : "All Supplier Groups", + "supplier_name": encode_company_abbr(vendor["DisplayName"], self.company), + "supplier_group": "All Supplier Groups", "company": self.company, }).insert() if "BillAddr" in vendor: @@ -1199,7 +1199,7 @@ class QuickBooksMigrator(Document): def _create_address(self, entity, doctype, address, address_type): - try : + try: if not frappe.db.exists({"doctype": "Address", "quickbooks_id": address["Id"]}): frappe.get_doc({ "doctype": "Address", From 9f40ffcd1e066b23d738a2e2781e5673ce302c0e Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 11 Jul 2019 18:10:05 +0530 Subject: [PATCH 07/13] style: Insert whitespace after , --- .../doctype/quickbooks_migrator/quickbooks_migrator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py index 9f3e50c26db..b33621f4069 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py @@ -217,7 +217,7 @@ class QuickBooksMigrator(Document): def _fetch_general_ledger(self): try: - query_uri = "{}/company/{}/reports/GeneralLedger".format(self.api_endpoint ,self.quickbooks_company_id) + query_uri = "{}/company/{}/reports/GeneralLedger".format(self.api_endpoint, self.quickbooks_company_id) response = self._get(query_uri, params={ "columns": ",".join(["tx_date", "txn_type", "credit_amt", "debt_amt"]), @@ -555,7 +555,7 @@ class QuickBooksMigrator(Document): if "BillAddr" in vendor: self._create_address(erpsupplier, "Supplier", vendor["BillAddr"], "Billing") if "ShipAddr" in vendor: - self._create_address(erpsupplier, "Supplier",vendor["ShipAddr"], "Shipping") + self._create_address(erpsupplier, "Supplier", vendor["ShipAddr"], "Shipping") except Exception as e: self._log_error(e) From 2f6cd1999a0b886a2ddd85df9621f2d5601ebfab Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 11 Jul 2019 18:16:23 +0530 Subject: [PATCH 08/13] style: One import per line --- .../doctype/quickbooks_migrator/quickbooks_migrator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py index b33621f4069..16cf2e1db8f 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py @@ -7,7 +7,9 @@ import frappe from frappe import _ from frappe.model.document import Document from requests_oauthlib import OAuth2Session -import json, requests, traceback +import json +import requests +import traceback from erpnext import encode_company_abbr # QuickBooks requires a redirect URL, User will be redirect to this URL From 7352227a24de7d326e538f1b406f91e7e11645b1 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 11 Jul 2019 18:16:42 +0530 Subject: [PATCH 09/13] fix: Remove unused local variable --- .../doctype/quickbooks_migrator/quickbooks_migrator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py index 16cf2e1db8f..86c26fbab4b 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py @@ -494,7 +494,7 @@ class QuickBooksMigrator(Document): "account_currency": customer["CurrencyRef"]["value"], "company": self.company, })[0]["name"] - except Exception as e: + except Exception: receivable_account = None erpcustomer = frappe.get_doc({ "doctype": "Customer", From d4c10801d12812d2611c5ac121086ff1d57af845 Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 11 Jul 2019 18:17:01 +0530 Subject: [PATCH 10/13] style: Remove multiple whitespace after : --- .../doctype/quickbooks_migrator/quickbooks_migrator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py index 86c26fbab4b..85fe4f23031 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py @@ -830,7 +830,7 @@ class QuickBooksMigrator(Document): "currency": invoice["CurrencyRef"]["value"], "conversion_rate": invoice.get("ExchangeRate", 1), "posting_date": invoice["TxnDate"], - "due_date": invoice.get("DueDate", invoice["TxnDate"]), + "due_date": invoice.get("DueDate", invoice["TxnDate"]), "credit_to": credit_to_account, "supplier": frappe.get_all("Supplier", filters={ From f8c92f30bf1a1db415dd76004d75db7d404088eb Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Thu, 11 Jul 2019 18:27:19 +0530 Subject: [PATCH 11/13] feat(purchase-order): Add tax category field in purchase order --- .../doctype/purchase_order/purchase_order.json | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/erpnext/buying/doctype/purchase_order/purchase_order.json b/erpnext/buying/doctype/purchase_order/purchase_order.json index dead1f030c5..5dce3497829 100644 --- a/erpnext/buying/doctype/purchase_order/purchase_order.json +++ b/erpnext/buying/doctype/purchase_order/purchase_order.json @@ -66,10 +66,11 @@ "net_total", "total_net_weight", "taxes_section", - "taxes_and_charges", + "tax_category", "column_break_50", "shipping_rule", "section_break_52", + "taxes_and_charges", "taxes", "sec_tax_breakup", "other_charges_calculation", @@ -569,7 +570,7 @@ { "fieldname": "taxes_and_charges", "fieldtype": "Link", - "label": "Taxes and Charges", + "label": "Purchase Taxes and Charges Template", "oldfieldname": "purchase_other_charges", "oldfieldtype": "Link", "options": "Purchase Taxes and Charges Template", @@ -1032,12 +1033,18 @@ "fieldname": "update_auto_repeat_reference", "fieldtype": "Button", "label": "Update Auto Repeat Reference" + }, + { + "fieldname": "tax_category", + "fieldtype": "Link", + "label": "Tax Category", + "options": "Tax Category" } ], "icon": "fa fa-file-text", "idx": 105, "is_submittable": 1, - "modified": "2019-06-24 21:22:05.483429", + "modified": "2019-07-11 18:25:49.509343", "modified_by": "Administrator", "module": "Buying", "name": "Purchase Order", From f04b19aa2e8c50920b26b412fc61d8b579879fdb Mon Sep 17 00:00:00 2001 From: Aditya Hase Date: Thu, 11 Jul 2019 18:29:24 +0530 Subject: [PATCH 12/13] fix: Company might not have any warehouses when on_update hook for QBM is being executed This used to throw while renaming a Company that is either used with QuickBooks Migrator or is set as a Default Company in Global Defaults. --- .../doctype/quickbooks_migrator/quickbooks_migrator.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py index 85fe4f23031..96a533ee10c 100644 --- a/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py +++ b/erpnext/erpnext_integrations/doctype/quickbooks_migrator/quickbooks_migrator.py @@ -47,7 +47,9 @@ class QuickBooksMigrator(Document): if self.company: # We need a Cost Center corresponding to the selected erpnext Company self.default_cost_center = frappe.db.get_value('Company', self.company, 'cost_center') - self.default_warehouse = frappe.get_all('Warehouse', filters={"company": self.company, "is_group": 0})[0]["name"] + company_warehouses = frappe.get_all('Warehouse', filters={"company": self.company, "is_group": 0}) + if company_warehouses: + self.default_warehouse = company_warehouses[0].name if self.authorization_endpoint: self.authorization_url = self.oauth.authorization_url(self.authorization_endpoint)[0] From 53e7df078ec5fe5265c5ae28ae01a59e2151157c Mon Sep 17 00:00:00 2001 From: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Date: Fri, 12 Jul 2019 12:05:39 +0530 Subject: [PATCH 13/13] fix: set project link in item tables (#18233) --- .../doctype/material_request/material_request.py | 2 +- .../stock_entry_detail/stock_entry_detail.json | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/erpnext/stock/doctype/material_request/material_request.py b/erpnext/stock/doctype/material_request/material_request.py index 2b079e7995f..f2fe44879db 100644 --- a/erpnext/stock/doctype/material_request/material_request.py +++ b/erpnext/stock/doctype/material_request/material_request.py @@ -450,7 +450,7 @@ def make_stock_entry(source_name, target_doc=None): "field_map": { "name": "material_request_item", "parent": "material_request", - "uom": "stock_uom", + "uom": "stock_uom" }, "postprocess": update_item, "condition": lambda doc: doc.ordered_qty < doc.stock_qty diff --git a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json index 59337004579..912a4651b3c 100644 --- a/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json +++ b/erpnext/stock/doctype/stock_entry_detail/stock_entry_detail.json @@ -61,7 +61,8 @@ "ste_detail", "column_break_51", "transferred_qty", - "reference_purchase_receipt" + "reference_purchase_receipt", + "project" ], "fields": [ { @@ -472,11 +473,18 @@ "label": "Reference Purchase Receipt", "options": "Purchase Receipt", "read_only": 1 + }, + { + "fieldname": "project", + "fieldtype": "Link", + "label": "Project", + "options": "Project", + "read_only": 1 } ], "idx": 1, "istable": 1, - "modified": "2019-06-14 11:58:41.958144", + "modified": "2019-07-12 11:34:53.190749", "modified_by": "Administrator", "module": "Stock", "name": "Stock Entry Detail",