diff --git a/quickbooks/client.py b/quickbooks/client.py index b3acf68e..77eb77cb 100644 --- a/quickbooks/client.py +++ b/quickbooks/client.py @@ -243,11 +243,11 @@ def handle_exceptions(self, results): message = error["Message"] detail = "" - if "Detail" in error: + if "Detail" in error and error["Detail"] != 'null': detail = error["Detail"] - code = "" - if "code" in error: + code = 0 + if "code" in error and error["code"] != 'null': code = int(error["code"]) if code >= 10000: diff --git a/quickbooks/mixins.py b/quickbooks/mixins.py index c4df8cc0..48352915 100644 --- a/quickbooks/mixins.py +++ b/quickbooks/mixins.py @@ -45,7 +45,7 @@ def from_json(cls, json_data): sub_list.append(sub_obj) setattr(obj, key, sub_list) - else: + elif key in vars(obj): setattr(obj, key, json_data[key]) return obj diff --git a/quickbooks/objects/detailline.py b/quickbooks/objects/detailline.py index 9f852883..168aeb2b 100644 --- a/quickbooks/objects/detailline.py +++ b/quickbooks/objects/detailline.py @@ -220,7 +220,7 @@ class ItemBasedExpenseLineDetail(QuickbooksBaseObject): def __init__(self): super(ItemBasedExpenseLineDetail, self).__init__() - self.BillableStatus = "" + self.BillableStatus = None self.UnitPrice = 0 self.TaxInclusiveAmt = 0 self.Qty = 0 diff --git a/quickbooks/objects/invoice.py b/quickbooks/objects/invoice.py index da615cdf..59aeb8b3 100644 --- a/quickbooks/objects/invoice.py +++ b/quickbooks/objects/invoice.py @@ -60,6 +60,7 @@ def __init__(self): self.AllowIPNPayment = True self.DocNumber = "" self.PrivateNote = "" + self.TxnDate = "" self.DueDate = "" self.ShipDate = "" self.TrackingNum = "" diff --git a/quickbooks/objects/salesreceipt.py b/quickbooks/objects/salesreceipt.py index 91ff18e8..65dcef69 100644 --- a/quickbooks/objects/salesreceipt.py +++ b/quickbooks/objects/salesreceipt.py @@ -2,7 +2,7 @@ from .base import Ref, CustomField, QuickbooksManagedObject, LinkedTxnMixin, Address, \ EmailAddress, QuickbooksTransactionEntity, LinkedTxn from .tax import TxnTaxDetail -from .detailline import DetailLine +from .detailline import DetailLine, SalesItemLine from ..mixins import QuickbooksPdfDownloadable, DeleteMixin @@ -37,7 +37,7 @@ class SalesReceipt(DeleteMixin, QuickbooksPdfDownloadable, QuickbooksManagedObje } detail_dict = { - + "SalesItemLineDetail": SalesItemLine } qbo_object_name = "SalesReceipt"