From c349ae26b99dc8e97efc5e8cc8766f34dff25992 Mon Sep 17 00:00:00 2001 From: Suraj Shetty Date: Wed, 2 Jan 2019 09:31:11 +0530 Subject: [PATCH 01/13] Add patch to rename additional salary component - Should fix https://pastebin.com/xsNHPAh6 (happens when clicking links option in menu of Employee master) --- erpnext/patches.txt | 1 + ...me_additional_salary_component_additional_salary.py | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 erpnext/patches/v11_0/rename_additional_salary_component_additional_salary.py diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 9b8a69d2b2..be8201a07d 100755 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -580,3 +580,4 @@ erpnext.patches.v11_0.update_delivery_trip_status erpnext.patches.v10_0.repost_gle_for_purchase_receipts_with_rejected_items erpnext.patches.v11_0.set_missing_gst_hsn_code erpnext.patches.v11_0.rename_bom_wo_fields +erpnext.patches.v11_0.rename_additional_salary_component_additional_salary \ No newline at end of file diff --git a/erpnext/patches/v11_0/rename_additional_salary_component_additional_salary.py b/erpnext/patches/v11_0/rename_additional_salary_component_additional_salary.py new file mode 100644 index 0000000000..8fa876dd74 --- /dev/null +++ b/erpnext/patches/v11_0/rename_additional_salary_component_additional_salary.py @@ -0,0 +1,10 @@ +import frappe + +# this patch should have been included with this PR https://github.com/frappe/erpnext/pull/14302 + +def execute(): + if frappe.db.table_exists("Additional Salary Component"): + if not frappe.db.table_exists("Additional Salary"): + frappe.rename_doc("DocType", "Additional Salary Component", "Additional Salary") + + frappe.delete_doc('DocType', "Additional Salary Component") From 5865fcca3cf9096ee4099f0f6296a919593adc89 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Wed, 2 Jan 2019 14:36:07 +0530 Subject: [PATCH 02/13] fix: expense head of asset items in purchase invoice --- .../doctype/purchase_invoice/purchase_invoice.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py index bfdf451f44..d28dc936bb 100644 --- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py +++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py @@ -206,6 +206,10 @@ class PurchaseInvoice(BuyingController): stock_not_billed_account = self.get_company_default("stock_received_but_not_billed") stock_items = self.get_stock_items() + asset_items = [d.is_fixed_asset for d in self.items if d.is_fixed_asset] + if len(asset_items) > 0: + asset_received_but_not_billed = self.get_company_default("asset_received_but_not_billed") + if self.update_stock: self.validate_item_code() self.validate_warehouse() @@ -226,7 +230,8 @@ class PurchaseInvoice(BuyingController): item.expense_account = warehouse_account[item.warehouse]["account"] else: item.expense_account = stock_not_billed_account - + elif item.is_fixed_asset and d.pr_detail: + item.expense_account = asset_received_but_not_billed elif not item.expense_account and for_validate: throw(_("Expense account is mandatory for item {0}").format(item.item_code or item.item_name)) @@ -360,7 +365,10 @@ class PurchaseInvoice(BuyingController): def get_gl_entries(self, warehouse_account=None): self.auto_accounting_for_stock = erpnext.is_perpetual_inventory_enabled(self.company) - self.stock_received_but_not_billed = self.get_company_default("stock_received_but_not_billed") + if self.auto_accounting_for_stock: + self.stock_received_but_not_billed = self.get_company_default("stock_received_but_not_billed") + else: + self.stock_received_but_not_billed = None self.expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation") self.negative_expense_to_be_booked = 0.0 gl_entries = [] From 772e2c4e20330097dc271be1146e192f7520eff2 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Wed, 2 Jan 2019 15:59:58 +0530 Subject: [PATCH 03/13] test cases --- erpnext/assets/doctype/asset/test_asset.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index d855873d5a..c5a7c3d0c3 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -9,6 +9,7 @@ from frappe.utils import cstr, nowdate, getdate, flt, get_last_day, add_days, ad from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries, scrap_asset, restore_asset from erpnext.assets.doctype.asset.asset import make_sales_invoice, make_purchase_invoice from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_purchase_receipt +from erpnext.stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice as make_invoice class TestAsset(unittest.TestCase): def setUp(self): @@ -494,6 +495,15 @@ class TestAsset(unittest.TestCase): self.assertEqual(gle, expected_gle) + def test_expence_head(self): + pr = make_purchase_receipt(item_code="Macbook Pro", + qty=2, rate=200000.0, location="Test Location") + + doc = make_invoice(pr.name) + + self.assertEquals('Asset Received But Not Billed - _TC', doc.items[0].expense_account) + + def create_asset_data(): if not frappe.db.exists("Asset Category", "Computers"): create_asset_category() From 1ff1fc47251012753b4b72248e83e29a3bef9435 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 2 Jan 2019 17:56:08 +0530 Subject: [PATCH 04/13] [Fix] Negative amount showing in the bank clearance summary --- .../bank_clearance_summary.py | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py index 1ec0abc3bf..13424dbcb5 100644 --- a/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py +++ b/erpnext/accounts/report/bank_clearance_summary/bank_clearance_summary.py @@ -35,16 +35,22 @@ def get_conditions(filters): def get_entries(filters): conditions = get_conditions(filters) - journal_entries = frappe.db.sql("""select "Journal Entry", jv.name, jv.posting_date, - jv.cheque_no, jv.clearance_date, jvd.against_account, (jvd.debit - jvd.credit) - from `tabJournal Entry Account` jvd, `tabJournal Entry` jv - where jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s {0} - order by posting_date DESC, jv.name DESC""".format(conditions), filters, as_list=1) + journal_entries = frappe.db.sql("""SELECT + "Journal Entry", jv.name, jv.posting_date, jv.cheque_no, jv.clearance_date, jvd.against_account, + if((jvd.debit - jvd.credit) < 0, (jvd.debit - jvd.credit) * -1, (jvd.debit - jvd.credit)) + FROM + `tabJournal Entry Account` jvd, `tabJournal Entry` jv + WHERE + jvd.parent = jv.name and jv.docstatus=1 and jvd.account = %(account)s {0} + order by posting_date DESC, jv.name DESC""".format(conditions), filters, as_list=1) - payment_entries = frappe.db.sql("""select "Payment Entry", name, posting_date, - reference_no, clearance_date, party, if(paid_from=%(account)s, paid_amount, received_amount) - from `tabPayment Entry` - where docstatus=1 and (paid_from = %(account)s or paid_to = %(account)s) {0} - order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1) + payment_entries = frappe.db.sql("""SELECT + "Payment Entry", name, posting_date, reference_no, clearance_date, party, + if(paid_from=%(account)s, paid_amount, received_amount) + FROM + `tabPayment Entry` + WHERE + docstatus=1 and (paid_from = %(account)s or paid_to = %(account)s) {0} + order by posting_date DESC, name DESC""".format(conditions), filters, as_list=1) return sorted(journal_entries + payment_entries, key=lambda k: k[2] or getdate(nowdate())) \ No newline at end of file From add6bf35a323b978ccfa45cf980e937117f75734 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 4 Jan 2019 11:36:30 +0530 Subject: [PATCH 05/13] Fix: Employee Onboarding/Seperation task Assignment --- erpnext/hr/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index f35eb5919e..5058006431 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -54,10 +54,17 @@ class EmployeeBoardingController(Document): where parenttype='User' and role=%s''', activity.role) users = users + user_list + if "Administrator" in users: + users.remove("Administrator") + + # assign the task the users if users: + print(users) self.assign_task_to_users(task, set(users)) + users = [] + def assign_task_to_users(self, task, users): for user in users: args = { From bb6a7eb9d3b9e901c407b62ced4e1ff43973c43d Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Fri, 4 Jan 2019 12:32:51 +0530 Subject: [PATCH 06/13] refractor --- erpnext/hr/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index 5058006431..eb55037566 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -60,7 +60,6 @@ class EmployeeBoardingController(Document): # assign the task the users if users: - print(users) self.assign_task_to_users(task, set(users)) users = [] From 5efc7973ea5177e95e05084b510d42dd0549532d Mon Sep 17 00:00:00 2001 From: finbyz Date: Sat, 5 Jan 2019 11:12:11 +0530 Subject: [PATCH 07/13] Minor Fix for Rounded Total --- erpnext/controllers/accounts_controller.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 86ceb2e4ab..140694893c 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -604,13 +604,14 @@ class AccountsController(TransactionBase): advance.account_currency) if advance.account_currency == self.currency: - order_total = self.grand_total - formatted_order_total = fmt_money(order_total, precision=self.precision("grand_total"), - currency=advance.account_currency) + order_total = self.get("rounded_total") or self.grand_total + precision = "rounded_total" if self.get("rounded_total") else "grand_total" else: - order_total = self.base_grand_total - formatted_order_total = fmt_money(order_total, precision=self.precision("base_grand_total"), - currency=advance.account_currency) + order_total = self.get("base_rounded_total") or self.base_grand_total + precision = "base_rounded_total" if self.get("base_rounded_total") else "base_grand_total" + + formatted_order_total = fmt_money(order_total, precision=self.precision(precision), + currency=advance.account_currency) if self.currency == self.company_currency and advance_paid > order_total: frappe.throw(_("Total advance ({0}) against Order {1} cannot be greater than the Grand Total ({2})") From 23a1b9895791edb3956e42274521417c6805fd3a Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Mon, 7 Jan 2019 13:10:18 +0530 Subject: [PATCH 08/13] fix: remove unnecessary code --- erpnext/hr/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index eb55037566..2dc0ab0216 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -62,8 +62,6 @@ class EmployeeBoardingController(Document): if users: self.assign_task_to_users(task, set(users)) - users = [] - def assign_task_to_users(self, task, users): for user in users: args = { From 3c74266763f2c7b1e85404a306f81fd3a798f746 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Mon, 7 Jan 2019 13:13:16 +0530 Subject: [PATCH 09/13] fix: PEP8 recommended whitspace --- erpnext/hr/utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/hr/utils.py b/erpnext/hr/utils.py index 2dc0ab0216..02262012f1 100644 --- a/erpnext/hr/utils.py +++ b/erpnext/hr/utils.py @@ -57,7 +57,6 @@ class EmployeeBoardingController(Document): if "Administrator" in users: users.remove("Administrator") - # assign the task the users if users: self.assign_task_to_users(task, set(users)) From f733a390898e884bd08605aade8575d6a3047e11 Mon Sep 17 00:00:00 2001 From: Sagar Vora Date: Mon, 7 Jan 2019 14:24:01 +0530 Subject: [PATCH 10/13] fix: remove trailing whitespace --- erpnext/controllers/accounts_controller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index 140694893c..83ba438ad6 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -609,7 +609,7 @@ class AccountsController(TransactionBase): else: order_total = self.get("base_rounded_total") or self.base_grand_total precision = "base_rounded_total" if self.get("base_rounded_total") else "base_grand_total" - + formatted_order_total = fmt_money(order_total, precision=self.precision(precision), currency=advance.account_currency) From ffdadbf97f7c4db6d0c7dfd1457d892badd6b06e Mon Sep 17 00:00:00 2001 From: rohitwaghchaure Date: Tue, 8 Jan 2019 16:21:25 +0530 Subject: [PATCH 11/13] fix: fallback to stock uom if uom is not defined (#16329) * [minor] Code cleanup * fix: remove 'or' condition, won't execute --- erpnext/stock/get_item_details.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index 01ee9db1ca..692fe5d0fb 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -281,7 +281,7 @@ def get_basic_details(args, item): out.conversion_factor = 1.0 else: out.conversion_factor = args.conversion_factor or \ - get_conversion_factor(item.item_code, args.uom).get("conversion_factor") or 1.0 + get_conversion_factor(item.item_code, args.uom).get("conversion_factor") args.conversion_factor = out.conversion_factor out.stock_qty = out.qty * out.conversion_factor @@ -651,7 +651,7 @@ def get_conversion_factor(item_code, uom): if not conversion_factor: stock_uom = frappe.db.get_value("Item", item_code, "stock_uom") conversion_factor = get_uom_conv_factor(uom, stock_uom) - return {"conversion_factor": conversion_factor} + return {"conversion_factor": conversion_factor or 1.0} @frappe.whitelist() def get_projected_qty(item_code, warehouse): From 1836285c01bdf83022c5b4fde54733cf8c7782b0 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Tue, 8 Jan 2019 16:52:38 +0600 Subject: [PATCH 12/13] bumped to version 11.0.3-beta.34 --- erpnext/hooks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index 3ab6752d8c..bf7e32ab78 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -12,7 +12,7 @@ app_license = "GNU General Public License (v3)" source_link = "https://github.com/frappe/erpnext" develop_version = '12.x.x-develop' -staging_version = '11.0.3-beta.33' +staging_version = '11.0.3-beta.34' error_report_email = "support@erpnext.com" From 0f3ccba741ca1f0dfbd73f542402df83c8740f9c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 8 Jan 2019 20:23:01 +0530 Subject: [PATCH 13/13] Update test_asset.py --- erpnext/assets/doctype/asset/test_asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/assets/doctype/asset/test_asset.py b/erpnext/assets/doctype/asset/test_asset.py index c5a7c3d0c3..65629d2818 100644 --- a/erpnext/assets/doctype/asset/test_asset.py +++ b/erpnext/assets/doctype/asset/test_asset.py @@ -495,7 +495,7 @@ class TestAsset(unittest.TestCase): self.assertEqual(gle, expected_gle) - def test_expence_head(self): + def test_expense_head(self): pr = make_purchase_receipt(item_code="Macbook Pro", qty=2, rate=200000.0, location="Test Location")