コード例 #1
0
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module(
                'default_perspective',
                self.cleaned_data['default_perspective'].id, 'anaf.core')
            ModuleSetting.set_for_module(
                'default_permissions',
                self.cleaned_data['default_permissions'], 'anaf.core')
            ModuleSetting.set_for_module('default_timezone',
                                         self.cleaned_data['default_timezone'],
                                         'anaf.core')
            ModuleSetting.set_for_module('language',
                                         self.cleaned_data['language'],
                                         'anaf.core')
            if settings.ANAF_SUBSCRIPTION_CUSTOMIZATION:
                if isinstance(self.fields['logo'], forms.FileField):
                    logopath = self._handle_uploaded_file('logo')
                    ModuleSetting.set_for_module('logopath', logopath,
                                                 'anaf.core')

                elif isinstance(self.fields['logo'], forms.ChoiceField
                                ) and self.cleaned_data['logo'] == 'delete':
                    try:
                        ModuleSetting.get_for_module('anaf.core',
                                                     'logopath').delete()
                    except:
                        pass
            return True
        except:
            return False
コード例 #2
0
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('default_contact_type',
                                         self.cleaned_data[
                                             'default_contact_type'].id,
                                         'anaf.identities')

        except Exception:
            return False
コード例 #3
0
ファイル: forms.py プロジェクト: rogeriofalcone/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module(
                'default_item_status',
                self.cleaned_data['default_item_status'].id,
                'anaf.infrastructure')

        except Exception:
            return False
コード例 #4
0
ファイル: forms.py プロジェクト: tovmeod/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('default_item_status',
                                         self.cleaned_data[
                                             'default_item_status'].id,
                                         'anaf.infrastructure')

        except Exception:
            return False
コード例 #5
0
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('default_task_status',
                                         self.cleaned_data[
                                             'default_task_status'].id,
                                         'anaf.projects')

        except Exception:
            return False
コード例 #6
0
ファイル: forms.py プロジェクト: tovmeod/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('default_changeset_status',
                                         self.cleaned_data[
                                             'default_changeset_status'].id,
                                         'anaf.changes')
            return True

        except Exception:
            return False
コード例 #7
0
ファイル: forms.py プロジェクト: rogeriofalcone/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module(
                'default_changeset_status',
                self.cleaned_data['default_changeset_status'].id,
                'anaf.changes')
            return True

        except Exception:
            return False
コード例 #8
0
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('my_company',
                                         self.cleaned_data['my_company'].id,
                                         'anaf.finance')
            ModuleSetting.set_for_module(
                'default_account', self.cleaned_data['default_account'].id,
                'anaf.finance')
            currency = Currency.objects.get(
                pk=self.cleaned_data['default_currency'])
            currency.is_default = True
            currency.save()
            return True

        except Exception:
            return False
コード例 #9
0
ファイル: forms.py プロジェクト: tovmeod/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('my_company',
                                         self.cleaned_data['my_company'].id,
                                         'anaf.finance')
            ModuleSetting.set_for_module('default_account',
                                         self.cleaned_data[
                                             'default_account'].id,
                                         'anaf.finance')
            currency = Currency.objects.get(
                pk=self.cleaned_data['default_currency'])
            currency.is_default = True
            currency.save()
            return True

        except Exception:
            return False
コード例 #10
0
 def save(self):
     "Form processor"
     fields = self.fields
     try:
         for field in fields:
             if self.cleaned_data[field]:
                 if field == 'default_currency':
                     ModuleSetting.set_for_module('default_currency',
                                                  self.cleaned_data[
                                                      'default_currency'],
                                                  'anaf.sales')
                     currency = Currency.objects.get(
                         pk=self.cleaned_data['default_currency'])
                     currency.is_default = True
                     currency.save()
                 else:
                     ModuleSetting.set_for_module(field, self.cleaned_data[field].id,
                                                  'anaf.sales')
         return True
     except:
         return False
