X Tutup
Skip to content

Commit ac5a8d3

Browse files
committed
Fix to_ref for taxcode
The quickbooks API expects the value to be the ID not the name see: https://developer.intuit.com/docs/api/accounting/taxcode#readataxcode
1 parent 756032f commit ac5a8d3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

quickbooks/objects/taxcode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def to_ref(self):
6565
ref = Ref()
6666

6767
ref.type = self.qbo_object_name
68-
ref.value = self.Name
69-
ref.name = None
68+
ref.value = self.Id
69+
ref.name = self.Name
7070

7171
return ref

tests/unit/objects/test_taxcode.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,13 @@ def test_valid_object_name(self):
2020

2121
def test_to_ref(self):
2222
taxcode = TaxCode()
23+
taxcode.Id = 2
2324
taxcode.Name = "test"
2425

2526
ref = taxcode.to_ref()
26-
self.assertEquals(ref.value, "test")
27+
self.assertEquals(ref.name, "test")
28+
self.assertEquals(ref.type, "TaxCode")
29+
self.assertEquals(ref.value, 2)
2730

2831

2932
class TaxRateDetailTests(unittest.TestCase):

0 commit comments

Comments
 (0)
X Tutup