Merge branch 'develop' into enrollment-fixes
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
index 206340b..801e688 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py
@@ -572,7 +572,8 @@
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"))
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 57fe4b0..8f02849 100644
--- a/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
+++ b/erpnext/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
@@ -4,6 +4,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"),
"fieldtype": "Link",
@@ -12,11 +20,14 @@
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 @@
"fieldtype": "Check"
},
]
-}
\ No newline at end of file
+}
diff --git a/erpnext/crm/doctype/lead/lead.json b/erpnext/crm/doctype/lead/lead.json
index f5f8b4e..2df1793 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 99fa703..1439adb 100644
--- a/erpnext/crm/doctype/lead/lead.py
+++ b/erpnext/crm/doctype/lead/lead.py
@@ -22,7 +22,8 @@
load_address_and_contact(self)
def before_insert(self):
- self.address_doc = self.create_address()
+ if self.address_title and self.address_type:
+ self.address_doc = self.create_address()
self.contact_doc = self.create_contact()
def after_insert(self):
@@ -133,15 +134,6 @@
# 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("<a href='desk#Form/Address/New Address 1' \
- > Click here </a>"),
- 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 @@
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,
diff --git a/erpnext/projects/report/billing_summary.py b/erpnext/projects/report/billing_summary.py
index b808268..0b44e9d 100644
--- a/erpnext/projects/report/billing_summary.py
+++ b/erpnext/projects/report/billing_summary.py
@@ -6,6 +6,7 @@
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 @@
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 @@
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
diff --git a/erpnext/public/js/setup_wizard.js b/erpnext/public/js/setup_wizard.js
index 9beba6a..5d21190 100644
--- a/erpnext/public/js/setup_wizard.js
+++ b/erpnext/public/js/setup_wizard.js
@@ -309,7 +309,6 @@
"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"],
diff --git a/erpnext/public/js/utils.js b/erpnext/public/js/utils.js
index 6d73418..ea2093e 100755
--- a/erpnext/public/js/utils.js
+++ b/erpnext/public/js/utils.js
@@ -703,9 +703,13 @@
}
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;
}
}
diff --git a/erpnext/regional/address_template/templates/luxembourg.html b/erpnext/regional/address_template/templates/luxembourg.html
new file mode 100644
index 0000000..75075e7
--- /dev/null
+++ b/erpnext/regional/address_template/templates/luxembourg.html
@@ -0,0 +1,4 @@
+{% if address_line1 %}{{ address_line1 }}<br>{% endif -%}
+{% if address_line2 %}{{ address_line2 }}<br>{% endif -%}
+{% if pincode %}L-{{ pincode }}{% endif -%}{% if city %} {{ city }}{% endif %}<br>
+{% if country %}{{ country | upper }}{% endif %}
diff --git a/erpnext/setup/setup_wizard/data/country_wise_tax.json b/erpnext/setup/setup_wizard/data/country_wise_tax.json
index 19318df..beddaee 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
}
},
@@ -648,10 +644,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": {