diff options
Diffstat (limited to 'servo/models/common.py')
-rw-r--r-- | servo/models/common.py | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/servo/models/common.py b/servo/models/common.py index 4ca1ff8..4d91296 100644 --- a/servo/models/common.py +++ b/servo/models/common.py @@ -182,17 +182,24 @@ class GsxAccount(models.Model): sold_to = models.CharField(max_length=10, verbose_name=_("Sold-To")) ship_to = models.CharField(max_length=10, verbose_name=_("Ship-To")) + user_id = models.CharField( + blank=True, + default='', + max_length=128, + verbose_name=_("User ID") + ) + region = models.CharField( max_length=3, choices=gsxws.GSX_REGIONS, verbose_name=_("Region") ) - user_id = models.CharField( - blank=True, - default='', - max_length=128, - verbose_name=_("User ID") + timezone = models.CharField( + max_length=4, + default='CEST', + verbose_name=_('Timezone'), + choices=gsxws.GSX_TIMEZONES ) environment = models.CharField( @@ -240,6 +247,18 @@ class GsxAccount(models.Model): return act @classmethod + def fallback(cls): + """ + Connect to fallback GSX account + """ + act = cls.get_default_account() + gsxws.connect(user_id=act.user_id, + sold_to=act.sold_to, + timezone=act.timezone, + environment=act.environment,) + return act + + @classmethod def default(cls, user, queue=None): """ Returns the correct GSX account for |