Merge pull request #12550 from rohitwaghchaure/po_permission_issue
[Fix] Error in PO. No Permission for Buying Settings
This commit is contained in:
		
						commit
						c59d52d073
					
				| @ -21,10 +21,10 @@ frappe.ui.form.on("Purchase Order", { | ||||
| 			return erpnext.queries.warehouse(frm.doc); | ||||
| 		}); | ||||
| 
 | ||||
| 		frappe.db.get_value('Buying Settings', {name: 'Buying Settings'}, 'disable_fetch_last_purchase_rate', (r) => { | ||||
| 			value = r && cint(r.disable_fetch_last_purchase_rate); | ||||
| 			frm.toggle_display('get_last_purchase_rate', !value); | ||||
| 		}); | ||||
| 		if (frm.doc.__onload) { | ||||
| 			frm.toggle_display('get_last_purchase_rate', | ||||
| 				frm.doc.__onload.disable_fetch_last_purchase_rate); | ||||
| 		} | ||||
| 
 | ||||
| 		frm.set_indicator_formatter('item_code', | ||||
| 			function(doc) { return (doc.qty<=doc.received_qty) ? "green" : "orange" }) | ||||
|  | ||||
| @ -34,6 +34,12 @@ class PurchaseOrder(BuyingController): | ||||
| 			'overflow_type': 'order' | ||||
| 		}] | ||||
| 
 | ||||
| 	def onload(self): | ||||
| 		super(PurchaseOrder, self).onload() | ||||
| 
 | ||||
| 		self.set_onload('disable_fetch_last_purchase_rate', | ||||
| 			cint(frappe.db.get_single_value("Buying Settings", "disable_fetch_last_purchase_rate"))) | ||||
| 
 | ||||
| 	def validate(self): | ||||
| 		super(PurchaseOrder, self).validate() | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user