This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doc = frappe.get_doc(doctype, name) | |
if hasattr(doc, 'has_web_form_permission'): | |
if not doc.has_web_form_permission(): | |
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# you can selectively import objects from different files like this: | |
from houses import all_houses | |
from students import all_students | |
def sort(student): | |
for house in all_houses: | |
if house.ability == student.ability: | |
if house.students is None: | |
house.students = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class House: | |
name = None | |
ability = None | |
students = None | |
class Student: | |
name = None | |
ability = None | |
# houses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cur_frm.cscript.custom_validate = function(doc) { | |
var items = wn.model.get("Delivery Note Item", {parent: doc.name}) | |
var items_against_sales_order = $.map(items, function(d) { return d.against_sales_order ? d : null }) | |
if(items.length > items_against_sales_order.length && user_roles.indexOf(["Allowed Role"])===-1) { | |
wn.msgprint("Please make against sales order"); | |
throw "Not allowed"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def custom_validate(self): | |
webnotes.msgprint('I got called') | |
company_count = 1 | |
if company_count >=0 : | |
webnotes.msgprint('Error: Test') | |
raise Exception |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def custom_on_update(self): | |
parent = self.get_parent_bean() | |
if not parent: | |
return | |
parent.ignore_permissions = True | |
if parent.doc.doctype=="Lead" and parent.doc.status != "Trial Approved": | |
if "via demo.erpnext.com" in self.doc.content: | |
parent.doc.source="Demo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
शहर काr अाेर जा रही हैं। बजट काr केहनी जाता हैं, वह बंद केरकेे, सभी दजx केे याित्रयों सो केइ& जयाद हैं | |
त्र+<भ मोहता | |
इस हफ्तो हमारे िवò मंत्री श्री िचदंबरम नो 2013-14 का केंõीय बजट पोश िकेया। बजट केे बारे मैं बहुत लाेगों नो अपनी रय रखी। िवरोधी दल नो िवरोध िकेया, शासके दल नो पसंद िकेया। पर अाम जनता पर इसका क्या असर होता हैं? भारत जwसो िवशाल देश काr अL&वयवसLा एके मशीन काr तरह बहुत ही जाfटल मामला हैं। मानाे यह एके रेल गा[ी हैं, जाे तो]जी सो चल रही हैं। ऐसी रेल गा[ी मw अाप जाे बदलाव केर सकेतो हैं बस Gतना ही देश काr अL&वयवसLा मं बदलाव हो सकेता हैं। | |
इस अL&वयवसLा काr रेल गा[ी काे लगता हैं काr हमारे िवò मंत्री चला रहे हैं। पर यह सच नहीं हैं। इसकाे चला रहे हैं पलािनंग केमीशन केे Gपाअधय# श्री मोंटेके िसंह अहलुवािलया। िवò मंत्री ताे केेवल यह तय केरतो हैं िके काेयलो केे िलए पwसो केहB सो अायंगो? पर यह गा[ी अा केहB सो रही हैं अाwर जा केहB रही हैं? | |
यह गा[ी 1947 नाम केे एके गाBव सो अा रही हैं, अाwर भाfव<य केे | |
यह गा[ी जहB सो शु¤ हुइ&, वहं बहुत Úोटे Úोटे गाBव Lो, अाwर शहर केम Lो। जयाद लाेग गरीब Lो अाwर लाेगों केे पास सामन भी के |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
my_map = { | |
"B": u"\u0901", | |
"Q": u"\u0948\u0902", | |
"R": u"\u0940\u0902", | |
"W": u"\u0902", | |
"b": u"\u0902", | |
"D": u"\u0905", | |
"F": u"\u0907", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with open("para1.txt", "r") as pfile: | |
ptxt = pfile.read() | |
with open("para1-1.txt", "r") as ufile: | |
utxt = ufile.read() | |
pwords = ptxt.split() | |
uwords = utxt.split() | |
my_map = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import webnotes, json | |
webnotes.connect() | |
source = "Quotation" | |
target = "Sales Order" | |
doclist = webnotes.bean("DocType Mapper", "Quotation-Sales Order").doclist | |
map_id = {} |