refactor: msgprint(raise_exception)->frappe.throw

This commit is contained in:
Ankush Menat 2021-05-22 23:58:38 +05:30
parent ccbde0efa0
commit 958d485ba4
No known key found for this signature in database
GPG Key ID: 8EA82E09BBD13AAF

View File

@ -516,7 +516,7 @@ class Item(WebsiteGenerator):
def validate_item_type(self):
if self.has_serial_no == 1 and self.is_stock_item == 0 and not self.is_fixed_asset:
msgprint(_("'Has Serial No' can not be 'Yes' for non-stock item"), raise_exception=1)
frappe.throw(_("'Has Serial No' can not be 'Yes' for non-stock item"))
if self.has_serial_no == 0 and self.serial_no_series:
self.serial_no_series = None
@ -1269,7 +1269,7 @@ def get_uom_conv_factor(uom, stock_uom):
@frappe.whitelist()
def get_item_attribute(parent, attribute_value=''):
if not frappe.has_permission("Item"):
frappe.msgprint(_("No Permission"), raise_exception=1)
frappe.throw(_("No Permission"))
return frappe.get_all("Item Attribute Value", fields = ["attribute_value"],
filters = {'parent': parent, 'attribute_value': ("like", "%%%s%%" % attribute_value)})