Doc Customization (TypeError: '' object is not iterable)

I recently added a field to the “Purchase Receipt Item” form to include the field from the linked child table Batch. the reason, I need to print receipt labels that include the expiry_date field.

I added a new filed to the above form and used the “Fetch From” function in the new field to return the date from the Batch Child Table (see below).

Once I rebooted the server the field is now visible on “new” receipts. However, the receipt will no longer save. And I get the above subject error. Before I added the new field the Purchase receipts were working perfectly fine. And opening previously saved receipts does not contain the new Expiry Date field.

Here is the last server error file:
[ERROR] 2021-03-30 19:53:45,300 | /home/frappe/frappe-bench/apps/frappe/frappe/
Site: site1.local
Form Dict: {
“action”: “Save”,
“cmd”: “”,
“doc”: "{"owner":"****@********.com","idx":0,"docstatus":0,"naming_series":"MAT-PRE-.YYYY.-","supplier":"Alchem, Inc.","supplier_name":blush:
Request Error
Traceback (most recent call last):
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 67, in application
response = frappe.api.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 59, in handle
return frappe.handler.handle()
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 24, in handle
data = execute_cmd(cmd)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 64, in execute_cmd
return, **frappe.form_dict)
File “/home/frappe/frappe-bench/apps/frappe/frappe/”, line 1074, in call
return fn(*args, **newargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/”, line 21, in savedocs
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 273, in save
return self._save(*args, **kwargs)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 296, in _save
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 224, in insert
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 759, in _validate_links
result = d.get_invalid_links(is_submittable=self.meta.is_submittable)
File “/home/frappe/frappe-bench/apps/frappe/frappe/model/”, line 479, in get_invalid_links
‘name’, cache=True))
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/”, line 401, in get_value
order_by, cache=cache)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/”, line 445, in get_values
out = self._get_values_from_table(fields, filters, doctype, as_dict, debug, order_by, update)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/”, line 586, in _get_values_from_table
conditions, values = self.build_conditions(filters)
File “/home/frappe/frappe-bench/apps/frappe/frappe/database/”, line 364, in build_conditions
for f in filters:
TypeError: ‘’ object is not iterable
[ERROR] 2021-03-30 19:53:45,563 | /home/frappe/frappe-bench/apps/frappe/frappe/utils/
New Exception collected with id: 2021-03-30 19:53:45.302982-

Can someone please point me to a possible solution?

I’ve been doing a bit more digging. And, it appears that the date is formatted incorrectly by using the “Fetch From” function in the form customization process, i.e., The expiry_date format in the Batch table appears as “mm-dd-yyyy” and the “fetched” date in the Purchase Receipt Items appears as “yyyy-mm-dd”. My guess is that this may be why it’s throwing the exception. Can someone please let me know:

  1. Is this likely?
  2. How can I format the new field? Can I format it in the same call statement field where it’s fetched?

ANY help would be appreciated. Please.

I figured it out, after a ton of searching:
It turns out the field type was incorrect. I had used the batch_no field (already in the doc type) as the template for the new field, i.e., I used “link” as the original field type that was giving me the error. After changing it to “data” I was able to save the modification and the field was available for use in the row.

However, now I have another issue due to this change:
When adding a new Batch record from the receipts line. Originally, the new item was pre-populated in the new record form. However, since a new field was added the pre-polulation no longer takes place.

I’m going to place another question on this forum. But, I guess I will have to answer them myself in time. Either way, hopefully, it helps others here looking for answers :slight_smile:

1 Like

This is answered. But, I can’t seem to find the “answered” toggle.