Skip to content

Commit 629130b

Browse files
authored
Merge pull request ej2#194 from HaddadJoe/master
[Add] Allow generation of Ref for invoice object
2 parents 2384a90 + 4947608 commit 629130b

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

quickbooks/objects/invoice.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,12 @@ def email_sent(self):
104104
return True
105105

106106
return False
107+
108+
def to_ref(self):
109+
ref = Ref()
110+
111+
ref.name = self.DocNumber
112+
ref.type = self.qbo_object_name
113+
ref.value = self.Id
114+
115+
return ref

tests/unit/objects/test_invoice.py

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

4040
self.assertTrue(result)
4141

42+
def test_to_ref(self):
43+
invoice = Invoice()
44+
invoice.DocNumber = 1
45+
invoice.Id = 2
46+
47+
ref = invoice.to_ref()
48+
self.assertIsInstance(ref, Ref)
49+
self.assertEquals(ref.type, "Invoice")
50+
self.assertEquals(ref.name, 1) # should be DocNumber
51+
self.assertEquals(ref.value, 2) # should be Id
52+
4253

4354
class DeliveryInfoTests(unittest.TestCase):
4455
def test_init(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy