Need Py equivalent script for this js

Hi ,

Could anyone tell me the py equivalent for this js script ?



check the frappe.db.get_value() method

1 Like

Hi @makarand_b. Many thanks for reply . Tried but not working .Please could you guide me


can you share your code ?

Many thanks for the reply @makarand_b

frappe.db.get_value("Production order", self.production_order, "qty")

using frappe.db.get_value you will get the qty, then you can assign this qty to any other document.

qty = frappe.db.get_value("Production order", self.production_order, "qty")

e.g doc.qty = qty

1 Like

Many thanks for swift response @makarand_b .

This code gives me this error . Please help

Traceback (most recent call last):
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 55, in application
    response = frappe.handler.handle()
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 19, in handle
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 36, in execute_cmd
    ret =, **frappe.form_dict)
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 876, in call
    return fn(*args, **newargs)
  File "/home/ommi/frappe-bench/apps/frappe/frappe/", line 36, in get_value
    filters = json.loads(filters)
  File "/usr/lib/python2.7/json/", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer