-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: provision to make reposting entries from Stock and Account Value Comparison Report (backport #35365) (#37171) * feat: provision to make reposting entries from Stock and Account Value Comparison Report (cherry picked from commit 7b818e9) * fix: `linter` * fix(ux): throw if no row selected to create repost entries --------- Co-authored-by: Rohit Waghchaure <[email protected]> Co-authored-by: s-aga-r <[email protected]> * fix: incorrect stock ledger entries in DN (backport #36944) (#37067) * fix: incorrect stock ledger entries in DN (#36944) (cherry picked from commit 0e83190) # Conflicts: # erpnext/stock/doctype/delivery_note/delivery_note.json * chore: fix conflicts --------- Co-authored-by: rohitwaghchaure <[email protected]> * feat: `Stock Ledger Variance` report (backport #37165) (#37184) feat: `Stock Ledger Variance` report (#37165) * feat: `Stock Ledger Variance` report * refactor: `get_data()` (cherry picked from commit acda72d) Co-authored-by: s-aga-r <[email protected]> * fix: Update `advance_paid` in SO/PO after unlinking from advance entry (cherry picked from commit 426350e) * test: Impact on SO of advance PE submit and unlinking/replacement by SI (cherry picked from commit 8a4954d) --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Rohit Waghchaure <[email protected]> Co-authored-by: s-aga-r <[email protected]> Co-authored-by: marination <[email protected]> Co-authored-by: ruthra kumar <[email protected]>
- Loading branch information
1 parent
7c1288f
commit 4285bbc
Showing
9 changed files
with
516 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
101 changes: 101 additions & 0 deletions
101
erpnext/stock/report/stock_ledger_variance/stock_ledger_variance.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// Copyright (c) 2023, Frappe Technologies Pvt. Ltd. and contributors | ||
// For license information, please see license.txt | ||
|
||
const DIFFERENCE_FIELD_NAMES = [ | ||
"difference_in_qty", | ||
"fifo_qty_diff", | ||
"fifo_value_diff", | ||
"fifo_valuation_diff", | ||
"valuation_diff", | ||
"fifo_difference_diff", | ||
"diff_value_diff" | ||
]; | ||
|
||
frappe.query_reports["Stock Ledger Variance"] = { | ||
"filters": [ | ||
{ | ||
"fieldname": "item_code", | ||
"fieldtype": "Link", | ||
"label": "Item", | ||
"options": "Item", | ||
get_query: function() { | ||
return { | ||
filters: {is_stock_item: 1, has_serial_no: 0} | ||
} | ||
} | ||
}, | ||
{ | ||
"fieldname": "warehouse", | ||
"fieldtype": "Link", | ||
"label": "Warehouse", | ||
"options": "Warehouse", | ||
get_query: function() { | ||
return { | ||
filters: {is_group: 0, disabled: 0} | ||
} | ||
} | ||
}, | ||
{ | ||
"fieldname": "difference_in", | ||
"fieldtype": "Select", | ||
"label": "Difference In", | ||
"options": [ | ||
"", | ||
"Qty", | ||
"Value", | ||
"Valuation", | ||
], | ||
}, | ||
{ | ||
"fieldname": "include_disabled", | ||
"fieldtype": "Check", | ||
"label": "Include Disabled", | ||
} | ||
], | ||
|
||
formatter (value, row, column, data, default_formatter) { | ||
value = default_formatter(value, row, column, data); | ||
|
||
if (DIFFERENCE_FIELD_NAMES.includes(column.fieldname) && Math.abs(data[column.fieldname]) > 0.001) { | ||
value = "<span style='color:red'>" + value + "</span>"; | ||
} | ||
|
||
return value; | ||
}, | ||
|
||
get_datatable_options(options) { | ||
return Object.assign(options, { | ||
checkboxColumn: true, | ||
}); | ||
}, | ||
|
||
onload(report) { | ||
report.page.add_inner_button(__('Create Reposting Entries'), () => { | ||
let message = ` | ||
<div> | ||
<p> | ||
Reposting Entries will change the value of | ||
accounts Stock In Hand, and Stock Expenses | ||
in the Trial Balance report and will also change | ||
the Balance Value in the Stock Balance report. | ||
</p> | ||
<p>Are you sure you want to create Reposting Entries?</p> | ||
</div>`; | ||
let indexes = frappe.query_report.datatable.rowmanager.getCheckedRows(); | ||
let selected_rows = indexes.map(i => frappe.query_report.data[i]); | ||
|
||
if (!selected_rows.length) { | ||
frappe.throw(__("Please select rows to create Reposting Entries")); | ||
} | ||
|
||
frappe.confirm(__(message), () => { | ||
frappe.call({ | ||
method: 'erpnext.stock.report.stock_ledger_invariant_check.stock_ledger_invariant_check.create_reposting_entries', | ||
args: { | ||
rows: selected_rows, | ||
} | ||
}); | ||
}); | ||
}); | ||
}, | ||
}; |
22 changes: 22 additions & 0 deletions
22
erpnext/stock/report/stock_ledger_variance/stock_ledger_variance.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"add_total_row": 0, | ||
"columns": [], | ||
"creation": "2023-09-20 10:44:19.414449", | ||
"disabled": 0, | ||
"docstatus": 0, | ||
"doctype": "Report", | ||
"filters": [], | ||
"idx": 0, | ||
"is_standard": "Yes", | ||
"letterhead": null, | ||
"modified": "2023-09-20 10:44:19.414449", | ||
"modified_by": "Administrator", | ||
"module": "Stock", | ||
"name": "Stock Ledger Variance", | ||
"owner": "Administrator", | ||
"prepared_report": 0, | ||
"ref_doctype": "Stock Ledger Entry", | ||
"report_name": "Stock Ledger Variance", | ||
"report_type": "Script Report", | ||
"roles": [] | ||
} |
Oops, something went wrong.