I create custom app where it is including to create POS Profile document, but i keep getting this error:
“exception”: “Exception: ‘dict’ object has no attribute ‘is_new’”
and the traceback :
File \"apps/frappe/frappe/model/document.py\", line 305, in save
return self._save(*args, **kwargs)
File \"apps/frappe/frappe/model/document.py\", line 327, in _save
return self.insert()
File \"apps/frappe/frappe/model/document.py\", line 248, in insert
self._set_defaults()
File \"apps/frappe/frappe/model/document.py\", line 745, in _set_defaults
if d.is_new():
AttributeError: ‘dict’ object has no attribute ‘is_new’
During handling of the above exception, another exception occurred:
My app version:
Installed Apps
Education: v15.2.1 (develop)
ERPNext: v14.60.1 (version-14)
Frappe Framework: v14.66.3 (version-14)
Frappe HR: v16.0.0-dev (develop)
and here is my code:
new_record = frappe.new_doc("POS Profile")
new_record.__newname = "Profile " + obj["name"]
new_record.company = obj["company"]
new_record.warehouse = new_recordwarehouse.name
list_payment_methods = obj["list_payments"]
new_record.payments = list_payment_methods
new_record.currency = "IDR"
new_record.write_off_account = data_comp[0].write_off_account
new_record.write_off_cost_center = data_comp[0].cost_center
new_record.write_off_limit = 1
new_record.save(ignore_permissions=True)