2a9c5badc6
* fix: Reverse GL entry on cancellation of document * fix: Removed set posting time field for multiple docs * fix: Stop future reposting and reverse entry for purchase receipt and delivery note * fix: Change is_cancelled field from select to check * Revert "fix: Removed set posting time field for multiple docs" This reverts commit 81fb808db7da69ab1e58ba226c0cd0b77e5b90c8. * fix: Multiple fixes in GL Entry * fix: Remove future reporting from doctypes * fix: Canceled entry filters in Stock Ledger and General Ledger Report * fix: Remove print statement * fix: Validation for back dated entries * fix: Codacy fixes * fix: Add ignore links to multiple doctypes * fix: Codacy Fixes * fix: Ignore GL Entry and Stock Ledger entry while cancel * fix: Test case fixes * fix: Patch * fix: Codacy * fix: Budget Test Cases * fix: Patch * fix: Patch * fix: Multiple test cases * fix: changes in make_reverse_entry function * fix: Update patch * fix: Test Cases * fix: Test Case fixes * fix: Move patch upward in patches.txt * fix: Budget Test Cases * fix: Test Case and codacy * fix: Patch * fix: Minor label and UX fixes * fix: Move freezing date check * fix: Test Cases * fix: Test cases * fix: Test Cases * fix: Test Case * fix: Remove update_gl_entries_after function * fix: Remove update_gl_entries_after function * fix: Test Cases * fix: Fiscal Year wise backdated entry * fix: Update entries only for current SLE * fix: Remove is_cancelled * fix: Test Cases * fix: Test cases * fix: Test Cases * fix: Uncomment account and stock balance sync logic * fix: Stock balance and Account balance out of sync fixes * fix: Test Cases * fix: Test cases for POS, Stock Reco and Purchase Receipt * fix: Stock Reco tests * fix: Test stock reco precision * fix: Test stock reco for fifo precision * fix: Test stock reco for fifo precision * fix: Stock Entry test case Co-authored-by: Nabin Hait <nabinhait@gmail.com>
83 lines
2.4 KiB
JavaScript
83 lines
2.4 KiB
JavaScript
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
|
// License: GNU General Public License v3. See license.txt
|
|
|
|
frappe.provide("erpnext.stock");
|
|
|
|
erpnext.stock.StockController = frappe.ui.form.Controller.extend({
|
|
onload: function() {
|
|
// warehouse query if company
|
|
if (this.frm.fields_dict.company) {
|
|
this.setup_warehouse_query();
|
|
}
|
|
},
|
|
|
|
setup_warehouse_query: function() {
|
|
var me = this;
|
|
erpnext.queries.setup_queries(this.frm, "Warehouse", function() {
|
|
return erpnext.queries.warehouse(me.frm.doc);
|
|
});
|
|
},
|
|
|
|
setup_posting_date_time_check: function() {
|
|
// make posting date default and read only unless explictly checked
|
|
frappe.ui.form.on(this.frm.doctype, 'set_posting_date_and_time_read_only', function(frm) {
|
|
if(frm.doc.docstatus == 0 && frm.doc.set_posting_time) {
|
|
frm.set_df_property('posting_date', 'read_only', 0);
|
|
frm.set_df_property('posting_time', 'read_only', 0);
|
|
} else {
|
|
frm.set_df_property('posting_date', 'read_only', 1);
|
|
frm.set_df_property('posting_time', 'read_only', 1);
|
|
}
|
|
})
|
|
|
|
frappe.ui.form.on(this.frm.doctype, 'set_posting_time', function(frm) {
|
|
frm.trigger('set_posting_date_and_time_read_only');
|
|
});
|
|
|
|
frappe.ui.form.on(this.frm.doctype, 'refresh', function(frm) {
|
|
// set default posting date / time
|
|
if(frm.doc.docstatus==0) {
|
|
if(!frm.doc.posting_date) {
|
|
frm.set_value('posting_date', frappe.datetime.nowdate());
|
|
}
|
|
if(!frm.doc.posting_time) {
|
|
frm.set_value('posting_time', frappe.datetime.now_time());
|
|
}
|
|
frm.trigger('set_posting_date_and_time_read_only');
|
|
}
|
|
});
|
|
},
|
|
|
|
show_stock_ledger: function() {
|
|
var me = this;
|
|
if(this.frm.doc.docstatus > 0) {
|
|
cur_frm.add_custom_button(__("Stock Ledger"), function() {
|
|
frappe.route_options = {
|
|
voucher_no: me.frm.doc.name,
|
|
from_date: me.frm.doc.posting_date,
|
|
to_date: me.frm.doc.posting_date,
|
|
company: me.frm.doc.company
|
|
};
|
|
frappe.set_route("query-report", "Stock Ledger");
|
|
}, __("View"));
|
|
}
|
|
|
|
},
|
|
|
|
show_general_ledger: function() {
|
|
var me = this;
|
|
if(this.frm.doc.docstatus > 0) {
|
|
cur_frm.add_custom_button(__('Accounting Ledger'), function() {
|
|
frappe.route_options = {
|
|
voucher_no: me.frm.doc.name,
|
|
from_date: me.frm.doc.posting_date,
|
|
to_date: me.frm.doc.posting_date,
|
|
company: me.frm.doc.company,
|
|
group_by: "Group by Voucher (Consolidated)"
|
|
};
|
|
frappe.set_route("query-report", "General Ledger");
|
|
}, __("View"));
|
|
}
|
|
}
|
|
});
|