Auto Repeat Not Functioning for Purchase Order Due to Reqd Date Not Updating [V12]

Auto Repeat is not functioning for purchase order as required date does not update hence the error:

Full traceback below:

Traceback (most recent call last):
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/automation/doctype/auto_repeat/auto_repeat.py”, line 136, in create_documents
new_doc = self.make_new_document()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/automation/doctype/auto_repeat/auto_repeat.py”, line 151, in make_new_document
new_doc.insert(ignore_permissions = True)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 230, in insert
self.run_before_save_methods()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 896, in run_before_save_methods
self.run_method(“validate”)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 797, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 1073, in composer
return composed(self, method, *args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 1056, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py”, line 791, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/buying/doctype/purchase_order/purchase_order.py”, line 48, in validate
self.validate_schedule_date()
File “/home/ubuntu/frappe-bench/apps/erpnext/erpnext/controllers/buying_controller.py”, line 804, in validate_schedule_date
frappe.throw(_(“Row #{0}: Reqd by Date cannot be before Transaction Date”).format(d.idx))
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 377, in throw
msgprint(msg, raise_exception=exc, title=title, indicator=‘red’, is_minimizable=is_minimizable)
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 356, in msgprint
_raise_exception()
File “/home/ubuntu/frappe-bench/apps/frappe/frappe/init.py”, line 316, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Row #1: Reqd by Date cannot be before Transaction Date

You need to change date for row 1 in Purchase Order Item table , the date should be after document transaction date.

If I have to manually change the date then what is the point of auto repeat? Auto Repeat function is supposed to recreate the transaction unattended.

I would suggest you to use re-order functionality under Item docType for auto repeat of PO of such items.

However, you keep in mind that repeat document will remain in draft mode and it needs to be submitted manually.

It’s not an stock item, it is a service service so it is not a stock item and thus reorder cannot apply. Also note that the Purchase Order has approval workflow attached to it.