[Fix] Meta object has no attribute permissions (#15316)

This commit is contained in:
rohitwaghchaure 2018-09-05 11:10:17 +05:30 committed by Nabin Hait
parent 73bd3cb278
commit bcaca85873
2 changed files with 12 additions and 9 deletions

View File

@ -631,15 +631,10 @@ $.extend(erpnext.item, {
.on('input', function(e) {
var term = e.target.value;
frappe.call({
method:"frappe.client.get_list",
method:"erpnext.stock.doctype.item.item.get_item_attribute",
args:{
doctype:"Item Attribute Value",
filters: [
["parent","=", i],
["attribute_value", "like", term + "%"]
],
fields: ["attribute_value"],
parent: "Item"
parent: i,
attribute_value: term
},
callback: function(r) {
if (r.message) {

View File

@ -977,4 +977,12 @@ def get_uom_conv_factor(uom, stock_uom):
if uom_stock.from_uom == uom_row.from_uom:
value = flt(uom_stock.value) * 1/flt(uom_row.value)
return value
return value
@frappe.whitelist()
def get_item_attribute(parent, attribute_value=''):
if not frappe.has_permission("Item"):
frappe.msgprint(_("No Permission"), raise_exception=1)
return frappe.get_all("Item Attribute Value", fields = ["attribute_value"],
filters = {'parent': parent, 'attribute_value': ("like", "%%%s%%" % attribute_value)})