From fd19678bc7d2e3ae428fb5179dee042da3040245 Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Thu, 6 Jun 2019 18:37:10 +0530 Subject: [PATCH 01/11] fix: show cost center in print fromat of report trial balance --- erpnext/accounts/report/financial_statements.html | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/accounts/report/financial_statements.html b/erpnext/accounts/report/financial_statements.html index cb853fd1dc..1087c28b81 100644 --- a/erpnext/accounts/report/financial_statements.html +++ b/erpnext/accounts/report/financial_statements.html @@ -23,6 +23,7 @@ {% } %}

{%= __(report.report_name) %}

{%= filters.company %}

+

{%= filters.cost_center %}

{%= filters.fiscal_year %}

{%= __("Currency") %} : {%= filters.presentation_currency || erpnext.get_currency(filters.company) %}
{% if (filters.from_date) { %} From 9a792c2eedb3c3bc545328c4d82058f4fbda1e55 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Wed, 15 May 2019 12:42:37 +0530 Subject: [PATCH 02/11] stock_entry: set COGS for material issue only --- .../stock/doctype/stock_entry/stock_entry.py | 34 +++++++++---------- erpnext/stock/get_item_details.py | 10 ++++-- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index 9de639402f..96c856651a 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -676,35 +676,36 @@ class StockEntry(StockController): ret = frappe._dict({ 'uom' : item.stock_uom, - 'stock_uom' : item.stock_uom, + 'stock_uom' : item.stock_uom, 'description' : item.description, - 'image' : item.image, + 'image' : item.image, 'item_name' : item.item_name, - 'expense_account' : args.get("expense_account"), - 'cost_center' : get_default_cost_center(args, item, item_group_defaults, brand_defaults), - 'qty' : args.get("qty"), + 'cost_center' : get_default_cost_center(args, item, item_group_defaults, brand_defaults, self.company), + 'qty' : args.get("qty"), 'transfer_qty' : args.get('qty'), 'conversion_factor' : 1, - 'batch_no' : '', + 'batch_no' : '', 'actual_qty' : 0, 'basic_rate' : 0, - 'serial_no' : '', + 'serial_no' : '', 'has_serial_no' : item.has_serial_no, 'has_batch_no' : item.has_batch_no, 'sample_quantity' : item.sample_quantity }) - for d in [["Account", "expense_account", "default_expense_account"], - ["Cost Center", "cost_center", "cost_center"]]: - company = frappe.db.get_value(d[0], ret.get(d[1]), "company") - if not ret[d[1]] or (company and self.company != company): - ret[d[1]] = frappe.get_cached_value('Company', self.company, d[2]) if d[2] else None # update uom if args.get("uom") and for_update: ret.update(get_uom_details(args.get('item_code'), args.get('uom'), args.get('qty'))) - if not ret["expense_account"]: - ret["expense_account"] = frappe.get_cached_value('Company', self.company, "stock_adjustment_account") + if self.purpose == 'Material Issue': + ret["expense_account"] = (item.get("expense_account") or + item_group_defaults.get("expense_account") or + frappe.get_cached_value('Company', self.company, "default_expense_account")) + + for company_field, field in {'stock_adjustment_account': 'expense_account', + 'cost_center': 'cost_center'}.items(): + if not ret.get(field): + ret[field] = frappe.get_cached_value('Company', self.company, company_field) args['posting_date'] = self.posting_date args['posting_time'] = self.posting_time @@ -1084,8 +1085,7 @@ class StockEntry(StockController): return item_dict def add_to_stock_entry_detail(self, item_dict, bom_no=None): - expense_account, cost_center = frappe.db.get_values("Company", self.company, \ - ["default_expense_account", "cost_center"])[0] + cost_center = frappe.db.get_value("Company", self.company, 'cost_center') for d in item_dict: stock_uom = item_dict[d].get("stock_uom") or frappe.db.get_value("Item", d, "stock_uom") @@ -1099,7 +1099,7 @@ class StockEntry(StockController): se_child.uom = item_dict[d]["uom"] if item_dict[d].get("uom") else stock_uom se_child.stock_uom = stock_uom se_child.qty = flt(item_dict[d]["qty"], se_child.precision("qty")) - se_child.expense_account = item_dict[d].get("expense_account") or expense_account + se_child.expense_account = item_dict[d].get("expense_account") se_child.cost_center = item_dict[d].get("cost_center") or cost_center se_child.allow_alternative_item = item_dict[d].get("allow_alternative_item", 0) se_child.subcontracted_item = item_dict[d].get("main_item_code") diff --git a/erpnext/stock/get_item_details.py b/erpnext/stock/get_item_details.py index f694af8481..59fd9231d5 100644 --- a/erpnext/stock/get_item_details.py +++ b/erpnext/stock/get_item_details.py @@ -414,7 +414,7 @@ def get_default_deferred_account(args, item, fieldname=None): else: return None -def get_default_cost_center(args, item, item_group, brand): +def get_default_cost_center(args, item, item_group, brand, company=None): cost_center = None if args.get('project'): cost_center = frappe.db.get_value("Project", args.get("project"), "cost_center", cache=True) @@ -425,7 +425,13 @@ def get_default_cost_center(args, item, item_group, brand): else: cost_center = item.get('buying_cost_center') or item_group.get('buying_cost_center') or brand.get('buying_cost_center') - return cost_center or args.get("cost_center") + cost_center = cost_center or args.get("cost_center") + + if (company and cost_center + and frappe.get_cached_value("Cost Center", cost_center, "company") != company): + return None + + return cost_center def get_default_supplier(args, item, item_group, brand): return (item.get("default_supplier") From 9510e69910a14a829e676011b5fdcf7b5f96d7ae Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 10 Jun 2019 10:53:25 +0530 Subject: [PATCH 03/11] fix (lms): null cards visible on xs --- erpnext/www/lms/macros/card.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/www/lms/macros/card.html b/erpnext/www/lms/macros/card.html index 9964d2df34..076061d41b 100644 --- a/erpnext/www/lms/macros/card.html +++ b/erpnext/www/lms/macros/card.html @@ -28,7 +28,7 @@ {% macro null_card() %}
-
+
{% endmacro %} \ No newline at end of file From b9102bba48ee879c795da5d982814c63a3c0dc00 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 10 Jun 2019 17:39:23 +0530 Subject: [PATCH 04/11] fix: GSTR-1 Report fixes (#17885) --- erpnext/regional/report/gstr_1/gstr_1.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/erpnext/regional/report/gstr_1/gstr_1.py b/erpnext/regional/report/gstr_1/gstr_1.py index 5aa2441ee6..a6de94a9da 100644 --- a/erpnext/regional/report/gstr_1/gstr_1.py +++ b/erpnext/regional/report/gstr_1/gstr_1.py @@ -60,8 +60,11 @@ class Gstr1Report(object): else: for inv, items_based_on_rate in self.items_based_on_tax_rate.items(): invoice_details = self.invoices.get(inv) - for rate, items in items_based_on_rate.items(): - row, taxable_value = self.get_row_data_for_invoice(inv, invoice_details, rate, items) + for key, items in items_based_on_rate.items(): + rate = key[0] + account = key[1] + + row, taxable_value = self.get_row_data_for_invoice(inv, invoice_details, rate, account, items) if self.filters.get("type_of_business") == "CDNR": row.append("Y" if invoice_details.posting_date <= date(2017, 7, 1) else "N") @@ -100,7 +103,7 @@ class Gstr1Report(object): for key, value in iteritems(b2cs_output): self.data.append(value) - def get_row_data_for_invoice(self, invoice, invoice_details, tax_rate, items): + def get_row_data_for_invoice(self, invoice, invoice_details, tax_rate, account, items): row = [] for fieldname in self.invoice_fields: if self.filters.get("type_of_business") == "CDNR" and fieldname == "invoice_value": @@ -117,8 +120,10 @@ class Gstr1Report(object): taxable_value = 0 for item_code, net_amount in self.invoice_items.get(invoice).items(): if item_code in items: - if self.item_tax_rate.get(invoice) and tax_rate == self.item_tax_rate.get(invoice, {}).get(item_code): - taxable_value += abs(net_amount) + if self.item_tax_rate.get(invoice) and self.item_tax_rate.get(invoice, {}).get(item_code): + item_tax_rate = self.item_tax_rate.get(invoice, {}).get(item_code) + if account in item_tax_rate and tax_rate == item_tax_rate.get(account): + taxable_value += abs(net_amount) elif not self.item_tax_rate.get(invoice): taxable_value += abs(net_amount) @@ -207,8 +212,7 @@ class Gstr1Report(object): item_tax_rate = json.loads(d.item_tax_rate) if item_tax_rate: - for account, rate in item_tax_rate.items(): - self.item_tax_rate.setdefault(d.parent, {}).setdefault(d.item_code, rate) + self.item_tax_rate.setdefault(d.parent, {}).setdefault(d.item_code, item_tax_rate) def get_items_based_on_tax_rate(self): self.tax_details = frappe.db.sql(""" @@ -248,7 +252,7 @@ class Gstr1Report(object): tax_rate *= 2 rate_based_dict = self.items_based_on_tax_rate\ - .setdefault(parent, {}).setdefault(tax_rate, []) + .setdefault(parent, {}).setdefault((tax_rate, account), []) if item_code not in rate_based_dict: rate_based_dict.append(item_code) except ValueError: From 3720126ee9e6153adc39528391926a1926ba065c Mon Sep 17 00:00:00 2001 From: sahil28297 <37302950+sahil28297@users.noreply.github.com> Date: Mon, 10 Jun 2019 17:39:42 +0530 Subject: [PATCH 05/11] fix(patch): escape illegal characters to avoid SQL syntax error (#17890) --- erpnext/patches/v11_0/update_total_qty_field.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v11_0/update_total_qty_field.py b/erpnext/patches/v11_0/update_total_qty_field.py index 992454ac7c..51358e9545 100644 --- a/erpnext/patches/v11_0/update_total_qty_field.py +++ b/erpnext/patches/v11_0/update_total_qty_field.py @@ -40,7 +40,7 @@ def execute(): # This is probably never used anywhere else as of now, but should be values = [] for d in batch_transactions: - values.append("('{}', {})".format(d.parent, d.qty)) + values.append("('{}', {})".format(frappe.db.escape(d.parent), d.qty)) conditions = ",".join(values) frappe.db.sql(""" INSERT INTO `tab{}` (name, total_qty) VALUES {} From ebeafa55ca8ac4636159f3c2669ce8ef724068e6 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 10 Jun 2019 17:42:52 +0530 Subject: [PATCH 06/11] fix: Total Amount fix in journal entry (#17880) --- erpnext/accounts/doctype/journal_entry/journal_entry.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/doctype/journal_entry/journal_entry.py b/erpnext/accounts/doctype/journal_entry/journal_entry.py index 26fbc23b4c..d082b60211 100644 --- a/erpnext/accounts/doctype/journal_entry/journal_entry.py +++ b/erpnext/accounts/doctype/journal_entry/journal_entry.py @@ -458,8 +458,9 @@ class JournalEntry(AccountsController): pay_to_recd_from = frappe.db.get_value(d.party_type, d.party, "customer_name" if d.party_type=="Customer" else "supplier_name") - party_amount += (d.debit_in_account_currency or d.credit_in_account_currency) - party_account_currency = d.account_currency + if pay_to_recd_from and pay_to_recd_from == d.party: + party_amount += (d.debit_in_account_currency or d.credit_in_account_currency) + party_account_currency = d.account_currency elif frappe.db.get_value("Account", d.account, "account_type") in ["Bank", "Cash"]: bank_amount += (d.debit_in_account_currency or d.credit_in_account_currency) From 5f41a3333bd6c6b0c64e8711edfa74b9ff038e76 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 10 Jun 2019 17:21:34 +0530 Subject: [PATCH 07/11] fix: accounts receivable for PDC not showing 120 days column --- .../accounts_receivable.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html index d7aa0c0d19..192b6d7be3 100644 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.html +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.html @@ -46,6 +46,8 @@ var range2 = report.columns[12].label; var range3 = report.columns[13].label; var range4 = report.columns[14].label; + var range5 = report.columns[15].label; + var range6 = report.columns[16].label; %} {% if(balance_row) { %} @@ -56,8 +58,10 @@ - - + + + + @@ -67,16 +71,20 @@ + + - + + + @@ -86,6 +94,8 @@ + + @@ -95,6 +105,8 @@ + + From ef5dd879281975c7f9a7f5ceb31a03283d9503d4 Mon Sep 17 00:00:00 2001 From: Rohit Waghchaure Date: Mon, 10 Jun 2019 18:31:41 +0530 Subject: [PATCH 08/11] fix: debit and credit showing in the same row if the group by is set as group by voucher (consolidated) --- erpnext/accounts/report/general_ledger/general_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/accounts/report/general_ledger/general_ledger.py b/erpnext/accounts/report/general_ledger/general_ledger.py index 492df4bbb6..307b72d4e8 100644 --- a/erpnext/accounts/report/general_ledger/general_ledger.py +++ b/erpnext/accounts/report/general_ledger/general_ledger.py @@ -128,7 +128,7 @@ def get_gl_entries(filters): order_by_statement = "order by posting_date, voucher_type, voucher_no" if filters.get("group_by") == _("Group by Voucher (Consolidated)"): - group_by_statement = "group by voucher_type, voucher_no, account, cost_center" + group_by_statement = "group by voucher_type, voucher_no, account, cost_center, against_voucher" select_fields = """, sum(debit) as debit, sum(credit) as credit, sum(debit_in_account_currency) as debit_in_account_currency, sum(credit_in_account_currency) as credit_in_account_currency""" From acae7a903b5fcf4309c6da07bda63cbcd14260db Mon Sep 17 00:00:00 2001 From: Anurag Mishra Date: Tue, 11 Jun 2019 11:12:28 +0530 Subject: [PATCH 09/11] fix: requested changes --- erpnext/accounts/report/financial_statements.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/financial_statements.html b/erpnext/accounts/report/financial_statements.html index 1087c28b81..4081723bf0 100644 --- a/erpnext/accounts/report/financial_statements.html +++ b/erpnext/accounts/report/financial_statements.html @@ -23,7 +23,9 @@ {% } %}

{%= __(report.report_name) %}

{%= filters.company %}

-

{%= filters.cost_center %}

+{% if 'cost_center' in filters %} +

{%= filters.cost_center %}

+{% endif %}

{%= filters.fiscal_year %}

{%= __("Currency") %} : {%= filters.presentation_currency || erpnext.get_currency(filters.company) %}
{% if (filters.from_date) { %} From 44ac3580d9e696dcd3d5037180248bbc135b0645 Mon Sep 17 00:00:00 2001 From: deepeshgarg007 Date: Tue, 11 Jun 2019 18:35:01 +0530 Subject: [PATCH 10/11] fix: Fix breaking patch on develop branch --- erpnext/patches/v11_0/update_total_qty_field.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/patches/v11_0/update_total_qty_field.py b/erpnext/patches/v11_0/update_total_qty_field.py index 51358e9545..9407256acf 100644 --- a/erpnext/patches/v11_0/update_total_qty_field.py +++ b/erpnext/patches/v11_0/update_total_qty_field.py @@ -40,7 +40,7 @@ def execute(): # This is probably never used anywhere else as of now, but should be values = [] for d in batch_transactions: - values.append("('{}', {})".format(frappe.db.escape(d.parent), d.qty)) + values.append("({0}, {1})".format(frappe.db.escape(d.parent), d.qty)) conditions = ",".join(values) frappe.db.sql(""" INSERT INTO `tab{}` (name, total_qty) VALUES {} From add002bb0f3983fca70877a5249cf50154583f3e Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira <33246109+kennethsequeira@users.noreply.github.com> Date: Wed, 12 Jun 2019 12:25:48 +0530 Subject: [PATCH 11/11] fix: Make Travel Request Document Submittable (#17874) * make travel request submittable * add patch * remove patch --- erpnext/hr/doctype/travel_request/travel_request.json | 10 ++++++++++ erpnext/patches.txt | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/erpnext/hr/doctype/travel_request/travel_request.json b/erpnext/hr/doctype/travel_request/travel_request.json index 31dfe96734..c1c6524af3 100644 --- a/erpnext/hr/doctype/travel_request/travel_request.json +++ b/erpnext/hr/doctype/travel_request/travel_request.json @@ -192,6 +192,15 @@ "fieldtype": "Text", "label": "Other Details" }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Travel Request", + "print_hide": 1, + "read_only": 1 + }, { "collapsible": 1, "fieldname": "accounting_dimensions_section", @@ -203,6 +212,7 @@ "fieldtype": "Column Break" } ], + "is_submittable": 1, "modified": "2019-05-25 23:15:00.609186", "modified_by": "Administrator", "module": "HR", diff --git a/erpnext/patches.txt b/erpnext/patches.txt index 56c51b102c..15fd82ea72 100644 --- a/erpnext/patches.txt +++ b/erpnext/patches.txt @@ -604,4 +604,4 @@ execute:frappe.delete_doc("Report", "Inactive Items") erpnext.patches.v11_1.delete_scheduling_tool erpnext.patches.v12_0.make_custom_fields_for_bank_remittance execute:frappe.delete_doc_if_exists("Page", "support-analytics") -erpnext.patches.v12_0.make_item_manufacturer +erpnext.patches.v12_0.make_item_manufacturer \ No newline at end of file
{%= __(range2) %} {%= __(range3) %} {%= __(range4) %}{%= __(range5) %}{%= __(range6) %} {%= __("Total") %}
{%= __("Total Outstanding") %}{%= format_currency(balance_row[range1]) %}{%= format_number(balance_row[range1], null, 2) %} {%= format_currency(balance_row[range2]) %} {%= format_currency(balance_row[range3]) %} {%= format_currency(balance_row[range4]) %}{%= format_currency(balance_row[range5]) %}{%= format_currency(balance_row[range6]) %} {%= format_currency(flt(balance_row[("outstanding_amount")]), data[data.length-1]["currency"]) %} {%= format_currency(flt(balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %} {%= format_currency(flt(balance_row[("outstanding_amount")]-balance_row[("pdc/lc_amount")]), data[data.length-1]["currency"]) %}