brotherton-erpnext/erpnext/public/js/bulk_transaction_processing.js
Mohammed Yusuf Shaikh a3e69cf75d
feat: Bulk Transaction Processing (#28580)
* feat: Bulk Transaction Processing

* fix: add flags to ignore validations and exception handling correction

* fix: remove duplicate code, added logger functionality and improved notifications

* fix: linting and sider issues

* test: added tests

* fix: linter issues

* fix: failing test case

* fix: sider issues and test cases

* refactor: mapping function calls to create order/invoice

* fix: added more test cases to increase coverage

* fix: test cases

* fix: sider issue

* fix: rename doctype, improve formatting and minor refactor

* fix: update doctype name in hooks and sider issues

* fix: entry log test case

* fix: typos, translations and company name in tests

* fix: linter issues and translations

* fix: linter issue

* fix: split into separate function for marking failed transaction

* fix: typos, retry failed transaction logic and make log read only

* fix: hide retry button when no failed transactions and remove test cases not rrelevant

* fix: sider issues and indentation to tabs

Co-authored-by: Ankush Menat <ankush@frappe.io>
2022-02-08 01:00:37 +05:30

30 lines
936 B
JavaScript

frappe.provide("erpnext.bulk_transaction_processing");
$.extend(erpnext.bulk_transaction_processing, {
create: function(listview, from_doctype, to_doctype) {
let checked_items = listview.get_checked_items();
const doc_name = [];
checked_items.forEach((Item)=> {
if (Item.docstatus == 0) {
doc_name.push(Item.name);
}
});
let count_of_rows = checked_items.length;
frappe.confirm(__("Create {0} {1} ?", [count_of_rows, to_doctype]), ()=>{
if (doc_name.length == 0) {
frappe.call({
method: "erpnext.utilities.bulk_transaction.transaction_processing",
args: {data: checked_items, from_doctype: from_doctype, to_doctype: to_doctype}
}).then(()=> {
});
if (count_of_rows > 10) {
frappe.show_alert("Starting a background job to create {0} {1}", [count_of_rows, to_doctype]);
}
} else {
frappe.msgprint(__("Selected document must be in submitted state"));
}
});
}
});