Skip to content

Commit 66795eb

Browse files
JasonJason
authored andcommitted
Added to_ref method to Bill object and added a test for it
1 parent 7c2f036 commit 66795eb

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

quickbooks/objects/bill.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,13 @@ def to_linked_txn(self):
134134
linked_txn.TxnLineId = 1
135135

136136
return linked_txn
137+
138+
def to_ref(self):
139+
ref = Ref()
140+
141+
ref.name = self.DisplayName
142+
ref.type = self.qbo_object_name
143+
ref.value = self.Id
144+
145+
return ref
146+

tests/unit/objects/test_bill.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ def test_valid_object_name(self):
3636

3737
self.assertTrue(result)
3838

39+
def test_to_ref(self):
40+
bill = Bill()
41+
bill.DisplayName = "test"
42+
bill.Id = 100
43+
44+
ref = bill.to_ref()
45+
46+
self.assertEquals(ref.name, "test")
47+
self.assertEquals(ref.type, "Bill")
48+
self.assertEquals(ref.value, 100)
49+
3950

4051
class BillLineTests(unittest.TestCase):
4152
def test_unicode(self):

0 commit comments

Comments
 (0)