Skip to content

Commit

Permalink
Add support for Address model (#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
SchrodingersGat authored Jan 30, 2024
1 parent d347f89 commit 4a8433e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions inventree/company.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ class Contact(inventree.base.InventreeObject):
REQUIRED_API_VERSION = 104


class Address(inventree.base.InventreeObject):
"""Class representing the Address model"""

URL = 'company/address/'
REQUIRED_API_VERSION = 126


class Company(inventree.base.ImageMixin, inventree.base.MetadataMixin, inventree.base.InventreeObject):
""" Class representing the Company database model """

Expand All @@ -25,6 +32,11 @@ def getContacts(self, **kwargs):
kwargs['company'] = self.pk
return Contact.list(self._api, **kwargs)

def getAddresses(self, **kwargs):
"""Return addresses associated with this Company"""
kwargs['company'] = self.pk
return Address.list(self._api, **kwargs)

def getSuppliedParts(self, **kwargs):
"""
Return list of SupplierPart objects supplied by this Company
Expand Down

0 comments on commit 4a8433e

Please sign in to comment.