Skip to content

Commit

Permalink
feat: auto reconcile in background
Browse files Browse the repository at this point in the history
  • Loading branch information
ruthra-kumar committed Mar 27, 2023
1 parent ca10e2b commit 17c270c
Show file tree
Hide file tree
Showing 20 changed files with 1,182 additions and 0 deletions.
Empty file.
64 changes: 64 additions & 0 deletions erpnext/accounts/doctype/auto_reconcile/auto_reconcile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt

frappe.ui.form.on("Auto Reconcile", {
onload: function(frm) {
// set queries
frm.set_query("party_type", function() {
return {
"filters": {
"name": ["in", Object.keys(frappe.boot.party_account_types)],
}
}
});
frm.set_query('receivable_payable_account', function(doc, cdt, cdn) {
return {
filters: {
"company": locals[cdt][cdn].company,
"is_group": 0,
"account_type": frappe.boot.party_account_types[locals[cdt][cdn].party_type]
}
};
});
frm.set_query('cost_center', function(doc, cdt, cdn) {
return {
filters: {
"company": locals[cdt][cdn].company,
"is_group": 0,
}
};
});
frm.set_query('bank_cash_account', function(doc, cdt, cdn) {
return {
filters:[
['Account', 'company', '=', locals[cdt][cdn].company],
['Account', 'is_group', '=', 0],
['Account', 'account_type', 'in', ['Bank', 'Cash']]
]
};
});
},
refresh: function(frm) {
if (frm.doc.docstatus==1 && ['Queued', 'Running'].find(x => x == frm.doc.status)) {
var execute_btn = __("Reconcile in Background")

frm.add_custom_button(execute_btn, () => {
frm.call({
method: 'erpnext.accounts.doctype.auto_reconcile.auto_reconcile.run_reconciliation_job',
});
});
}
if (frm.doc.docstatus==1 && ['Completed', 'Running', "Partially Reconciled"].find(x => x == frm.doc.status)) {
frm.call({
'method': "erpnext.accounts.doctype.auto_reconcile.auto_reconcile.get_progress",
args: {
"docname": frm.docname,
}
}).then(r => {
if (r) {
frm.dashboard.add_progress('Reconciliation Progress', r.message);
}
})
}
}
});
172 changes: 172 additions & 0 deletions erpnext/accounts/doctype/auto_reconcile/auto_reconcile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
{
"actions": [],
"autoname": "hash",
"beta": 1,
"creation": "2023-03-13 10:42:34.062670",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"status",
"section_break_gasn",
"company",
"party_type",
"column_break_io6c",
"party",
"receivable_payable_account",
"filter_section",
"from_invoice_date",
"to_invoice_date",
"column_break_kegk",
"from_payment_date",
"to_payment_date",
"column_break_uj04",
"cost_center",
"bank_cash_account",
"section_break_2n02",
"amended_from",
"error_log"
],
"fields": [
{
"allow_on_submit": 1,
"fieldname": "status",
"fieldtype": "Select",
"label": "Status",
"options": "Draft\nQueued\nRunning\nCompleted\nPartially Reconciled\nFailed",
"read_only": 1
},
{
"fieldname": "section_break_gasn",
"fieldtype": "Section Break"
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"options": "Company",
"reqd": 1
},
{
"fieldname": "party_type",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Party Type",
"options": "DocType",
"reqd": 1
},
{
"fieldname": "column_break_io6c",
"fieldtype": "Column Break"
},
{
"fieldname": "party",
"fieldtype": "Dynamic Link",
"in_list_view": 1,
"label": "Party",
"options": "party_type",
"reqd": 1
},
{
"fieldname": "receivable_payable_account",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Receivable/Payable Account",
"options": "Account",
"reqd": 1
},
{
"fieldname": "filter_section",
"fieldtype": "Section Break",
"label": "Filters"
},
{
"fieldname": "from_invoice_date",
"fieldtype": "Date",
"label": "From Invoice Date"
},
{
"fieldname": "to_invoice_date",
"fieldtype": "Date",
"label": "To Invoice Date"
},
{
"fieldname": "column_break_kegk",
"fieldtype": "Column Break"
},
{
"fieldname": "from_payment_date",
"fieldtype": "Date",
"label": "From Payment Date"
},
{
"fieldname": "to_payment_date",
"fieldtype": "Date",
"label": "To Payment Date"
},
{
"fieldname": "column_break_uj04",
"fieldtype": "Column Break"
},
{
"fieldname": "cost_center",
"fieldtype": "Link",
"label": "Cost Center",
"options": "Cost Center"
},
{
"fieldname": "bank_cash_account",
"fieldtype": "Link",
"label": "Bank/Cash Account",
"options": "Account"
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Auto Reconcile",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "section_break_2n02",
"fieldtype": "Section Break"
},
{
"depends_on": "eval:doc.error_log",
"fieldname": "error_log",
"fieldtype": "Long Text",
"label": "Error Log"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2023-03-27 16:40:41.830610",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Auto Reconcile",
"naming_rule": "Random",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": [],
"title_field": "company"
}
Loading

0 comments on commit 17c270c

Please sign in to comment.