Skip to content

Commit 80f0ca8

Browse files
authored
Merge pull request routablehq#37 from sidecars/bill_to_ref
Added to_ref method to the Bill object and added a test for it.
2 parents d459d6b + 66795eb commit 80f0ca8

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)