Beispiel #1
0
 def __init__(self, parent):
     ManagePanel.__init__(self, parent, -1, 'Customer Groups', CustomerGroup, DataValidator)
     
     self.createField('Name', wx.TextCtrl, 'name', '', formatter=TextFormatter(required=True))
     self.createField('Comment', wx.TextCtrl, 'comment', '', formatter=TextFormatter(required=False),
                      style=wx.TE_MULTILINE)
     self._init_fields()
Beispiel #2
0
    def __init__(self, parent):
        ManagePanel.__init__(self, parent, -1, 'Users', User, DataValidator)

        self.createField('Username', wx.TextCtrl, 'username', '')
        self.createField('Role', wx.Choice, 'role', None)
        self.getField('role').Bind(wx.EVT_CHOICE, self.OnRoleChoice)
        self.createField('Permissions', wx.ListBox, 'permissions', [])
        self.createField('Login Box Appearance',
                         wx.CheckBox,
                         'hidden',
                         False,
                         label='Is Hidden')
        self.createField(None,
                         wx.CheckBox,
                         'passwordCheck',
                         False,
                         label='Change Password')
        self.getField('passwordCheck').Bind(wx.EVT_CHECKBOX,
                                            self.OnPasswordCheckbox)
        self.createField('Password',
                         wx.TextCtrl,
                         'password1',
                         '',
                         style=wx.TE_PASSWORD)
        self.createField('Confirm Password',
                         wx.TextCtrl,
                         'password2',
                         '',
                         style=wx.TE_PASSWORD)
        self._init_fields()
Beispiel #3
0
 def fillForm(self):
     item = self.getCurrentItem()
     session = pos.database.session()
     if item is None:
         category_choices = session.query(Category.display).all()
     else:
         category_choices = session.query(Category.display).filter(Category.id != c.id).all()
     self.getField('parent').SetItems(['[None]']+[c[0] for c in category_choices])
     ManagePanel.fillForm(self)
Beispiel #4
0
 def __init__(self, parent):
     ManagePanel.__init__(self, parent, -1, 'Currencies', Currency, DataValidator)
     
     self.createField('Name', wx.TextCtrl, 'name', '')
     self.createField('Symbol', wx.TextCtrl, 'symbol', '')
     self.createField('Value', wx.SpinCtrl, 'value', 0, formatter=FloatFormatter(required=True),
                      min=0, max=sys.maxint)
     self.createField('Decimal Places', wx.SpinCtrl, 'decimal_places', 0)
     self.createField('Digit Grouping', wx.CheckBox, 'digit_grouping', True)
     self._init_fields()
Beispiel #5
0
    def __init__(self, parent):
        ManagePanel.__init__(self, parent, -1, 'Categories', Category,
                             DataValidator)

        self.createField('Name',
                         wx.TextCtrl,
                         'name',
                         '',
                         formatter=TextFormatter(required=True))
        self.createField('Parent Category', wx.Choice, 'parent', None)
        self._init_fields()
Beispiel #6
0
 def fillForm(self):
     item = self.getCurrentItem()
     session = pos.database.session()
     if item is None:
         category_choices = session.query(Category.display).all()
     else:
         category_choices = session.query(
             Category.display).filter(Category.id != c.id).all()
     self.getField('parent').SetItems(['[None]'] +
                                      [c[0] for c in category_choices])
     ManagePanel.fillForm(self)
Beispiel #7
0
 def __init__(self, parent):
     ManagePanel.__init__(self, parent, -1, 'Permissions', Permission, DataValidator)
     
     self.createField('Name', wx.TextCtrl, 'name', '')
     self.createField('Description', wx.TextCtrl, 'description', '',
                      formatter=TextFormatter(required=False),
                      style=wx.TE_MULTILINE)
     self.createField('Menu Restrictions', CheckTreeCtrl, 'menu_restrictions', [],
                      style=wx.TR_DEFAULT_STYLE | CT_AUTO_CHECK_CHILD | wx.TR_MULTIPLE,
                      size=(200, 200))
     self._init_fields()
