From bc64f5dfbbf497ba20de47bcfcc6cb84d38bfb18 Mon Sep 17 00:00:00 2001 From: UrvashiKishnani <41088003+UrvashiKishnani@users.noreply.github.com> Date: Mon, 9 Nov 2020 18:44:06 +0400 Subject: [PATCH 1/8] fix: spelling error in filter label (#23867) --- erpnext/public/js/salary_slip_deductions_report_filters.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/salary_slip_deductions_report_filters.js b/erpnext/public/js/salary_slip_deductions_report_filters.js index 2b30e650753..1ca36600c3b 100644 --- a/erpnext/public/js/salary_slip_deductions_report_filters.js +++ b/erpnext/public/js/salary_slip_deductions_report_filters.js @@ -45,7 +45,7 @@ erpnext.salary_slip_deductions_report_filters = { }, { fieldname: "branch", - label: __("Barnch"), + label: __("Branch"), fieldtype: "Link", options: "Branch", } @@ -63,4 +63,4 @@ erpnext.salary_slip_deductions_report_filters = { } }); } -} \ No newline at end of file +} From 8cfb210dc4ced9153a352896b726debf7b476159 Mon Sep 17 00:00:00 2001 From: Deepesh Garg <42651287+deepeshgarg007@users.noreply.github.com> Date: Mon, 9 Nov 2020 20:14:53 +0530 Subject: [PATCH 2/8] fix: Ignore doctypes on company transaction deleted (#23864) --- erpnext/setup/doctype/company/delete_company_transactions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/company/delete_company_transactions.py b/erpnext/setup/doctype/company/delete_company_transactions.py index c94831ef937..566f20cfa12 100644 --- a/erpnext/setup/doctype/company/delete_company_transactions.py +++ b/erpnext/setup/doctype/company/delete_company_transactions.py @@ -27,7 +27,8 @@ def delete_company_transactions(company_name): if doctype not in ("Account", "Cost Center", "Warehouse", "Budget", "Party Account", "Employee", "Sales Taxes and Charges Template", "Purchase Taxes and Charges Template", "POS Profile", "BOM", - "Company", "Bank Account"): + "Company", "Bank Account", "Item Tax Template", "Mode Of Payment", + "Item Default"): delete_for_doctype(doctype, company_name) # reset company values From f38a1c305eb184ea5b00a727760fdac2dca83e8d Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 9 Nov 2020 20:16:28 +0530 Subject: [PATCH 3/8] refactor: show form buttons only if permissions exist (#23851) * refactor: show form buttons only if permissions exist * style: add semicolon * fix: typo in conditions --- erpnext/setup/doctype/company/company.js | 48 +++++++++++++++--------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/erpnext/setup/doctype/company/company.js b/erpnext/setup/doctype/company/company.js index f882db60c5d..cbf67b4cd6f 100644 --- a/erpnext/setup/doctype/company/company.js +++ b/erpnext/setup/doctype/company/company.js @@ -90,29 +90,41 @@ frappe.ui.form.on("Company", { frm.toggle_enable("default_currency", (frm.doc.__onload && !frm.doc.__onload.transactions_exist)); - frm.add_custom_button(__('Create Tax Template'), function() { - frm.trigger("make_default_tax_template"); - }); + if (frm.has_perm('write')) { + frm.add_custom_button(__('Create Tax Template'), function() { + frm.trigger("make_default_tax_template"); + }); + } - frm.add_custom_button(__('Cost Centers'), function() { - frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name}) - }, __("View")); + if (frappe.perm.has_perm("Cost Center", 0, 'read')) { + frm.add_custom_button(__('Cost Centers'), function() { + frappe.set_route('Tree', 'Cost Center', {'company': frm.doc.name}); + }, __("View")); + } - frm.add_custom_button(__('Chart of Accounts'), function() { - frappe.set_route('Tree', 'Account', {'company': frm.doc.name}) - }, __("View")); + if (frappe.perm.has_perm("Account", 0, 'read')) { + frm.add_custom_button(__('Chart of Accounts'), function() { + frappe.set_route('Tree', 'Account', {'company': frm.doc.name}); + }, __("View")); + } - frm.add_custom_button(__('Sales Tax Template'), function() { - frappe.set_route('List', 'Sales Taxes and Charges Template', {'company': frm.doc.name}); - }, __("View")); + if (frappe.perm.has_perm("Sales Taxes and Charges Template", 0, 'read')) { + frm.add_custom_button(__('Sales Tax Template'), function() { + frappe.set_route('List', 'Sales Taxes and Charges Template', {'company': frm.doc.name}); + }, __("View")); + } - frm.add_custom_button(__('Purchase Tax Template'), function() { - frappe.set_route('List', 'Purchase Taxes and Charges Template', {'company': frm.doc.name}); - }, __("View")); + if (frappe.perm.has_perm("Purchase Taxes and Charges Template", 0, 'read')) { + frm.add_custom_button(__('Purchase Tax Template'), function() { + frappe.set_route('List', 'Purchase Taxes and Charges Template', {'company': frm.doc.name}); + }, __("View")); + } - frm.add_custom_button(__('Default Tax Template'), function() { - frm.trigger("make_default_tax_template"); - }, __('Create')); + if (frm.has_perm('write')) { + frm.add_custom_button(__('Default Tax Template'), function() { + frm.trigger("make_default_tax_template"); + }, __('Create')); + } } erpnext.company.set_chart_of_accounts_options(frm.doc); From 4f880e74547348b9e918779b8c7310cefcae8bec Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Mon, 9 Nov 2020 15:47:56 +0100 Subject: [PATCH 4/8] refactor: zip_and_download (#23844) --- .../regional/germany/utils/datev/datev_csv.py | 16 +++++++++------- erpnext/regional/report/datev/datev.py | 8 +++++--- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/erpnext/regional/germany/utils/datev/datev_csv.py b/erpnext/regional/germany/utils/datev/datev_csv.py index fb7ca71e798..cf07a1c824f 100644 --- a/erpnext/regional/germany/utils/datev/datev_csv.py +++ b/erpnext/regional/germany/utils/datev/datev_csv.py @@ -155,20 +155,22 @@ def get_header(filters, csv_class): return header -def download_csv_files_as_zip(csv_data_list): +def zip_and_download(zip_filename, csv_files): """ Put CSV files in a zip archive and send that to the client. Params: - csv_data_list -- list of dicts [{'file_name': 'EXTF_Buchunsstapel.zip', 'csv_data': get_datev_csv()}] + zip_filename Name of the zip file + csv_files list of dicts [{'file_name': 'my_file.csv', 'csv_data': 'comma,separated,values'}] """ zip_buffer = BytesIO() - datev_zip = zipfile.ZipFile(zip_buffer, mode='w', compression=zipfile.ZIP_DEFLATED) - for csv_file in csv_data_list: - datev_zip.writestr(csv_file.get('file_name'), csv_file.get('csv_data')) - datev_zip.close() + zip_file = zipfile.ZipFile(zip_buffer, mode='w', compression=zipfile.ZIP_DEFLATED) + for csv_file in csv_files: + zip_file.writestr(csv_file.get('file_name'), csv_file.get('csv_data')) + + zip_file.close() frappe.response['filecontent'] = zip_buffer.getvalue() - frappe.response['filename'] = 'DATEV.zip' + frappe.response['filename'] = zip_filename frappe.response['type'] = 'binary' diff --git a/erpnext/regional/report/datev/datev.py b/erpnext/regional/report/datev/datev.py index 738806321cb..dbae230f1ef 100644 --- a/erpnext/regional/report/datev/datev.py +++ b/erpnext/regional/report/datev/datev.py @@ -11,10 +11,11 @@ from __future__ import unicode_literals import json import frappe -from frappe import _ from six import string_types + +from frappe import _ from erpnext.accounts.utils import get_fiscal_year -from erpnext.regional.germany.utils.datev.datev_csv import download_csv_files_as_zip, get_datev_csv +from erpnext.regional.germany.utils.datev.datev_csv import zip_and_download, get_datev_csv from erpnext.regional.germany.utils.datev.datev_constants import Transactions, DebtorsCreditors, AccountNames COLUMNS = [ @@ -344,7 +345,8 @@ def download_datev_csv(filters): customers = get_customers(filters) suppliers = get_suppliers(filters) - download_csv_files_as_zip([ + zip_name = '{} DATEV.zip'.format(frappe.utils.datetime.date.today()) + zip_and_download(zip_name, [ { 'file_name': 'EXTF_Buchungsstapel.csv', 'csv_data': get_datev_csv(transactions, filters, csv_class=Transactions) From 91fdb7aa694f890896586f95821b3f318fc6b612 Mon Sep 17 00:00:00 2001 From: Anurag Mishra <32095923+Anurag810@users.noreply.github.com> Date: Mon, 9 Nov 2020 20:20:05 +0530 Subject: [PATCH 5/8] feat: added column cost_center to receivable reports (#23835) --- .../report/accounts_receivable/accounts_receivable.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py index 044fc1d3abd..51fc7ec49aa 100755 --- a/erpnext/accounts/report/accounts_receivable/accounts_receivable.py +++ b/erpnext/accounts/report/accounts_receivable/accounts_receivable.py @@ -160,6 +160,8 @@ class ReceivablePayableReport(object): else: # advance / unlinked payment or other adjustment row.paid -= gle_balance + if gle.cost_center: + row.cost_center = str(gle.cost_center) def update_sub_total_row(self, row, party): total_row = self.total_row_map.get(party) @@ -210,7 +212,6 @@ class ReceivablePayableReport(object): for key, row in self.voucher_balance.items(): row.outstanding = flt(row.invoiced - row.paid - row.credit_note, self.currency_precision) row.invoice_grand_total = row.invoiced - if abs(row.outstanding) > 1.0/10 ** self.currency_precision: # non-zero oustanding, we must consider this row @@ -577,7 +578,7 @@ class ReceivablePayableReport(object): self.gl_entries = frappe.db.sql(""" select - name, posting_date, account, party_type, party, voucher_type, voucher_no, + name, posting_date, account, party_type, party, voucher_type, voucher_no, cost_center, against_voucher_type, against_voucher, account_currency, remarks, {0} from `tabGL Entry` @@ -741,6 +742,7 @@ class ReceivablePayableReport(object): self.add_column(_("Customer Contact"), fieldname='customer_primary_contact', fieldtype='Link', options='Contact') + self.add_column(label=_('Cost Center'), fieldname='cost_center', fieldtype='Data') self.add_column(label=_('Voucher Type'), fieldname='voucher_type', fieldtype='Data') self.add_column(label=_('Voucher No'), fieldname='voucher_no', fieldtype='Dynamic Link', options='voucher_type', width=180) From 57ce0462d9a17b74c4aeb6e2d880e46e2ada6b5b Mon Sep 17 00:00:00 2001 From: Raffael Meyer <14891507+barredterra@users.noreply.github.com> Date: Mon, 9 Nov 2020 19:04:46 +0100 Subject: [PATCH 6/8] fix: remove check for exempt_from_sales_tax --- erpnext/regional/germany/accounts_controller.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/erpnext/regional/germany/accounts_controller.py b/erpnext/regional/germany/accounts_controller.py index 193c8e14a3d..5b2b31f2043 100644 --- a/erpnext/regional/germany/accounts_controller.py +++ b/erpnext/regional/germany/accounts_controller.py @@ -15,8 +15,7 @@ REQUIRED_FIELDS = { }, { "field_name": "taxes", - "regulation": "§ 14 Abs. 4 Nr. 8 UStG", - "condition": "not exempt_from_sales_tax" + "regulation": "§ 14 Abs. 4 Nr. 8 UStG" }, { "field_name": "customer_address", From 780b6b466b138bb758d7aef00ea58c2a476f8e55 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Wed, 11 Nov 2020 11:44:12 +0530 Subject: [PATCH 7/8] fix(hooks): include js/css with full path --- erpnext/hooks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/erpnext/hooks.py b/erpnext/hooks.py index dbb6c0d92ec..90ae6442e47 100644 --- a/erpnext/hooks.py +++ b/erpnext/hooks.py @@ -15,10 +15,10 @@ app_logo_url = '/assets/erpnext/images/erp-icon.svg' develop_version = '13.x.x-develop' -app_include_js = "assets/js/erpnext.min.js" -app_include_css = "assets/css/erpnext.css" -web_include_js = "assets/js/erpnext-web.min.js" -web_include_css = "assets/css/erpnext-web.css" +app_include_js = "/assets/js/erpnext.min.js" +app_include_css = "/assets/css/erpnext.css" +web_include_js = "/assets/js/erpnext-web.min.js" +web_include_css = "/assets/css/erpnext-web.css" doctype_js = { "Address": "public/js/address.js", From a91b68c8689073296815033d12a94063977de20b Mon Sep 17 00:00:00 2001 From: Mangesh-Khairnar Date: Wed, 11 Nov 2020 16:34:43 +0530 Subject: [PATCH 8/8] feat: add communication channel to communication medium (#23793) Co-authored-by: Saqib Co-authored-by: Suraj Shetty <13928957+surajshetty3416@users.noreply.github.com> --- .../communication_medium/communication_medium.json | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/erpnext/communication/doctype/communication_medium/communication_medium.json b/erpnext/communication/doctype/communication_medium/communication_medium.json index f009b388771..1e1fe3bf499 100644 --- a/erpnext/communication/doctype/communication_medium/communication_medium.json +++ b/erpnext/communication/doctype/communication_medium/communication_medium.json @@ -1,12 +1,14 @@ { + "actions": [], "autoname": "Prompt", "creation": "2019-06-05 11:48:30.572795", "doctype": "DocType", "engine": "InnoDB", "field_order": [ + "communication_channel", "communication_medium_type", - "catch_all", "column_break_3", + "catch_all", "provider", "disabled", "timeslots_section", @@ -54,9 +56,16 @@ "fieldtype": "Table", "label": "Timeslots", "options": "Communication Medium Timeslot" + }, + { + "fieldname": "communication_channel", + "fieldtype": "Select", + "label": "Communication Channel", + "options": "\nExotel" } ], - "modified": "2019-06-05 11:49:30.769006", + "links": [], + "modified": "2020-10-27 16:22:08.068542", "modified_by": "Administrator", "module": "Communication", "name": "Communication Medium",