Error while creating POS Profile

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)

Found out the solution,
I changed my code from:

list_payment_methods = obj["list_payments"]
		new_record.payments = list_payment_methods

to

for item in obj["list_payments"]:
			x = frappe.new_doc("POS Payment Method")
			x.default = item["default"],
			x.allow_in_returns= item["allow_in_returns"],
			x.mode_of_payment = item["mode_of_payment"]
			list_payment_methods.append(x)
		new_record.payments = list_payment_methods