Esempio n. 1
0
 def create_script(self, form=None):
     """ Creates the script based on the event and the steps """
     script = Script(event_identifier=self.event.identifier,
                     name=self.name,
                     enabled=True)
     script.set_steps(self.get_script_steps(form))
     script.save()
     return script
Esempio n. 2
0
    def save(self):
        """ Create and configure the selected objects if needed """

        # User wants a order notification and Notify installed and there is no script created previously
        if (self.is_valid() and self.cleaned_data["order_confirm_notification"] and
                djangoenv.has_installed("shuup.notify") and not self._get_saved_script()):

            from shuup.front.notify_events import OrderReceived
            from shuup.notify.models.script import Script
            from shuup.notify.script import Step, StepNext

            send_email_action = self._get_send_email_action()

            script = Script(event_identifier=OrderReceived.identifier, name="Order Received", enabled=True)
            script.set_steps([Step(next=StepNext.STOP, actions=(send_email_action,))])
            script.save()

            # save the PK in the configs
            config.set(self.shop, BEHAVIOR_ORDER_CONFIRM_KEY, script.pk)
Esempio n. 3
0
 def create_script(self, form=None):
     """ Creates the script based on the event and the steps """
     script = Script(event_identifier=self.event.identifier, name=self.name, enabled=True)
     script.set_steps(self.get_script_steps(form))
     script.save()
     return script