Changeset 28238c6 in tailbone


Ignore:
Timestamp:
07/23/2022 10:09:47 PM (6 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
e656f76
Parents:
e77ca93
git-author:
Lance Edgar <lance@…> (07/23/2022 10:06:18 PM)
git-committer:
Lance Edgar <lance@…> (07/23/2022 10:09:47 PM)
Message:

Add setting to expose/hide "active in POS" customer flag

Location:
tailbone
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • tailbone/views/customers.py

    re77ca93 r28238c6  
    5151    touchable = True
    5252    supports_autocomplete = True
     53    configurable = True
    5354
    5455    # whether to show "view full profile" helper for customer view
     
    9394    ]
    9495
     96    def get_expose_active_in_pos(self):
     97        if not hasattr(self, '_expose_active_in_pos'):
     98            self._expose_active_in_pos = self.rattail_config.getbool(
     99                'rattail', 'customers.active_in_pos',
     100                default=False)
     101        return self._expose_active_in_pos
     102
    95103    def configure_grid(self, g):
    96104        super(CustomerView, self).configure_grid(g)
     
    133141
    134142        # active_in_pos
    135         g.filters['active_in_pos'].default_active = True
    136         g.filters['active_in_pos'].default_verb = 'is_true'
     143        if self.get_expose_active_in_pos():
     144            g.filters['active_in_pos'].default_active = True
     145            g.filters['active_in_pos'].default_verb = 'is_true'
    137146
    138147        g.set_link('id')
     
    143152
    144153    def grid_extra_class(self, customer, i):
    145         if not customer.active_in_pos:
    146             return 'warning'
     154        if self.get_expose_active_in_pos():
     155            if not customer.active_in_pos:
     156                return 'warning'
    147157
    148158    def get_instance(self):
     
    246256        customer = f.model_instance
    247257        permission_prefix = self.get_permission_prefix()
     258
     259        if not self.get_expose_active_in_pos():
     260            f.remove('active_in_pos',
     261                     'active_in_pos_sticky')
    248262
    249263        # members
     
    431445        return self.redirect(self.request.get_referrer())
    432446
     447    def configure_get_simple_settings(self):
     448        return [
     449
     450            # POS
     451            {'section': 'rattail',
     452             'option': 'customers.active_in_pos',
     453             'type': bool},
     454
     455        ]
     456
    433457    @classmethod
    434458    def defaults(cls, config):
Note: See TracChangeset for help on using the changeset viewer.