Beispiel #8
0
 def __init__(self, parent):
     ManagePanel.__init__(self, parent, -1, 'Products', Product, DataValidator)
     
     self.createField('Name', wx.TextCtrl, 'name', '', formatter=TextFormatter(required=True))
     self.createField('Description', wx.TextCtrl, 'description', '', formatter=TextFormatter(required=False))
     self.createField('Reference', wx.TextCtrl, 'reference', '', formatter=AlphaNumericFormatter(required=False))
     self.createField('Code', wx.TextCtrl, 'code', '', formatter=AlphaNumericFormatter(required=False))
     self.createField('Price', wx.TextCtrl, 'price', '', formatter=FloatFormatter(required=True))
     self.createField('Currency', wx.Choice, 'currency', currency.get_default())
     self.createField('Quantity', wx.SpinCtrl, 'quantity', 0,
                      value='0', min=0, max=sys.maxint, style=wx.SP_ARROW_KEYS)
     self.createField('In Stock', wx.CheckBox, 'in_stock', True)
     self.getField('in_stock').Bind(wx.EVT_CHECKBOX, self.OnInStockCheckBox)
     self.createField('Category', wx.Choice, 'category', None)
     self._init_fields()
Beispiel #9
0
    def __init__(self, parent):
        ManagePanel.__init__(self, parent, -1, 'Currencies', Currency,
                             DataValidator)

        self.createField('Name', wx.TextCtrl, 'name', '')
        self.createField('Symbol', wx.TextCtrl, 'symbol', '')
        self.createField('Value',
                         wx.SpinCtrl,
                         'value',
                         0,
                         formatter=FloatFormatter(required=True),
                         min=0,
                         max=sys.maxint)
        self.createField('Decimal Places', wx.SpinCtrl, 'decimal_places', 0)
        self.createField('Digit Grouping', wx.CheckBox, 'digit_grouping', True)
        self._init_fields()
Beispiel #10
0
    def __init__(self, parent):
        ManagePanel.__init__(self, parent, -1, 'Users', User, DataValidator)

        self.createField('Username', wx.TextCtrl, 'username', '')
        self.createField('Role', wx.Choice, 'role', None)
        self.getField('role').Bind(wx.EVT_CHOICE, self.OnRoleChoice)
        self.createField('Permissions', wx.ListBox, 'permissions', [])
        self.createField('Login Box Appearance', wx.CheckBox, 'hidden', False,
                         label='Is Hidden')
        self.createField(None, wx.CheckBox, 'passwordCheck', False,
                         label='Change Password')
        self.getField('passwordCheck').Bind(wx.EVT_CHECKBOX, self.OnPasswordCheckbox)
        self.createField('Password', wx.TextCtrl, 'password1', '',
                         style=wx.TE_PASSWORD)
        self.createField('Confirm Password', wx.TextCtrl, 'password2', '',
                         style=wx.TE_PASSWORD)
        self._init_fields()
Beispiel #11
0
 def __init__(self, parent):
     ManagePanel.__init__(self, parent, -1, 'Customers', Customer, DataValidator)
     
     self.createField('Name', wx.TextCtrl, 'name', '', formatter=TextFormatter(required=True))
     self.createField('Code', wx.TextCtrl, 'code', None, formatter=AlphaNumericFormatter(required=False))
     self.createField('First Name', wx.TextCtrl, 'first_name', None, formatter=TextFormatter(required=False))
     self.createField('Last Name', wx.TextCtrl, 'last_name', None, formatter=TextFormatter(required=False))
     self.createField('General Discount', wx.SpinCtrl, 'discount', 0, formatter=FloatFormatter(required=True),
                      min=0, max=100)
     self.createField('Max Debt', wx.TextCtrl, 'max_debt', None, formatter=FloatFormatter(required=False))
     self.createField('Preferred Currency', wx.Choice, 'currency', currency.get_default())
     self.createField('Groups', wx.CheckListBox, 'groups', [])
     self.createField('Comment', wx.TextCtrl, 'comment', '',
                      style=wx.TE_MULTILINE)
     self.createField('Contact', ContactCtrl, 'contacts', [])
     self.createField('Address', AddressCtrl, 'addresses', [])
     self._init_fields()
Beispiel #12
0
 def newItem(self):
     data = self.formPanel.data
     for i, c in enumerate(data['contacts']):
         if type(c) == dict:
             data['contacts'][i] = CustomerContact(customer=None, **c)
     for i, a in enumerate(data['addresses']):
         if type(a) == dict:
             data['addresses'][i] = CustomerAddress(customer=None, **a)
     return ManagePanel.newItem(self)
Beispiel #13
0
    def __init__(self, parent):
        ManagePanel.__init__(self, parent, -1, 'Permissions', Permission,
                             DataValidator)

        self.createField('Name', wx.TextCtrl, 'name', '')
        self.createField('Description',
                         wx.TextCtrl,
                         'description',
                         '',
                         formatter=TextFormatter(required=False),
                         style=wx.TE_MULTILINE)
        self.createField('Menu Restrictions',
                         CheckTreeCtrl,
                         'menu_restrictions', [],
                         style=wx.TR_DEFAULT_STYLE | CT_AUTO_CHECK_CHILD
                         | wx.TR_MULTIPLE,
                         size=(200, 200))
        self._init_fields()
