Merge branch 'version-12-hotfix' into employee-relieving-fix

This commit is contained in:
Marica
2020-11-17 15:15:08 +05:30
committed by GitHub
5 changed files with 52 additions and 35 deletions

View File

@@ -1,6 +1,7 @@
frappe.listview_settings['Payment Entry'] = { frappe.listview_settings['Payment Entry'] = {
onload: function(listview) { onload: function(listview) {
if (listview.page.fields_dict.party_type) {
listview.page.fields_dict.party_type.get_query = function() { listview.page.fields_dict.party_type.get_query = function() {
return { return {
"filters": { "filters": {
@@ -9,4 +10,5 @@ frappe.listview_settings['Payment Entry'] = {
}; };
}; };
} }
}
}; };

View File

@@ -37,6 +37,11 @@ frappe.ui.form.on("Payment Reconciliation Payment", {
erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.extend({ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.extend({
onload: function() { onload: function() {
var me = this; var me = this;
this.frm.set_query("party", function() {
check_mandatory(me.frm);
});
this.frm.set_query("party_type", function() { this.frm.set_query("party_type", function() {
return { return {
"filters": { "filters": {
@@ -46,9 +51,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
}); });
this.frm.set_query('receivable_payable_account', function() { this.frm.set_query('receivable_payable_account', function() {
if(!me.frm.doc.company || !me.frm.doc.party_type) { check_mandatory(me.frm);
frappe.msgprint(__("Please select Company and Party Type first"));
} else {
return { return {
filters: { filters: {
"company": me.frm.doc.company, "company": me.frm.doc.company,
@@ -56,14 +59,10 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
"account_type": frappe.boot.party_account_types[me.frm.doc.party_type] "account_type": frappe.boot.party_account_types[me.frm.doc.party_type]
} }
}; };
}
}); });
this.frm.set_query('bank_cash_account', function() { this.frm.set_query('bank_cash_account', function() {
if(!me.frm.doc.company) { check_mandatory(me.frm, true);
frappe.msgprint(__("Please select Company first"));
} else {
return { return {
filters:[ filters:[
['Account', 'company', '=', me.frm.doc.company], ['Account', 'company', '=', me.frm.doc.company],
@@ -71,12 +70,20 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
['Account', 'account_type', 'in', ['Bank', 'Cash']] ['Account', 'account_type', 'in', ['Bank', 'Cash']]
] ]
}; };
}
}); });
this.frm.set_value('party_type', ''); this.frm.set_value('party_type', '');
this.frm.set_value('party', ''); this.frm.set_value('party', '');
this.frm.set_value('receivable_payable_account', ''); this.frm.set_value('receivable_payable_account', '');
var check_mandatory = (frm, only_company=false) => {
var title = __("Mandatory");
if (only_company && !frm.doc.company) {
frappe.throw({message: __("Please Select a Company First"), title: title});
} else if (!frm.doc.company || !frm.doc.party_type) {
frappe.throw({message: __("Please Select Both Company and Party Type First"), title: title});
}
};
}, },
refresh: function() { refresh: function() {

View File

@@ -260,7 +260,11 @@ def check_amount_vs_description(amount_matching, description_matching):
continue continue
if "reference_no" in am_match and "reference_no" in des_match: if "reference_no" in am_match and "reference_no" in des_match:
if difflib.SequenceMatcher(lambda x: x == " ", am_match["reference_no"], des_match["reference_no"]).ratio() > 70: # Sequence Matcher does not handle None as input
am_reference = am_match["reference_no"] or ""
des_reference = des_match["reference_no"] or ""
if difflib.SequenceMatcher(lambda x: x == " ", am_reference, des_reference).ratio() > 70:
if am_match not in result: if am_match not in result:
result.append(am_match) result.append(am_match)
if result: if result:

View File

@@ -204,7 +204,7 @@ def set_account_and_due_date(party, account, party_type, company, posting_date,
return out return out
@frappe.whitelist() @frappe.whitelist()
def get_party_account(party_type, party, company): def get_party_account(party_type, party, company=None):
"""Returns the account for the given `party`. """Returns the account for the given `party`.
Will first search in party (Customer / Supplier) record, if not found, Will first search in party (Customer / Supplier) record, if not found,
will search in group (Customer Group / Supplier Group), will search in group (Customer Group / Supplier Group),

View File

@@ -665,9 +665,13 @@ erpnext.utils.map_current_doc = function(opts) {
} }
frappe.form.link_formatters['Item'] = function(value, doc) { frappe.form.link_formatters['Item'] = function(value, doc) {
if(doc && doc.item_name && doc.item_name !== value) { if (doc && value && doc.item_name && doc.item_name !== value) {
return value? value + ': ' + doc.item_name: doc.item_name; return value + ': ' + doc.item_name;
} else if (!value && doc.doctype && doc.item_name) {
// format blank value in child table
return doc.item_name;
} else { } else {
// if value is blank in report view or item code and name are the same, return as is
return value; return value;
} }
} }