Good day all
( Version nr reported further down)
Trying to extend my one workflow. I added the condition that is actually put as an example.
doc.creation > frappe.utils.add_to_date(frappe.utils.now_datetime(), days=-1, as_string=True, as_datetime=True)
In the example code the days was 5, … I made it 1 to test.
The error I get is …
### App Versions
{
“erpnext”: “13.48.1”,
“frappe”: “13.49.3”
}
### Route
Form/Material Request/MAT-MR-2023-00012
### Trackeback
Traceback (most recent call last):
File “apps/frappe/frappe/app.py”, line 69, in application
response = frappe.api.handle()
File “apps/frappe/frappe/api.py”, line 55, in handle
return frappe.handler.handle()
File “apps/frappe/frappe/handler.py”, line 38, in handle
data = execute_cmd(cmd)
File “apps/frappe/frappe/handler.py”, line 76, in execute_cmd
return frappe.call(method, **frappe.form_dict)
File “apps/frappe/frappe/init.py”, line 1473, in call
return fn(*args, **newargs)
File “apps/frappe/frappe/model/workflow.py”, line 73, in get_transitions
if not is_transition_condition_satisfied(transition, doc):
File “apps/frappe/frappe/model/workflow.py”, line 100, in is_transition_condition_satisfied
return frappe.safe_eval(
File “apps/frappe/frappe/init.py”, line 2119, in safe_eval
return eval(code, eval_globals, eval_locals)
File “”, line 1, in
TypeError: ‘>’ not supported between instances of ‘datetime.datetime’ and ‘str’
### Request Data
{
“type”: “POST”,
“args”: {
“doc”: “{"name":"MAT-MR-2023-00012","owner":"Administrator","creation":"2023-04-13 17:04:16.389567","modified":"2023-04-13 17:04:25.372026","modified_by":"Administrator","idx":0,"docstatus":0,"workflow_state":"Approval Pending by Stock Manager","naming_series":"MAT-MR-.YYYY.-","title":"Purchase Request for M3 Nut","material_request_type":"Purchase","transfer_status":"","status":"Draft","transaction_date":"2023-04-13","schedule_date":"2023-04-14","company":"ABCD (PTY) LTD","set_warehouse":"Stores - AG","per_ordered":0,"per_received":0,"letter_head":"Letterhead B","doctype":"Material Request","items":[{"name":"2c07e0ef59","owner":"Administrator","creation":"2023-04-13 17:04:16.389567","modified":"2023-04-13 17:04:25.372026","modified_by":"Administrator","parent":"MAT-MR-2023-00012","parentfield":"items","parenttype":"Material Request","idx":1,"docstatus":0,"item_code":"SKU10001","item_name":"M3 Nut","schedule_date":"2023-04-14","description":"M3 Nut","item_group":"Raw Material","image":"","qty":55,"stock_uom":"Each","warehouse":"Stores - AG","uom":"Each","conversion_factor":1,"stock_qty":55,"min_order_qty":0,"projected_qty":-20,"actual_qty":0,"ordered_qty":0,"received_qty":0,"rate":0.05,"amount":2.75,"cost_center":"Main - AG","expense_account":"5111 - Cost of Goods Sold - AG","page_break":0,"doctype":"Material Request Item"}],"__onload":{"make_payment_via_journal_entry":0,"backflush_based_on":"Material Transferred for Subcontract"}}”
},
“headers”: {},
“error_handlers”: {},
“url”: “/api/method/frappe.model.workflow.get_transitions”
}
### Response Data
{
“exception”: “TypeError: ‘>’ not supported between instances of ‘datetime.datetime’ and ‘str’”
}
I replaced the ">" with "==" so I will see if this works ( tomorrow ) but I thought I would ask...
What would be an allowed operator? I