vivek
July 24, 2016, 3:56pm
1
I am not sure if this is appropriate, but I am trying to pass an argument to an rpc.
api/method/erpnext.crm.doctype.geoloc.new_loc
new_loc now looks like this by definition
@frappe.whitelist (allow_guest=True)
def new_loc(test):
return test
there is no authentication required.
I want to pass multiple arguments to new_loc()
Thanks!
rmehta
July 24, 2016, 5:39pm
2
@vivek are you planning to contribute this?
If yes, share the whole plan
Hi @vivek ,
You can send the multiple arguments in the Request Body in (form_data
),
Please refer to get Item Details via RPC
Thanks, Makarand
vivek
July 25, 2016, 6:17am
4
What I am trying to do is rather simple. There is a Free Geofencing Android App which lets you post http requests on events like moving into a fenced area and moving out of a fenced area. Its call āEgigeozoneā.
I am trying to create a doctype via these http request.
I can contribute, but this is just a simple hack to fulfill a requirement to track sales person moving in and out of their designated client offices @rmehta
vivek
July 26, 2016, 11:15am
5
ok i am able to pass information!
1 Like
vivek
July 26, 2016, 11:18am
6
@frappe.whitelist (allow_guest=True)
def new_loc(test):
d = frappe.new_doc(āGeolocā)
d.set(ālatā, test)
d.save(ignore_permissions=True)
return d
d returns the new created doctype, but it isnt available in the list!? looks like it isnt being created in the db?
You need to use d.insert()
vivek
July 26, 2016, 2:55pm
8
@Ben_Cornwell_Mott I tried with the same. But the result is the same . anything else i should try?
I havenāt used new_doc to create documents. I typically use get_doc instead. Here is a sample of some code I use that works.
ip_doc = frappe.get_doc({
ādoctypeā: āItem Priceā,
āprice_listā: price_list,
ābuyingā: 1,
āitem_codeā: item_doc.item_code,
āprice_list_rateā: item_doc.rate,
ācurrencyā: currency,
āitem_nameā: item_doc.name,
āitem_descriptionā: item_doc.description
})
ip_doc.insert()