File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -104,3 +104,12 @@ def email_sent(self):
104
104
return True
105
105
106
106
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
Original file line number Diff line number Diff line change @@ -39,6 +39,17 @@ def test_valid_object_name(self):
39
39
40
40
self .assertTrue (result )
41
41
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
+
42
53
43
54
class DeliveryInfoTests (unittest .TestCase ):
44
55
def test_init (self ):
You can’t perform that action at this time.
0 commit comments