mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 06:28:29 +00:00
Merge branch 'version-12-hotfix' into employee-relieving-fix
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
frappe.listview_settings['Payment Entry'] = {
|
frappe.listview_settings['Payment Entry'] = {
|
||||||
|
|
||||||
onload: function(listview) {
|
onload: function(listview) {
|
||||||
listview.page.fields_dict.party_type.get_query = function() {
|
if (listview.page.fields_dict.party_type) {
|
||||||
return {
|
listview.page.fields_dict.party_type.get_query = function() {
|
||||||
"filters": {
|
return {
|
||||||
"name": ["in", Object.keys(frappe.boot.party_account_types)],
|
"filters": {
|
||||||
}
|
"name": ["in", Object.keys(frappe.boot.party_account_types)],
|
||||||
|
}
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -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,37 +51,39 @@ 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"));
|
return {
|
||||||
} else {
|
filters: {
|
||||||
return{
|
"company": me.frm.doc.company,
|
||||||
filters: {
|
"is_group": 0,
|
||||||
"company": me.frm.doc.company,
|
"account_type": frappe.boot.party_account_types[me.frm.doc.party_type]
|
||||||
"is_group": 0,
|
}
|
||||||
"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"));
|
return {
|
||||||
} else {
|
filters:[
|
||||||
return{
|
['Account', 'company', '=', me.frm.doc.company],
|
||||||
filters:[
|
['Account', 'is_group', '=', 0],
|
||||||
['Account', 'company', '=', me.frm.doc.company],
|
['Account', 'account_type', 'in', ['Bank', 'Cash']]
|
||||||
['Account', 'is_group', '=', 0],
|
]
|
||||||
['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() {
|
||||||
@@ -90,7 +97,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
|||||||
|
|
||||||
party: function() {
|
party: function() {
|
||||||
var me = this
|
var me = this
|
||||||
if(!me.frm.doc.receivable_payable_account && me.frm.doc.party_type && me.frm.doc.party) {
|
if (!me.frm.doc.receivable_payable_account && me.frm.doc.party_type && me.frm.doc.party) {
|
||||||
return frappe.call({
|
return frappe.call({
|
||||||
method: "erpnext.accounts.party.get_party_account",
|
method: "erpnext.accounts.party.get_party_account",
|
||||||
args: {
|
args: {
|
||||||
@@ -99,7 +106,7 @@ erpnext.accounts.PaymentReconciliationController = frappe.ui.form.Controller.ext
|
|||||||
party: me.frm.doc.party
|
party: me.frm.doc.party
|
||||||
},
|
},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(!r.exc && r.message) {
|
if (!r.exc && r.message) {
|
||||||
me.frm.set_value("receivable_payable_account", r.message);
|
me.frm.set_value("receivable_payable_account", r.message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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:
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user