Beispiel #14
0
    def __init__(self, parent):
        ManagePanel.__init__(self, parent, -1, 'Products', Product,
                             DataValidator)

        self.createField('Name',
                         wx.TextCtrl,
                         'name',
                         '',
                         formatter=TextFormatter(required=True))
        self.createField('Description',
                         wx.TextCtrl,
                         'description',
                         '',
                         formatter=TextFormatter(required=False))
        self.createField('Reference',
                         wx.TextCtrl,
                         'reference',
                         '',
                         formatter=AlphaNumericFormatter(required=False))
        self.createField('Code',
                         wx.TextCtrl,
                         'code',
                         '',
                         formatter=AlphaNumericFormatter(required=False))
        self.createField('Price',
                         wx.TextCtrl,
                         'price',
                         '',
                         formatter=FloatFormatter(required=True))
        self.createField('Currency', wx.Choice, 'currency',
                         currency.get_default())
        self.createField('Quantity',
                         wx.SpinCtrl,
                         'quantity',
                         0,
                         value='0',
                         min=0,
                         max=sys.maxint,
                         style=wx.SP_ARROW_KEYS)
        self.createField('In Stock', wx.CheckBox, 'in_stock', True)
        self.getField('in_stock').Bind(wx.EVT_CHECKBOX, self.OnInStockCheckBox)
        self.createField('Category', wx.Choice, 'category', None)
        self._init_fields()
Beispiel #15
0
 def updateItem(self, item):
     data = self.formPanel.data
     if data['passwordCheck']:
         data['password'] = data['password1']
     try:
         del data['passwordCheck']
     except KeyError: pass
     try:
         del data['password2']
     except KeyError: pass
     try:
         del data['password1']
     except KeyError: pass
     try:
         del data['permissions']
     except KeyError: pass
     return ManagePanel.updateItem(self, item)
Beispiel #16
0
 def updateItem(self, item):
     data = self.formPanel.data
     contacts_data = data['contacts'].copy()
     data['contacts'] = []
     for c, D in contacts_data:
         if c is None:
             data['contacts'].append(CustomerContact(customer=item, **D))
         else:
             data['contacts'].append(c)
     
     addresses_data = data['addresses'].copy()
     data['addresses'] = []
     for a, D in addresses_data:
         if a is None:
             data['addresses'].append(CustomerAddress(customer=item, **D))
         else:
             data['addresses'].append(a)
     
     return ManagePanel.updateItem(self, item)
Beispiel #17
0
 def updateItem(self, item):
     data = self.formPanel.data
     if data['passwordCheck']:
         data['password'] = data['password1']
     try:
         del data['passwordCheck']
     except KeyError:
         pass
     try:
         del data['password2']
     except KeyError:
         pass
     try:
         del data['password1']
     except KeyError:
         pass
     try:
         del data['permissions']
     except KeyError:
         pass
     return ManagePanel.updateItem(self, item)
Beispiel #18
0
 def newItem(self):
     data = self.formPanel.data
     if not data['passwordCheck']:
         data['password'] = ''
     return ManagePanel.newItem(self)
Beispiel #19
0
    def __init__(self, parent):
        ManagePanel.__init__(self, parent, -1, 'Roles', Role, DataValidator)

        self.createField('Name', wx.TextCtrl, 'name', '')
        self.createField('Permissions', wx.CheckListBox, 'permissions', [])
        self._init_fields()
Beispiel #20
0
 def newItem(self):
     data = self.formPanel.data
     if not data['passwordCheck']:
         data['password'] = ''
     return ManagePanel.newItem(self)
Beispiel #21
0
    def __init__(self, parent):
        ManagePanel.__init__(self, parent, -1, 'Roles', Role, DataValidator)

        self.createField('Name', wx.TextCtrl, 'name', '')
        self.createField('Permissions', wx.CheckListBox, 'permissions', [])
        self._init_fields()
Beispiel #22
0
 def __init__(self, parent):
     ManagePanel.__init__(self, parent, -1, 'Categories', Category, DataValidator)
     
     self.createField('Name', wx.TextCtrl, 'name', '', formatter=TextFormatter(required=True))
     self.createField('Parent Category', wx.Choice, 'parent', None)
     self._init_fields()