aboutsummaryrefslogtreecommitdiffstats
path: root/servo/models
diff options
context:
space:
mode:
Diffstat (limited to 'servo/models')
-rw-r--r--servo/models/order.py3
-rw-r--r--servo/models/rules.py11
2 files changed, 14 insertions, 0 deletions
diff --git a/servo/models/order.py b/servo/models/order.py
index 1a76a37..b5c4138 100644
--- a/servo/models/order.py
+++ b/servo/models/order.py
@@ -430,6 +430,9 @@ class Order(models.Model):
pass
def set_location(self, new_location, user):
+ """
+ Moves order to new location
+ """
# move the products too
for soi in self.serviceorderitem_set.all():
product = soi.product
diff --git a/servo/models/rules.py b/servo/models/rules.py
index 1e6ec2d..460a0b6 100644
--- a/servo/models/rules.py
+++ b/servo/models/rules.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
+import json
from django.db import models
from django.core.cache import cache
@@ -12,6 +13,13 @@ from django.utils.translation import ugettext_lazy as _
from servo.models import Event, Queue
+class RuleManager:
+
+ def all(self):
+ f = open('local_rules.json', 'r')
+ return json.loads(f.read())
+
+
class ServoModel(models.Model):
class Meta:
abstract = True
@@ -19,6 +27,9 @@ class ServoModel(models.Model):
class Rule(ServoModel):
+
+ objects = RuleManager()
+
description = models.CharField(max_length=128, default=_('New Rule'))
MATCH_CHOICES = (
('ANY', _('Any')),