feat: Company filter in Stock Ledger Variance report (backport #38553) (#38574)

feat: `Company` filter in `Stock Ledger Variance` report

(cherry picked from commit fb3421fccee518799a36a27d79bf4f6632736f81)

Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
This commit is contained in:
mergify[bot] 2023-12-05 12:33:06 +05:30 committed by GitHub
parent 39e04b119a
commit 02d7dd8b15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 5 deletions

View File

@ -13,10 +13,18 @@ const DIFFERENCE_FIELD_NAMES = [
frappe.query_reports["Stock Ledger Variance"] = {
"filters": [
{
"fieldname": "company",
"label": __("Company"),
"fieldtype": "Link",
"options": "Company",
"reqd": 1,
"default": frappe.defaults.get_user_default("Company")
},
{
"fieldname": "item_code",
"fieldtype": "Link",
"label": "Item",
"label": __("Item"),
"options": "Item",
get_query: function() {
return {
@ -27,7 +35,7 @@ frappe.query_reports["Stock Ledger Variance"] = {
{
"fieldname": "warehouse",
"fieldtype": "Link",
"label": "Warehouse",
"label": __("Warehouse"),
"options": "Warehouse",
get_query: function() {
return {
@ -38,7 +46,7 @@ frappe.query_reports["Stock Ledger Variance"] = {
{
"fieldname": "difference_in",
"fieldtype": "Select",
"label": "Difference In",
"label": __("Difference In"),
"options": [
"",
"Qty",
@ -49,7 +57,7 @@ frappe.query_reports["Stock Ledger Variance"] = {
{
"fieldname": "include_disabled",
"fieldtype": "Check",
"label": "Include Disabled",
"label": __("Include Disabled"),
}
],

View File

@ -230,7 +230,12 @@ def get_item_warehouse_combinations(filters: dict = None) -> dict:
bin.item_code,
bin.warehouse,
)
.where((item.is_stock_item == 1) & (item.has_serial_no == 0) & (warehouse.is_group == 0))
.where(
(item.is_stock_item == 1)
& (item.has_serial_no == 0)
& (warehouse.is_group == 0)
& (warehouse.company == filters.company)
)
)
if filters.item_code: