diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-11-18 22:41:40 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-11-18 22:41:40 +0200 |
commit | 085832888a6ebee7f0b2d23c68ef887833f2a94d (patch) | |
tree | 31363288b92ea742b9e10ff21990bd77b8bdbf82 /servo/models | |
parent | 15ea45e17ebe662b4a105a0a61d6e46dcf591358 (diff) | |
download | Servo-085832888a6ebee7f0b2d23c68ef887833f2a94d.tar.gz Servo-085832888a6ebee7f0b2d23c68ef887833f2a94d.tar.bz2 Servo-085832888a6ebee7f0b2d23c68ef887833f2a94d.zip |
Cleanup
Diffstat (limited to 'servo/models')
-rw-r--r-- | servo/models/order.py | 3 | ||||
-rw-r--r-- | servo/models/rules.py | 11 |
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')), |