* added currency filter * modified files * pull margin only if currency matches * Renamed price to rate in pricing rule * fetch rate only if currency matches * rebase with develop * rebase with develop * patch to set currency in existing docs * currency field mandatory in pricing rule * modified test cases * rebase with develop * fixed test case
		
			
				
	
	
		
			13 lines
		
	
	
		
			430 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			13 lines
		
	
	
		
			430 B
		
	
	
	
		
			Python
		
	
	
	
	
	
| from __future__ import unicode_literals
 | |
| import frappe
 | |
| 
 | |
| def execute():
 | |
| 	frappe.reload_doctype("Pricing Rule")
 | |
| 
 | |
| 	currency = frappe.db.get_default("currency")
 | |
| 	for doc in frappe.get_all('Pricing Rule', fields = ["company", "name"]):
 | |
| 		if doc.company:
 | |
| 			currency = frappe.db.get_value("Company", doc.company, "default_currency")
 | |
| 
 | |
| 		frappe.db.sql("""update `tabPricing Rule` set currency = %s where name = %s""",(currency, doc.name))
 |