Merge branch 'develop' into enrollment-fixes

This commit is contained in:
Rucha Mahabal 2020-10-13 23:24:42 +05:30 committed by GitHub
commit f625da2b8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 51 additions and 29 deletions

View File

@ -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"))

View File

@ -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],
]
}
}

View File

@ -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",

View File

@ -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_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 @@ 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("<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 @@ 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,

View File

@ -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)
return flt(activity_duration, precision), flt(billing_duration, precision)

View File

@ -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"],

View File

@ -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;
}
}

View File

@ -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 %}

View File

@ -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,9 +644,18 @@
},
"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
}
},