From 824f48fd2336f5dc6ab36cb26d29e50140eca3ed Mon Sep 17 00:00:00 2001 From: marination Date: Mon, 12 Oct 2020 20:08:03 +0530 Subject: [PATCH 01/11] fix: Item Link Formatter Behaviour --- erpnext/public/js/utils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js index 6d73418821f..ea2093eee10 100755 --- a/erpnext/public/js/utils.js +++ b/erpnext/public/js/utils.js @@ -703,9 +703,13 @@ erpnext.utils.map_current_doc = function(opts) { } frappe.form.link_formatters['Item'] = function(value, doc) { - if(doc && doc.item_name && doc.item_name !== value) { - return value? value + ': ' + doc.item_name: doc.item_name; + if (doc && value && doc.item_name && doc.item_name !== value) { + return value + ': ' + doc.item_name; + } else if (!value && doc.doctype && doc.item_name) { + // format blank value in child table + return doc.item_name; } else { + // if value is blank in report view or item code and name are the same, return as is return value; } } From 56d305b966b77ada7caa47ad78abdad2a356daa6 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 13 Oct 2020 00:07:52 +0530 Subject: [PATCH 02/11] fix: update italy fiscal year --- erpnext/public/js/setup_wizard.js | 1 - 1 file changed, 1 deletion(-) diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js index 9beba6adf8d..5d21190e378 100644 --- a/erpnext/public/js/setup_wizard.js +++ b/erpnext/public/js/setup_wizard.js @@ -309,7 +309,6 @@ erpnext.setup.fiscal_years = { "Hong Kong": ["04-01", "03-31"], "India": ["04-01", "03-31"], "Iran": ["06-23", "06-22"], - "Italy": ["07-01", "06-30"], "Myanmar": ["04-01", "03-31"], "New Zealand": ["04-01", "03-31"], "Pakistan": ["07-01", "06-30"], From 968f61d8bac65373d7659642e547e013a180f4b4 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 13 Oct 2020 00:25:46 +0530 Subject: [PATCH 03/11] fix: add multiple VAT rates for Italy --- .../setup_wizard/data/country_wise_tax.json | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json index 19318df38e0..00fcaa87447 100644 --- a/erpnext/setup/setup_wizard/data/country_wise_tax.json +++ b/erpnext/setup/setup_wizard/data/country_wise_tax.json @@ -648,10 +648,19 @@ }, "Italy": { - "Italy Tax": { - "account_name": "VAT", - "tax_rate": 22.00 - } + "Italy VAT 22%": { + "account_name": "IVA 22%", + "tax_rate": 22.00, + "default": 1 + }, + "Italy VAT 10%":{ + "account_name": "IVA 10%", + "tax_rate": 10.00, + }, + "Italy VAT 4%":{ + "account_name": "IVA 4%", + "tax_rate": 4.00, + } }, "Ivory Coast": { From 617892db20de608b567afd825755762a6867e4e2 Mon Sep 17 00:00:00 2001 From: aakvatech <35020381+aakvatech@users.noreply.github.com> Date: Tue, 13 Oct 2020 08:18:59 +0300 Subject: [PATCH 04/11] feat: Add company and correct filter in bank statement reconciliation report filters If you have multi company scenario and many bank accounts that are no longer active, then it becomes difficult in bank statement reconciliation report to filter the account to reconcile and it also shows disabled accounts so futher confusion is created. https://github.com/frappe/erpnext/issues/23613 --- .../bank_reconciliation_statement.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js index 57fe4b05be4..8f028496cd5 100644 --- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js +++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js @@ -3,6 +3,14 @@ frappe.query_reports["Bank Reconciliation Statement"] = { "filters": [ + { + "fieldname":"company", + "label": __("Company"), + "fieldtype": "Link", + "options": "Company", + "reqd": 1, + "default": frappe.defaults.get_user_default("Company") + }, { "fieldname":"account", "label": __("Bank Account"), @@ -12,11 +20,14 @@ frappe.query_reports["Bank Reconciliation Statement"] = { locals[":Company"][frappe.defaults.get_user_default("Company")]["default_bank_account"]: "", "reqd": 1, "get_query": function() { + var company = frappe.query_report.get_filter_value('company') return { "query": "erpnext.controllers.queries.get_account_list", "filters": [ ['Account', 'account_type', 'in', 'Bank, Cash'], ['Account', 'is_group', '=', 0], + ['Account', 'disabled', '=', 0], + ['Account', 'company', '=', company], ] } } @@ -34,4 +45,4 @@ frappe.query_reports["Bank Reconciliation Statement"] = { "fieldtype": "Check" }, ] -} \ No newline at end of file +} From 3245eaaeb0fc39067a5162215c2bd25a670dd2a7 Mon Sep 17 00:00:00 2001 From: Anupam Date: Tue, 13 Oct 2020 15:35:10 +0530 Subject: [PATCH 05/11] fix: displayings mandatory address field in Lead form --- erpnext/crm/doctype/lead/lead.json | 10 +++++++--- erpnext/crm/doctype/lead/lead.py | 14 +++----------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json index f5f8b4efb34..2df1793fdbe 100644 --- a/erpnext/crm/doctype/lead/lead.json +++ b/erpnext/crm/doctype/lead/lead.json @@ -241,6 +241,7 @@ }, { "depends_on": "eval: doc.__islocal", + "description": "Home, Work, etc.", "fieldname": "address_title", "fieldtype": "Data", "label": "Address Title" @@ -249,7 +250,8 @@ "depends_on": "eval: doc.__islocal", "fieldname": "address_line1", "fieldtype": "Data", - "label": "Address Line 1" + "label": "Address Line 1", + "mandatory_depends_on": "eval: doc.address_title && doc.address_type" }, { "depends_on": "eval: doc.__islocal", @@ -261,7 +263,8 @@ "depends_on": "eval: doc.__islocal", "fieldname": "city", "fieldtype": "Data", - "label": "City/Town" + "label": "City/Town", + "mandatory_depends_on": "eval: doc.address_title && doc.address_type" }, { "depends_on": "eval: doc.__islocal", @@ -280,6 +283,7 @@ "fieldname": "country", "fieldtype": "Link", "label": "Country", + "mandatory_depends_on": "eval: doc.address_title && doc.address_type", "options": "Country" }, { @@ -449,7 +453,7 @@ "idx": 5, "image_field": "image", "links": [], - "modified": "2020-06-18 14:39:41.835416", + "modified": "2020-10-13 15:24:00.094811", "modified_by": "Administrator", "module": "CRM", "name": "Lead", diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 99fa703feec..282f30e9cd5 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -22,7 +22,8 @@ class Lead(SellingController): load_address_and_contact(self) def before_insert(self): - self.address_doc = self.create_address() + if self.address_type and self.address_title and self.address_line1 and self.city and self.country: + self.address_doc = self.create_address() self.contact_doc = self.create_contact() def after_insert(self): @@ -133,15 +134,6 @@ class Lead(SellingController): # skipping country since the system auto-sets it from system defaults address = frappe.new_doc("Address") - mandatory_fields = [ df.fieldname for df in address.meta.fields if df.reqd ] - - if not all([self.get(field) for field in mandatory_fields]): - frappe.msgprint(_('Missing mandatory fields in address. \ - {0} to create address' ).format(" Click here "), - alert=True, indicator='yellow') - return - address.update({addr_field: self.get(addr_field) for addr_field in address_fields}) address.update({info_field: self.get(info_field) for info_field in info_fields}) address.insert() @@ -190,7 +182,7 @@ class Lead(SellingController): def update_links(self): # update address links - if self.address_doc: + if hasattr(self, 'address_doc'): self.address_doc.append("links", { "link_doctype": "Lead", "link_name": self.name, From 9aa3e7a37d4e89725a2f28738c078059862d3ee5 Mon Sep 17 00:00:00 2001 From: barredterra <14891507+barredterra@users.noreply.github.com> Date: Tue, 13 Oct 2020 13:35:33 +0200 Subject: [PATCH 06/11] feat: address template for luxembourg --- erpnext/regional/address_template/templates/luxembourg.html | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 erpnext/regional/address_template/templates/luxembourg.html diff --git a/erpnext/regional/address_template/templates/luxembourg.html b/erpnext/regional/address_template/templates/luxembourg.html new file mode 100644 index 00000000000..75075e7f1a4 --- /dev/null +++ b/erpnext/regional/address_template/templates/luxembourg.html @@ -0,0 +1,4 @@ +{% if address_line1 %}{{ address_line1 }}
{% endif -%} +{% if address_line2 %}{{ address_line2 }}
{% endif -%} +{% if pincode %}L-{{ pincode }}{% endif -%}{% if city %} {{ city }}{% endif %}
+{% if country %}{{ country | upper }}{% endif %} From 7db38058f3b568c7bf4b2e4c3d1cbfeb7b5f09f1 Mon Sep 17 00:00:00 2001 From: Anupam Date: Tue, 13 Oct 2020 17:33:58 +0530 Subject: [PATCH 07/11] fix: displayings mandatory address field in Lead form --- erpnext/crm/doctype/lead/lead.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/crm/doctype/lead/lead.py b/erpnext/crm/doctype/lead/lead.py index 282f30e9cd5..1439adb015b 100644 --- a/erpnext/crm/doctype/lead/lead.py +++ b/erpnext/crm/doctype/lead/lead.py @@ -22,7 +22,7 @@ class Lead(SellingController): load_address_and_contact(self) def before_insert(self): - if self.address_type and self.address_title and self.address_line1 and self.city and self.country: + if self.address_title and self.address_type: self.address_doc = self.create_address() self.contact_doc = self.create_contact() From c359d3528f073eaddc246bc4e1ce54cca393cf93 Mon Sep 17 00:00:00 2001 From: Afshan Date: Tue, 13 Oct 2020 18:54:54 +0530 Subject: [PATCH 08/11] fix: setting user precision instead of default --- erpnext/projects/report/billing_summary.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/erpnext/projects/report/billing_summary.py b/erpnext/projects/report/billing_summary.py index b808268d1b8..0b44e9d112c 100644 --- a/erpnext/projects/report/billing_summary.py +++ b/erpnext/projects/report/billing_summary.py @@ -6,6 +6,7 @@ from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import time_diff_in_hours, flt +from frappe.model.meta import get_field_precision def get_columns(): return [ @@ -136,6 +137,7 @@ def get_timesheet_details(filters, timesheet_list): return timesheet_details_map def get_billable_and_total_duration(activity, start_time, end_time): + precision = frappe.get_precision("Timesheet Detail", "hours") activity_duration = time_diff_in_hours(end_time, start_time) billing_duration = 0.0 if activity.billable: @@ -143,4 +145,4 @@ def get_billable_and_total_duration(activity, start_time, end_time): if activity_duration != activity.billing_hours: billing_duration = activity_duration * activity.billing_hours / activity.hours - return flt(activity_duration, 2), flt(billing_duration, 2) \ No newline at end of file + return flt(activity_duration, precision), flt(billing_duration, precision) \ No newline at end of file From 1b329aaa7b08a906cb97dba697fc84a352c4cb82 Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 13 Oct 2020 19:10:09 +0530 Subject: [PATCH 09/11] fix: json format fixes --- erpnext/setup/setup_wizard/data/country_wise_tax.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json index 00fcaa87447..2e45b6927ea 100644 --- a/erpnext/setup/setup_wizard/data/country_wise_tax.json +++ b/erpnext/setup/setup_wizard/data/country_wise_tax.json @@ -655,11 +655,11 @@ }, "Italy VAT 10%":{ "account_name": "IVA 10%", - "tax_rate": 10.00, + "tax_rate": 10.00 }, "Italy VAT 4%":{ "account_name": "IVA 4%", - "tax_rate": 4.00, + "tax_rate": 4.00 } }, From 3eec4e61ab8255be6426ed9ce807c3f22896461c Mon Sep 17 00:00:00 2001 From: Kenneth Sequeira Date: Tue, 13 Oct 2020 19:23:48 +0530 Subject: [PATCH 10/11] fix: GST rates for Australia --- erpnext/setup/setup_wizard/data/country_wise_tax.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json index 2e45b6927ea..beddaeed793 100644 --- a/erpnext/setup/setup_wizard/data/country_wise_tax.json +++ b/erpnext/setup/setup_wizard/data/country_wise_tax.json @@ -60,14 +60,10 @@ }, "Australia": { - "Australia GST1": { + "Australia GST": { "account_name": "GST 10%", "tax_rate": 10.00, "default": 1 - }, - "Australia GST 2%": { - "account_name": "GST 2%", - "tax_rate": 2 } }, From 93da52941e54f15b05959d84e06f2e10c1c30c6b Mon Sep 17 00:00:00 2001 From: Sun Howwrongbum Date: Tue, 13 Oct 2020 21:23:26 +0530 Subject: [PATCH 11/11] fix: consider rounded_total in returns (#23609) Co-authored-by: Marica --- erpnext/accounts/doctype/sales_invoice/sales_invoice.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 206340b9a6a..801e688deb9 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -572,7 +572,8 @@ class SalesInvoice(SellingController): def validate_pos(self): if self.is_return: - if flt(self.paid_amount) + flt(self.write_off_amount) - flt(self.grand_total) > \ + invoice_total = self.rounded_total or self.grand_total + if flt(self.paid_amount) + flt(self.write_off_amount) - flt(invoice_total) > \ 1.0/(10.0**(self.precision("grand_total") + 1.0)): frappe.throw(_("Paid amount + Write Off Amount can not be greater than Grand Total"))