fix: Setting to toggle customer and supplier warehouse for inter warehouse transfer (#21142)
* fix: Setting to toggle customer and supplier warehouse for inter warehouse transfer * fix: Use cint
This commit is contained in:
parent
1958749382
commit
aa775f87b2
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,8 @@ import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
from frappe.utils.html_utils import clean_html
|
||||
from frappe.utils import cint
|
||||
from frappe.custom.doctype.property_setter.property_setter import make_property_setter
|
||||
|
||||
class StockSettings(Document):
|
||||
def validate(self):
|
||||
@ -61,6 +63,15 @@ class StockSettings(Document):
|
||||
# changed to text
|
||||
frappe.enqueue('erpnext.stock.doctype.stock_settings.stock_settings.clean_all_descriptions', now=frappe.flags.in_test)
|
||||
|
||||
def on_update(self):
|
||||
self.toggle_warehouse_field_for_inter_warehouse_transfer()
|
||||
|
||||
def toggle_warehouse_field_for_inter_warehouse_transfer(self):
|
||||
make_property_setter("Sales Invoice Item", "target_warehouse", "hidden", 1 - cint(self.allow_from_dn), "Check")
|
||||
make_property_setter("Delivery Note Item", "target_warehouse", "hidden", 1 - cint(self.allow_from_dn), "Check")
|
||||
make_property_setter("Purchase Invoice Item", "from_warehouse", "hidden", 1 - cint(self.allow_from_pr), "Check")
|
||||
make_property_setter("Purchase Receipt Item", "from_warehouse", "hidden", 1 - cint(self.allow_from_pr), "Check")
|
||||
|
||||
|
||||
def clean_all_descriptions():
|
||||
for item in frappe.get_all('Item', ['name', 'description']):
|
||||
|
Loading…
x
Reference in New Issue
Block a user