コード例 #11
0
ファイル: forms.py プロジェクト: rogeriofalcone/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module(
                'default_ticket_status',
                self.cleaned_data['default_ticket_status'].id, 'anaf.services')
            ModuleSetting.set_for_module(
                'default_ticket_queue',
                self.cleaned_data['default_ticket_queue'].id, 'anaf.services')
            ModuleSetting.set_for_module(
                'send_email_to_caller',
                self.cleaned_data['send_email_to_caller'], 'anaf.services')
            ModuleSetting.set_for_module(
                'send_email_template',
                self.cleaned_data['send_email_template'], 'anaf.services')
            return True

        except Exception:
            return False
コード例 #12
0
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module(
                'default_perspective',
                self.cleaned_data['default_perspective'].id,
                'anaf.core',
                user=self.user)
            ModuleSetting.set_for_module('default_timezone',
                                         self.cleaned_data['default_timezone'],
                                         'anaf.core',
                                         user=self.user)
            ModuleSetting.set_for_module('language',
                                         self.cleaned_data['language'],
                                         'anaf.core',
                                         user=self.user)
            # notification settings
            email_notifications = self.cleaned_data['email_notifications']
            notification, created = NotificationSetting.objects.get_or_create(
                owner=self.user)
            if email_notifications in ('d', 'w', 'm'):
                notification.ntype = email_notifications
                if not notification.enabled:
                    notification.enabled = True
                    notification.update_date(date.today())
                notification.save()
                notification.modules.clear()
                for m in Module.objects.filter(
                        pk__in=self.cleaned_data['notifications_for_modules']):
                    notification.modules.add(m)
            else:
                notification.enabled = False
                notification.save()
            ModuleSetting.set_for_module('email_notifications',
                                         email_notifications,
                                         'anaf.core',
                                         user=self.user)
            return True

        except:
            return False
コード例 #13
0
ファイル: forms.py プロジェクト: tovmeod/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('default_ticket_status',
                                         self.cleaned_data[
                                             'default_ticket_status'].id,
                                         'anaf.services')
            ModuleSetting.set_for_module('default_ticket_queue',
                                         self.cleaned_data[
                                             'default_ticket_queue'].id,
                                         'anaf.services')
            ModuleSetting.set_for_module('send_email_to_caller',
                                         self.cleaned_data[
                                             'send_email_to_caller'],
                                         'anaf.services')
            ModuleSetting.set_for_module('send_email_template',
                                         self.cleaned_data[
                                             'send_email_template'],
                                         'anaf.services')
            return True

        except Exception:
            return False
コード例 #14
0
ファイル: forms.py プロジェクト: tovmeod/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('default_perspective',
                                         self.cleaned_data[
                                             'default_perspective'].id,
                                         'anaf.core', user=self.user)
            ModuleSetting.set_for_module('default_timezone',
                                         self.cleaned_data['default_timezone'],
                                         'anaf.core', user=self.user)
            ModuleSetting.set_for_module('language',
                                         self.cleaned_data['language'],
                                         'anaf.core', user=self.user)
            # notification settings
            email_notifications = self.cleaned_data['email_notifications']
            notification, created = NotificationSetting.objects.get_or_create(
                owner=self.user)
            if email_notifications in ('d', 'w', 'm'):
                notification.ntype = email_notifications
                if not notification.enabled:
                    notification.enabled = True
                    notification.update_date(date.today())
                notification.save()
                notification.modules.clear()
                for m in Module.objects.filter(pk__in=self.cleaned_data['notifications_for_modules']):
                    notification.modules.add(m)
            else:
                notification.enabled = False
                notification.save()
            ModuleSetting.set_for_module('email_notifications',
                                         email_notifications,
                                         'anaf.core', user=self.user)
            return True

        except:
            return False
コード例 #15
0
ファイル: forms.py プロジェクト: rogeriofalcone/anaf
    def save(self):
        "Form processor"
        try:
            ModuleSetting.set_for_module('default_contact_type',
                                         self.cleaned_data[
                                             'default_contact_type'].id,
                                         'anaf.messaging')
        except:
            pass

        try:
            ModuleSetting.set_for_module('default_imap_folder',
                                         self.cleaned_data[
                                             'default_imap_folder'],
                                         'anaf.messaging')
        except:
            pass

        try:
            ModuleSetting.set_for_module('signature',
                                         self.cleaned_data['signature'],
                                         'anaf.messaging', user=self.user)
        except:
            pass