diff --git a/horilla_automations/methods/methods.py b/horilla_automations/methods/methods.py index 5bc0fb740..77a2716bf 100644 --- a/horilla_automations/methods/methods.py +++ b/horilla_automations/methods/methods.py @@ -88,6 +88,7 @@ def generate_choices(model_path): f"Reporting Manager's mail ", ) ) + mail_details_choice.append(("pk", "Employee")) if model_path == "employee.models.Employee": all_mail_to_field.append(("get_email", "Employee's mail")) elif model_path == "recruitment.models.Candidate": diff --git a/horilla_automations/methods/recursive_relation.py b/horilla_automations/methods/recursive_relation.py index 70c9bbd54..192687ab4 100644 --- a/horilla_automations/methods/recursive_relation.py +++ b/horilla_automations/methods/recursive_relation.py @@ -3,10 +3,10 @@ horilla_automation/recursive_relation.py """ from django.apps import apps -from django.db.models.fields.related import ForeignKey, OneToOneField, ManyToManyField +from django.db.models.fields.related import ForeignKey, ManyToManyField, OneToOneField from django.db.models.fields.reverse_related import ( - ManyToOneRel, ManyToManyRel, + ManyToOneRel, OneToOneRel, ) diff --git a/horilla_automations/signals.py b/horilla_automations/signals.py index 5c9a5a03c..da0778b19 100644 --- a/horilla_automations/signals.py +++ b/horilla_automations/signals.py @@ -449,10 +449,8 @@ def send_mail(request, automation, instance): title_template = template.Template(automation.title) title_context = template.Context({"instance": instance, "self": sender}) render_title = title_template.render(title_context) - print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>") soup = BeautifulSoup(render_bdy, "html.parser") plain_text = soup.get_text(separator="\n") - print(render_title) email = EmailMessage( subject=render_title, @@ -468,8 +466,10 @@ def send_mail(request, automation, instance): def _send_mail(email): try: - print("MAIL SENTTTTTTTTTTTTT") email.send() + logger.info( + f"Automation {automation.title} is triggered by {request.user.employee_get}" + ) except Exception as e: print("ERRRRRR") logger.error(e) @@ -483,7 +483,9 @@ def send_mail(request, automation, instance): icon="person-remove", redirect="", ) - print("NOTIFICATION SENTTTTTTTTTTTTTT") + logger.info( + f"Automation {automation.title} is triggered by {request.user.employee_get}" + ) if automation.delivary_channel != "notification": thread = threading.Thread(