From a8799d502d620ecb0011e4085aea7688b11e1158 Mon Sep 17 00:00:00 2001 From: Neha Fathima Date: Wed, 8 Apr 2026 17:03:41 +0530 Subject: [PATCH] feat: filtere company warehouse in stock transfer --- rmax_custom/fixtures/property_setter.json | 48 +++++++++++++++++++ rmax_custom/hooks.py | 32 ++----------- .../doctype/stock_transfer/stock_transfer.js | 13 ++++- .../doctype/stock_transfer/stock_transfer.py | 2 + 4 files changed, 66 insertions(+), 29 deletions(-) diff --git a/rmax_custom/fixtures/property_setter.json b/rmax_custom/fixtures/property_setter.json index 3b79e0b..fd4312a 100644 --- a/rmax_custom/fixtures/property_setter.json +++ b/rmax_custom/fixtures/property_setter.json @@ -1,4 +1,52 @@ [ + { + "default_value": null, + "doc_type": "Material Request", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "schedule_date", + "is_system_generated": 1, + "modified": "2026-04-08 16:11:03.871048", + "module": null, + "name": "Material Request-schedule_date-hidden", + "property": "hidden", + "property_type": "Check", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Material Request Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "schedule_date", + "is_system_generated": 0, + "modified": "2026-04-08 16:40:09.908497", + "module": null, + "name": "Material Request Item-schedule_date-hidden", + "property": "hidden", + "property_type": "Check ", + "row_name": null, + "value": "1" + }, + { + "default_value": null, + "doc_type": "Material Request Item", + "docstatus": 0, + "doctype": "Property Setter", + "doctype_or_field": "DocField", + "field_name": "schedule_date", + "is_system_generated": 0, + "modified": "2026-04-08 16:37:25.071648", + "module": null, + "name": "Material Request Item-schedule_date-default", + "property": "default", + "property_type": "Date ", + "row_name": null, + "value": "Today" + }, { "default_value": null, "doc_type": "Material Request Item", diff --git a/rmax_custom/hooks.py b/rmax_custom/hooks.py index 7d64532..7467fae 100644 --- a/rmax_custom/hooks.py +++ b/rmax_custom/hooks.py @@ -301,32 +301,6 @@ ] ] }, - { - "dt": "Custom Field", - "filters": [ - [ - "name", - "in", - [ - # Sales Invoice - "Sales Invoice-custom_payment_mode", - "Sales Invoice-custom_inter_company_branch", - - # Sales Invoice Item - "Sales Invoice Item-total_vat_linewise", - - - # Quotation - "Quotation-custom_payment_mode", - - # Quotation Item - "Quotation Item-total_vat_linewise", - - - ] - ] - ] - }, { "dt": "Property Setter", "filters": [ @@ -336,8 +310,10 @@ [ "Material Request Item-warehouse-hidden", "Material Request Item-from_warehouse-hidden", - "Material Request Item-schedule_date-reqd" - + "Material Request Item-schedule_date-reqd", + "Material Request Item-schedule_date-hidden", + "Material Request Item-schedule_date-default", + "Material Request-schedule_date-hidden" ] ] ] diff --git a/rmax_custom/rmax_custom/doctype/stock_transfer/stock_transfer.js b/rmax_custom/rmax_custom/doctype/stock_transfer/stock_transfer.js index a469bc0..999cb0e 100644 --- a/rmax_custom/rmax_custom/doctype/stock_transfer/stock_transfer.js +++ b/rmax_custom/rmax_custom/doctype/stock_transfer/stock_transfer.js @@ -9,7 +9,18 @@ frappe.ui.form.on('Stock Transfer', { } frm.set_query('set_source_warehouse', function() { return { - ignore_user_permissions: 1 + ignore_user_permissions: 1, + filters: { + company: frm.doc.company + } + }; + }); + frm.set_query('set_target_warehouse', function() { + return { + ignore_user_permissions: 1, + filters: { + company: frm.doc.company + } }; }); }, diff --git a/rmax_custom/rmax_custom/doctype/stock_transfer/stock_transfer.py b/rmax_custom/rmax_custom/doctype/stock_transfer/stock_transfer.py index ac3d9b7..d36fc55 100644 --- a/rmax_custom/rmax_custom/doctype/stock_transfer/stock_transfer.py +++ b/rmax_custom/rmax_custom/doctype/stock_transfer/stock_transfer.py @@ -31,6 +31,8 @@ def create_stock_entry(self): se = frappe.new_doc("Stock Entry") se.stock_entry_type = "Material Transfer" se.from_warehouse = self.set_source_warehouse + se.company = self.company + se.to_warehouse = self.set_target_warehouse se.remarks = f"Created from Stock Transfer: {self.name}" for item in self.items: if item.item_code: