Expose permissions for POS, if so configured
This commit is contained in:
		
							parent
							
								
									e1a64de205
								
							
						
					
					
						commit
						d45ee34b0c
					
				
					 1 changed files with 27 additions and 1 deletions
				
			
		| 
						 | 
					@ -89,7 +89,7 @@ class POSBatchView(BatchMasterView):
 | 
				
			||||||
        'quantity',
 | 
					        'quantity',
 | 
				
			||||||
        'sales_total',
 | 
					        'sales_total',
 | 
				
			||||||
        'tender_total',
 | 
					        'tender_total',
 | 
				
			||||||
        'status_code',
 | 
					        'user',
 | 
				
			||||||
    ]
 | 
					    ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    row_form_fields = [
 | 
					    row_form_fields = [
 | 
				
			||||||
| 
						 | 
					@ -188,6 +188,32 @@ class POSBatchView(BatchMasterView):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        f.set_renderer('user', self.render_user)
 | 
					        f.set_renderer('user', self.render_user)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @classmethod
 | 
				
			||||||
 | 
					    def defaults(cls, config):
 | 
				
			||||||
 | 
					        cls._batch_defaults(config)
 | 
				
			||||||
 | 
					        cls._defaults(config)
 | 
				
			||||||
 | 
					        cls._pos_batch_defaults(config)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @classmethod
 | 
				
			||||||
 | 
					    def _pos_batch_defaults(cls, config):
 | 
				
			||||||
 | 
					        rattail_config = config.registry.settings.get('rattail_config')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        if rattail_config.getbool('tailbone', 'expose_pos_permissions',
 | 
				
			||||||
 | 
					                                  default=False):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            config.add_tailbone_permission_group('pos', "POS", overwrite=False)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            config.add_tailbone_permission('pos', 'pos.ring_sales',
 | 
				
			||||||
 | 
					                                           "Make transactions (ring up sales)")
 | 
				
			||||||
 | 
					            # config.add_tailbone_permission('pos', 'pos.resume',
 | 
				
			||||||
 | 
					            #                                "Resume previously-suspended transaction")
 | 
				
			||||||
 | 
					            # config.add_tailbone_permission('pos', 'pos.suspend',
 | 
				
			||||||
 | 
					            #                                "Suspend current transaction")
 | 
				
			||||||
 | 
					            config.add_tailbone_permission('pos', 'pos.swap_customer',
 | 
				
			||||||
 | 
					                                           "Swap customer for current transaction")
 | 
				
			||||||
 | 
					            config.add_tailbone_permission('pos', 'pos.void_txn',
 | 
				
			||||||
 | 
					                                           "Void current transaction")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def defaults(config, **kwargs):
 | 
					def defaults(config, **kwargs):
 | 
				
			||||||
    base = globals()
 | 
					    base = globals()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue