Exemplo n.º 1
0
    def add_tag(self, tag, user):
        from servo.tasks import apply_rules

        if not isinstance(tag, Tag):
            tag = Tag.objects.get(pk=tag)

        self.tags.add(tag)

        event = Event(content_object=self)
        event.description = str(tag.pk)
        event.action = "set_tag"
        event.triggered_by = user

        apply_rules(event)
Exemplo n.º 2
0
    def notify(self, action, message, user):
        """
        Notifies this order of an event
        This is also the hub for automation handling
        """
        if self.is_closed:
            return

        e = Event(content_object=self, action=action)
        e.description = message
        e.triggered_by = user
        e.save()

        for f in self.followed_by.exclude(pk=user.pk).exclude(should_notify=False):
            e.notify_users.add(f)

        if action == "product_arrived":
            if self.queue and self.queue.status_products_received:
                new_status = self.queue.status_products_received
                self.set_status(new_status, user)
Exemplo n.º 3
0
Arquivo: note.py Projeto: filipp/Servo
 def notify(self, action, message, user):
     e = Event(content_object=self, action=action)
     e.description = message
     e.triggered_by = user
     e.save()