From 4e1681cb94ccbe4003880fa8eb60547f7e859f33 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Wed, 26 Sep 2012 03:31:51 +0200 Subject: [PATCH] brmbar.Account.add_barcode(): New method --- brmbar3/brmbar/Account.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/brmbar3/brmbar/Account.py b/brmbar3/brmbar/Account.py index 005708e..23ffd69 100644 --- a/brmbar3/brmbar/Account.py +++ b/brmbar3/brmbar/Account.py @@ -78,3 +78,7 @@ class Account: """ Common part of credit() and debit(). """ with closing(self.db.cursor()) as cur: cur.execute("INSERT INTO transaction_splits (transaction, side, account, amount, memo) VALUES (%s, %s, %s, %s, %s)", [transaction, side, self.id, amount, memo]) + + def add_barcode(self, barcode): + with closing(self.db.cursor()) as cur: + cur.execute("INSERT INTO barcodes (account, barcode) VALUES (%s, %s)", [self.id, barcode])