def __init__(self): self.id = '{0:0>3}-{1:0>6}'.format(config.get('tillid'), config.get('nextid')) config.set('nextid', int(config.get('nextid'))+1) self.products = [] self.discount = D('0.00')
def save(self, args=None): dbtype = '' for name, value in DBTYPES: if name == self.currentdb.get(): dbtype = value dbuser = self.input_dbuser.get() dbpass = self.input_dbpass.get() dbhost = self.input_dbhost.get() dbname = self.input_dbname.get() id = self.input_id.get() name = self.input_name.get() error_message = '' if not id: error_message += 'The till ID field cannot be blank.\n' if not name: error_message += 'The till name field cannot be blank.\n' if error_message: showerror(self.title, error_message) return config.set('database', dbtype) config.set('dbuser', dbuser) config.set('dbpass', dbpass) config.set('dbhost', dbhost) config.set('dbname', dbname) config.set('tillid', id) config.set('tillname', name) self.quit()