diff --git a/pyzohoapi/books.py b/pyzohoapi/books.py index 7e53250..cf21b7d 100644 --- a/pyzohoapi/books.py +++ b/pyzohoapi/books.py @@ -14,6 +14,7 @@ def Account(self, *args, **kwargs): return objecttypes.Account(self, *args, **kw def CompositeItem(self, *args, **kwargs): return objecttypes.CompositeItem(self, *args, **kwargs) def Contact(self, *args, **kwargs): return objecttypes.Contact(self, *args, **kwargs) def CustomerPayment(self, *args, **kwargs): return objecttypes.CustomerPayment(self, *args, **kwargs) + def CreditNote(self, *args, **kwargs): return objecttypes.CreditNote(self, *args, **kwargs) def Document(self, *args, **kwargs): return objecttypes.Document(self, *args, **kwargs) def Invoice(self, *args, **kwargs): return objecttypes.Invoice(self, *args, **kwargs) def Item(self, *args, **kwargs): return objecttypes.Item(self, *args, **kwargs) diff --git a/pyzohoapi/inventory.py b/pyzohoapi/inventory.py index c6be24b..92a078b 100644 --- a/pyzohoapi/inventory.py +++ b/pyzohoapi/inventory.py @@ -14,6 +14,7 @@ def Account(self, *args, **kwargs): return objecttypes.Account(self, *args, **kw def Bill(self, *args, **kwargs): return objecttypes.Bill(self, *args, **kwargs) def Brand(self, *args, **kwargs): return objecttypes.Brand(self, *args, **kwargs) def Bundle(self, *args, **kwargs): return objecttypes.Bundle(self, *args, **kwargs) + def CreditNote(self, *args, **kwargs): return objecttypes.CreditNote(self, *args, **kwargs) def CompositeItem(self, *args, **kwargs): return objecttypes.CompositeItem(self, *args, **kwargs) def Contact(self, *args, **kwargs): return objecttypes.Contact(self, *args, **kwargs) def CustomerPayment(self, *args, **kwargs): return objecttypes.CustomerPayment(self, *args, **kwargs) diff --git a/pyzohoapi/objecttypes/__init__.py b/pyzohoapi/objecttypes/__init__.py index 4160eaa..c190c85 100644 --- a/pyzohoapi/objecttypes/__init__.py +++ b/pyzohoapi/objecttypes/__init__.py @@ -3,7 +3,7 @@ from pyzohoapi.objecttypes.mixins.CompositeItemOps import HasBundle from ..core import ZohoObjectBase -from .mixins import HasActivate, HasAddresses, HasConfirm, HasCustomFields, HasDelivered, HasDraft, HasImage, HasVoid +from .mixins import HasActivate, HasAddresses, HasConfirm, HasCustomFields, HasDelivered, HasDraft, HasImage, HasVoid, HasSent def ZohoObjectFactory(name, @@ -49,13 +49,13 @@ def ZohoObjectFactory(name, responseKey="composite_item", idKey="composite_item_id", mixins=[HasActivate, HasBundle, HasCustomFields]) Contact = ZohoObjectFactory("Contact", mixins=[HasActivate, HasAddresses, HasCustomFields]) -CreditNote = ZohoObjectFactory("CreditNode", mixins=[HasCustomFields]) +CreditNote = ZohoObjectFactory("CreditNote", mixins=[HasCustomFields]) Currency = ZohoObjectFactory("Currency", urlPath="settings/currencies", pluralResponseKey="currencies") CustomerPayment = ZohoObjectFactory("CustomerPayment", idKey="payment_id", numberKey="payment_number", mixins=[HasCustomFields]) Document = ZohoObjectFactory("Document", raw=True) -Invoice = ZohoObjectFactory("Invoice", mixins=[HasCustomFields]) +Invoice = ZohoObjectFactory("Invoice", mixins=[HasCustomFields, HasDraft, HasVoid, HasSent]) Item = ZohoObjectFactory("Item", mixins=[HasActivate, HasCustomFields, HasImage]) ItemAdjustment = ZohoObjectFactory("ItemAdjustment", urlPath="inventoryadjustments", responseKey="inventory_adjustment", diff --git a/pyzohoapi/objecttypes/mixins/__init__.py b/pyzohoapi/objecttypes/mixins/__init__.py index a2c1f37..5f04af1 100644 --- a/pyzohoapi/objecttypes/mixins/__init__.py +++ b/pyzohoapi/objecttypes/mixins/__init__.py @@ -10,7 +10,7 @@ 'HasActivate', 'HasAddresses', 'HasBundle', - 'HasConfirm', 'HasDraft', 'HasVoid', 'HasDelivered', + 'HasConfirm', 'HasDraft', 'HasVoid', 'HasSent', 'HasDelivered', 'HasCustomFields', 'HasImage', ] @@ -95,6 +95,13 @@ def Void(self): raise ZohoInvalidOpError("Void", self) return self._mark('void') +class HasSent(_HasStatus): + """Adds `Sent()`""" + def Sent(self): + if not self._id: + raise ZohoInvalidOpError("Sent", self) + return self._mark('sent') + class _HasAspect: def _updateAspect(self, aspect, aspect_id, data):