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)
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)
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) return e
def notify(self, action, message, user): e = Event(content_object=self, action=action) e.description = message e.triggered_by = user e.save()