"Energy Point" condition date functions not working

Hi Everyone,

Timesheet doctype Energy Point condition like,

doc.creation > frappe.utils.add_to_date(frappe.utils.now_datetime(), days=-5, as_string=True, as_datetime=True)

It is showing error message as ‘frappe not defined.’ please guide anyone how to give date condition.

Thanks

Hi @HnSSiva,

You can use only simple conditions like,

doc.status == 'Closed'
doc.company == "XYZ"

Thank You!

Thanks for the reply @NCP

I need date field condition like

doc.start_date == doc.modified
doc.start_date == doc.creation

But, here ‘start_date’ is date field and ‘creation’ is datetime field

Hi @HnSSiva,

That for, first create the custom field and then start date convert into the date to DateTime to set in the custom field.

Otherwise, creation/creation convert into the date and set in the custom field.

then after apply the condition in Energy Point like

doc.custom_field == doc.modified

// Otherwise

doc.start_date == doc.custom_field

Hope you understand.

Thank You!

Yeah, got it @NCP
Thank You :slightly_smiling_face: