Example #1
0
class PostalAddress(xml_models.Model):
    """ Postal Address Entity """

    street = xml_models.CharField(xpath="/postalAddress/street")
    city = xml_models.CharField(xpath="/postalAddress/city")
    postCode = xml_models.CharField(xpath="/postalAddress/postCode")
    state = xml_models.CharField(xpath="/postalAddress/state")
    country = xml_models.CharField(xpath="/postalAddress/country")
Example #2
0
class ServiceInvoiceItem(BaseModel):
    """ Service Invoice Item Entity """

    __model__ = 'ServiceInvoiceItem'
    template_name = 'saasu_client/serviceinvoiceitem_model.xml'

    # Description of service invoice line item. Use pipe (|) character to indicate new line.
    description = xml_models.CharField(xpath="/serviceInvoiceItem/description") 
    # The Account for this line item.
    accountUid = xml_models.IntField(xpath="/serviceInvoiceItem/accountUid") 
    # Must be one of the tax codes in your file. Invalid tax code will be ignored.
    taxCode = xml_models.CharField(xpath="/serviceInvoiceItem/taxCode") 
    # The total amount (tax inclusive) for this line item. Positive, negative, and 0 are accepted. Maximum 2 decimals.
    totalAmountInclTax = xml_models.FloatField(xpath="/serviceInvoiceItem/totalAmountInclTax", default=0) 
Example #3
0
        class Group(xml_models.Model):
            name = xml_models.CharField(xpath="/entry/@name")
            subgroups = xml_models.CollectionField(SubGroup,
                                                   xpath="/entry/subgroups")

            collection_node = 'groups'
            finders = {(): 'http://example.com'}
Example #4
0
class TransactionCategoryListItem(xml_models.Model):
    """ Transaction Category List Item Entity """

    uid = xml_models.IntField(
        xpath='/transactionCategoryListItem/transactionCategoryUid', default=0)
    lastUpdatedUid = xml_models.CharField(
        xpath='/transactionCategoryListItem/lastUpdatedUid')
    name = xml_models.CharField(xpath='/transactionCategoryListItem/name')
    # Valid value is one of the following:
    # Income, Expense, Asset, Equity, Liability, Other Income, Other Expense, Cost of Sales
    type = xml_models.CharField(xpath='/transactionCategoryListItem/type')
    isActive = xml_models.BoolField(
        xpath='/transactionCategoryListItem/isActive', default=True)
    # Inbuilt Accounts are system-wide Accounts that are shared across all Files.
    isInbuilt = xml_models.BoolField(
        xpath='/transactionCategoryListItem/isInbuilt', default=True)
Example #5
0
class SimpleModel(xml_models.Model):
    field1 = xml_models.CharField(xpath='/root/field1')

    finders = {
        (field1, ): "http://foo.com/simple/%s",
        ('a', 'b'): "http://foo.com/simple/%s/%s"
    }

    headers = {'user': '******', 'password': '******'}
Example #6
0
class ItemInvoiceItem(BaseModel):
    """ Item Invoice Item Entity """

    __model__ = 'ItemInvoiceItem'
    template_name = 'saasu_client/iteminvoiceitem_model.xml'

    # The quantity. Maximum 3 decimals.
    quantity = xml_models.FloatField(xpath="/itemInvoiceItem/quantity", default=0)
    # The inventory item for this invoice line item. This also covers
    # combo item. For combo item, use combo item uid.
    inventoryItemUid = xml_models.IntField(xpath="/itemInvoiceItem/inventoryItemUid", default=0) 
    # Description of service invoice line item. Use pipe (|) character to indicate new line.
    description = xml_models.CharField(xpath="/itemInvoiceItem/description") 
    # Must be one of the tax codes in your file. Invalid tax code will be ignored.
    taxCode = xml_models.CharField(xpath="/itemInvoiceItem/taxCode") 
    # Unit price of inventory item.
    unitPriceInclTax = xml_models.FloatField(xpath="/itemInvoiceItem/unitPriceInclTax", default=0) 
    # Percentage discount. E.g. for 10% off the unit price is set the value to 10.
    # Valid values: between 0 and 100.  Maximum 2 decimals.
    percentageDiscount = xml_models.IntField(xpath="/itemInvoiceItem/percentageDiscount", default=0) 
Example #7
0
class TransactionCategory(xml_models.Model):
    """ Transaction Category Entity """

    __model__ = 'TransactionCategory'

    uid = xml_models.IntField(
        xpath='/transactionCategoryResponse/transactionCategory/@uid',
        default=0)
    lastUpdatedUid = xml_models.CharField(
        xpath='/transactionCategoryResponse/transactionCategory/@lastUpdatedUid'
    )
    name = xml_models.CharField(
        xpath='/transactionCategoryResponse/transactionCategory/name')
    # Valid value is one of the following:
    # Income, Expense, Asset, Equity, Liability, Other Income, Other Expense, Cost of Sales
    type = xml_models.CharField(
        xpath='/transactionCategoryResponse/transactionCategory/type')
    isActive = xml_models.BoolField(
        xpath='/transactionCategoryResponse/transactionCategory/isActive',
        default=True)

    finders = {
        (uid, ): DEFAULT_GET_URL % __model__ + "&uid=%s",
    }
Example #8
0
    def register(self):
        """ put docstring here """

        # If object already have 'uid' field update entry otherwise insert new
        if hasattr(self.object, 'uid') and self.object.uid:
            cmd = 'update'
        else:
            cmd = 'insert'

        # autogenerated fields
        uid = xml_models.IntField(xpath="/tasksResponse/%s%sResult/@%s" %
                                  (cmd, self.__model__, {
                                      'insert': 'insertedEntityUid',
                                      'update': 'updatedEntityUid'
                                  }[cmd]),
                                  default=None)
        lastUpdatedUid = xml_models.CharField(
            xpath="/tasksResponse/%s%sResult/@lastUpdatedUid" %
            (cmd, self.__model__))
        errors = xml_models.Collection(
            Error,
            order_by="error_type",
            xpath="/tasksResponse/%s%sResult/errors/error" %
            (cmd, self.__model__))
        other_errors = xml_models.Collection(
            Error, order_by="error_type", xpath="/tasksResponse/errors/error")

        def validate_on_load(cls):
            for e in cls.errors:
                exception = classobj(str(e.error_type), (Exception, ), {})
                raise exception, e.error_message
            for e in cls.other_errors:
                exception = classobj(str(e.error_type), (Exception, ), {})
                raise exception, e.error_message

        # autogenerated class
        cls = classobj(
            'POSTResponse', (xml_models.Model, ), {
                'uid': uid,
                'lastUpdatedUid': lastUpdatedUid,
                'errors': errors,
                'other_errors': other_errors,
                'validate_on_load': validate_on_load,
            })
        #print self.xml
        return cls(xml=self.xml, dom=self.dom)
Example #9
0
class TransactionCategoryList(BaseModel):
    """ List of Transaction Categories """

    __model__ = 'TransactionCategoryList'

    items = CollectionField(
        TransactionCategoryListItem,
        xpath=
        '/transactionCategoryListResponse/transactionCategoryList/transactionCategoryListItem'
    )

    # Valid value is one of the following:
    # Income, Expense, Asset, Equity, Liability, Other Income, Other Expense, Cost of Sales
    type = xml_models.CharField(
        xpath=
        '/transactionCategoryListResponse/transactionCategoryList/transactionCategoryListItem/type'
    )
    isActive = xml_models.BoolField(
        xpath=
        '/transactionCategoryListResponse/transactionCategoryList/transactionCategoryListItem/isActive',
        default=True)
    # Inbuilt Accounts are system-wide Accounts that are shared across all Files.
    isInbuilt = xml_models.BoolField(
        xpath=
        '/transactionCategoryListResponse/transactionCategoryList/transactionCategoryListItem/isInbuilt',
        default=True)

    finders = {
        (type, ): DEFAULT_GET_URL % __model__ + "&type=%s",
        (isActive, ): DEFAULT_GET_URL % __model__ + "&isActive=%s",
        (isActive, type): DEFAULT_GET_URL % __model__ + "&isActive=%s&type=%s",
        (isInbuilt, ): DEFAULT_GET_URL % __model__ + "&isInbuilt=%s",
    }

    def __len__(self):
        return len(self.items)

    def __iter__(self):
        return self.items.__iter__()
Example #10
0
class SimpleWithoutFinder(xml_models.Model):
    field1 = xml_models.CharField(xpath='/root/field1')
Example #11
0
class NsModel(xml_models.Model):
    namespace = 'urn:test:namespace'
    name = xml_models.CharField(xpath='/root/name')
    age = xml_models.IntField(xpath='/root/age')
Example #12
0
 class SubModel(xml_models.Model):
     name = xml_models.CharField(xpath='/sub/name')
Example #13
0
class NestedModel(xml_models.Model):
    field1 = xml_models.CharField(xpath='/root/field1')
    collection_node = 'elems'
    finders = {
        (field1, ): "http://foo.com/simple/%s",
    }
Example #14
0
class Muppet(xml_models.Model):
    name = xml_models.CharField(xpath='/root/kiddie/value')
    friends = xml_models.CollectionField(xml_models.CharField,
                                         xpath='/root/kiddie/friends/friend')

    finders = {(name, ): "http://foo.com/muppets/%s"}
Example #15
0
 class SubGroup(xml_models.Model):
     name = xml_models.CharField(xpath="/entry/@name")
Example #16
0
class ModelC(xml_models.Model):
    name = xml_models.CharField(xpath='/root/name')
    modelb = xml_models.CollectionField(ModelB, xpath='/root/modelbs/modelb')
Example #17
0
class ListModel(xml_models.Model):
    address = xml_models.CharField(xpath='/entry/address')
    country = xml_models.CharField(xpath='/entry/country')
Example #18
0
class InventoryItem(BaseModel):
    """ Inventory Item Entity """

    __model__ = 'InventoryItem'

    # Required for update.
    uid = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/@uid", default=0)
    # Required for update.
    lastUpdatedUid = xml_models.CharField(
        xpath="/inventoryItemResponse/inventoryItem/@lastUpdatedUid")
    # Inventory item code. Must be unique.
    code = xml_models.CharField(
        xpath="/inventoryItemResponse/inventoryItem/code")
    # Inventory item description.
    # Multi-line description is supported. Use the pipe (|) to indicate newline.
    description = xml_models.CharField(
        xpath="/inventoryItemResponse/inventoryItem/description")
    # Default: True
    isActive = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isActive", default=True)
    notes = xml_models.CharField(
        xpath="/inventoryItemResponse/inventoryItem/notes")
    isInventoried = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isInventoried",
        default=False)

    # Required only if IsInventoried is set to true. Accounts used must be of type Asset.
    assetAccountUid = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/assetAccountUid",
        default=0)
    # How many stocks on hand? This element is only used when you retrieve an Inventory Item from your File.
    # This value is ignored on insert and update.
    stockOnHand = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/stockOnHand", default=0)
    # Current stock value. This element is only used when you retrieve an Inventory Item from your File.
    # This value is ignored on insert and update.
    currentValue = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/currentValue", default=0)
    # Specifies if this item can be bought or not. Default: false (cannot be bought).
    isBought = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isBought", default=False)
    # Expense Account for tracking purchase.
    # Required only if the Inventory Item is not inventoried and item can be bought (isInventoried == false && isBought == true).
    # Accounts used must be of type Expense.
    purchaseExpenseAccountUid = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/purchaseExpenseAccountUid",
        default=0)
    # Default tax code when the inventory item is purchased.
    purchaseTaxCode = xml_models.CharField(
        xpath="/inventoryItemResponse/inventoryItem/purchaseTaxCode")
    # Minimum stock level used for re-stocking alert report.
    minimumStockLevel = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/minimumStockLevel",
        default=0)

    # The primary supplier for this Inventory Item.
    primarySupplierContactUid = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/primarySupplierContactUid",
        default=0)
    # The primary supplier’s item code for this Inventory Item.
    primarySupplierItemCode = xml_models.CharField(
        xpath="/inventoryItemResponse/inventoryItem/primarySupplierItemCode")
    # Default re-order quantity for re-stocking alert report.
    defaultReOrderQuantity = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/defaultReOrderQuantity",
        default=0)
    # Default buying price for the item. Only applicable if the Inventory Item is marked as bought.
    buyingPrice = xml_models.FloatField(
        xpath="/inventoryItemResponse/inventoryItem/buyingPrice", default=0)
    # A flag specifying whether the buying price includes/excludes tax.
    isBuyingPriceIncTax = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isBuyingPriceIncTax",
        default=True)
    # Specifies whether the Inventory Item can be sold or not. Default: false (cannot be sold).
    isSold = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isSold", default=True)
    # Account for tracking sales. Only required if the item can be sold (isSold == true). Accounts used must be of type Income.
    saleIncomeAccountUid = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/saleIncomeAccountUid",
        default=0)
    # Default tax code for sale.
    saleTaxCode = xml_models.CharField(
        xpath="/inventoryItemResponse/inventoryItem/saleTaxCode")
    # Accounts for tracking cost of sales. Required only if Inventory Item is inventoried & for sale.
    # Accounts used must be of type Cost of Sales.
    saleCoSAccountUid = xml_models.IntField(
        xpath="/inventoryItemResponse/inventoryItem/saleCoSAccountUid",
        default=0)
    # The default selling price for this Inventory Item. Only applicable if the Inventory Item is marked as sold.
    sellingPrice = xml_models.FloatField(
        xpath="/inventoryItemResponse/inventoryItem/sellingPrice", default=0)
    isSellingPriceIncTax = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isSellingPriceIncTax",
        default=True)

    # A flag that indicates this is an item you sell, that you haven’t bought or assembled as stock to make available for sale.
    isVirtual = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isVirtual", default=True)
    # The type if this item is marked as virtual.
    vType = xml_models.CharField(
        xpath="/inventoryItemResponse/inventoryItem/vType")
    # A flag to set the Item to visible, for an example this can be
    # used in your database so that Item is flagged to be displayed in your ecommerce product listings.
    isVisible = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isVisisble", default=False)
    # A flag specifying whether this item is treated as a voucher.
    isVoucher = xml_models.BoolField(
        xpath="/inventoryItemResponse/inventoryItem/isVoucher", default=False)

    # When the voucher becomes effective.
    validFrom = xml_models.DateField(
        xpath="/inventoryItemResponse/inventoryItem/validFrom",
        date_format="%Y-%m-%d")
    # When the voucher expires.
    validTo = xml_models.DateField(
        xpath="/inventoryItemResponse/inventoryItem/validTo",
        date_format="%Y-%m-%d")

    finders = {
        (uid, ): DEFAULT_GET_URL % __model__ + "&uid=%s",
    }
Example #19
0
class Error(xml_models.Model):
    """ Error Message Entity """

    error_type = xml_models.CharField(xpath="/error/type")
    error_message = xml_models.CharField(xpath="/error/message")
Example #20
0
    def test_uses_base(self, mock_base):
        field = xml_models.CharField(xpath='/root/kiddie/int')
        response = field.parse(XML, None)

        self.assertTrue(mock_base.called)
Example #21
0
class ServiceInvoice(BaseModel):
    """ Service Invoice Entity """

    __model__ = 'Invoice'
    template_name = 'saasu_client/serviceinvoice_model.xml'

    uid = xml_models.IntField(xpath="/invoiceResponse/invoice/@uid", default=0) 
    lastUpdatedUid = xml_models.CharField(xpath="/invoiceResponse/invoice/@lastUpdatedUid")
    # Either S for Sale or P for Purchase.
    transactionType = xml_models.CharField(xpath="/invoiceResponse/invoice/transactionType", default="S")
    # The invoice date.
    date = xml_models.DateField(xpath="/invoiceResponse/invoice/date", date_format="%Y-%m-%d") 
    # The contact for this invoice. 0 means no contact.
    contactUid = xml_models.IntField(xpath="/invoiceResponse/invoice/contactUid", default=0) 
    # The shipping contact for this invoice. Not specifying or 0 means no shipping contact.
    shipToContactUid = xml_models.IntField(xpath="/invoiceResponse/invoice/shipToContactUid", default=0) 
    # Separate multiple tags by comma. Max length for each tag is 35 characters.
    tags = xml_models.CharField(xpath="/invoiceResponse/invoice/tags", default='')
    # Don’t set this value in invoice because this field is not accessible from the UI.
    reference = xml_models.CharField(xpath="/invoiceResponse/invoice/reference", default='')
    # Brief summary of the invoice
    summary = xml_models.CharField(xpath="/invoiceResponse/invoice/summary", default='')
    # The currency of the particular invoice transaction.
    ccy = xml_models.CharField(xpath="/invoiceResponse/invoice/ccy", default='')
    # Indicates whether the FX rate for the invoice was set automatically.
    autoPopulateFxRate = xml_models.BoolField(xpath="/invoiceResponse/invoice/autoPopulateFxRate", default=False) 

    # The Foreign Currency(FC) to Base Currency(BC) FX Rate. If you are setting the FX rate manually, and only have the BC to FC FX
    # rate, then you should calculate the fcToBcFxRate for posting the transaction. For an example, if your base currency is AUD and 1
    # AUD = 0.89 USD, get the inverse by 1/0.89. So your fcToBcFxRate = 1.1235.
    fcToBcFxRate = xml_models.FloatField(xpath="/invoiceResponse/invoice/fcToBcFxRate", default=0) 
    notes = xml_models.CharField(xpath="/invoiceResponse/invoice/notes", default='')
    # Notes to be displayed on pdf.
    externalNotes = xml_models.CharField(xpath="/invoiceResponse/invoice/externalNotes", default='')
    requiresFollowUp = xml_models.BoolField(xpath="/invoiceResponse/invoice/requiresFollowUp", default=False) 
    # Invoice and/or order due date or quote expiry date.
    dueOrExpiryDate = xml_models.DateField(xpath="/invoiceResponse/invoice/dueOrExpiryDate", date_format="%Y-%m-%d") 

    # The invoice layout. Either S (Service) or I (Item)
    layout = xml_models.CharField(xpath="/invoiceResponse/invoice/layout", default='S')
    # Invoice status. Either Q (Quote), O (Order) or I (Invoice).
    status = xml_models.CharField(xpath="/invoiceResponse/invoice/status", default='I')
    # The sale invoice number. When inserting a sale, set to <Auto Number> to let the system generates the invoice number based on the preferences you set.
    invoiceNumber = xml_models.CharField(xpath="/invoiceResponse/invoice/invoiceNumber", default='')
    # The purchase order number (PO #). When inserting a purchase, set to <Auto Number> to let the system generates the PO# based on the preferences you set.
    purchaseOrderNumber = xml_models.CharField(xpath="/invoiceResponse/invoice/purchaseOrderNumber", default='')

    # TODO: Complete this part
    # quickPayment	 	 	 	Payment to be applied to this invoice.
    # payments	 	 	 	   All payments associated with this particular invoice, if incpayments is set to ‘true’ in the query string.

    # Indicates if the invoice has been sent/emailed to contact. This flag will be set to true automatically if the Invoice is sent successfully through the WSAPI.
    isSent = xml_models.BoolField(xpath="/invoiceResponse/invoice/isSent", default=False) 

    # You can include unlimited number of invoice items. For service invoice, use <ServiceInvoiceItem>?
    # For item invoice: use <ItemInvoiceItem>. You cannot mix the content of invoice items (i.e. having both <ServiceInvoiceItem> and <ItemInvoiceItem>).
    invoiceItems = CollectionField(ServiceInvoiceItem, xpath='/invoiceResponse/invoice/invoiceItems/serviceInvoiceItem')	 	 	 

    finders = {
        ('uid',): DEFAULT_GET_URL % __model__ + "&uid=%s",
        }
Example #22
0
        class Group(xml_models.Model):
            name = xml_models.CharField(xpath="/entry/@name")

            collection_xpath = '/groups/entry/subgroups/entry'
            finders = {(): 'http://example.com'}
Example #23
0
class Contact(BaseModel):
    """ Contact Entity """

    __model__ = 'Contact'
    template_name = 'saasu_client/contact_model.xml'

    uid = xml_models.IntField(xpath="/contactResponse/contact/@uid", default=0)
    lastUpdatedUid = xml_models.CharField(
        xpath="/contactResponse/contact/@lastUpdatedUid")
    # A.K.A "Title" values; Mr., Mrs., Ms., Dr., Prof.
    salutation = xml_models.CharField(
        xpath="/contactResponse/contact/salutation")
    # A.K.A "First Name".
    givenName = xml_models.CharField(
        xpath="/contactResponse/contact/givenName")
    # A.K.A. "Initial".
    middleInitials = xml_models.CharField(
        xpath="/contactResponse/contact/middleInitials")
    # A.K.A "Last Name".
    familyName = xml_models.CharField(
        xpath="/contactResponse/contact/familyName")
    # A.K.A. "Company".
    organizationName = xml_models.CharField(
        xpath="/contactResponse/contact/organizationName")
    # A.K.A. "Business Number".
    organizationAbn = xml_models.CharField(
        xpath="/contactResponse/contact/organizationAbn")
    # The organisation/company website url.
    organizationWebsite = xml_models.CharField(
        xpath="/contactResponse/contact/organizationWebsite")
    organizationPosition = xml_models.CharField(
        xpath="/contactResponse/contact/organizationPosition")

    # This is your own contact ID, different to Saasu's Contact Uid.
    contactID = xml_models.CharField(
        xpath="/contactResponse/contact/contactID")
    websiteUrl = xml_models.CharField(
        xpath="/contactResponse/contact/websiteUrl")
    email = xml_models.CharField(xpath="/contactResponse/contact/email")
    mainPhone = xml_models.CharField(
        xpath="/contactResponse/contact/mainPhone")
    homePhone = xml_models.CharField(
        xpath="/contactResponse/contact/homePhone")
    fax = xml_models.CharField(xpath="/contactResponse/contact/fax")
    mobilePhone = xml_models.CharField(
        xpath="/contactResponse/contact/mobilePhone")
    otherPhone = xml_models.CharField(
        xpath="/contactResponse/contact/otherPhone")
    # Separate multiple tags by comma. Max. length per tag is 35 characters.
    tags = xml_models.CharField(xpath="/contactResponse/contact/tags")

    postalAddress = xml_models.OneToOneField(
        PostalAddress, xpath='/contactResponse/contact/postalAddress')
    otherAddress = xml_models.OneToOneField(
        PostalAddress, xpath='/contactResponse/contact/postalAddress')

    # Default: True
    isActive = xml_models.BoolField(xpath="/contactResponse/contact/isActive",
                                    default=True)

    acceptDirectDeposit = xml_models.BoolField(
        xpath="/contactResponse/contact/acceptDirectDeposit")
    directDepositAccountName = xml_models.CharField(
        xpath="/contactResponse/contact/directDepositAccountName")
    directDepositBsb = xml_models.CharField(
        xpath="/contactResponse/contact/directDepositBsb")
    directDepositAccountNumber = xml_models.CharField(
        xpath="/contactResponse/contact/directDepositAccountNumber")

    acceptCheque = xml_models.BoolField(
        xpath="/contactResponse/contact/acceptCheque")
    chequePayableTo = xml_models.CharField(
        xpath="/contactResponse/contact/chequePayableTo")

    customField1 = xml_models.CharField(
        xpath="/contactResponse/contact/customField1")
    customField2 = xml_models.CharField(
        xpath="/contactResponse/contact/customField2")

    twitterID = xml_models.CharField(
        xpath="/contactResponse/contact/twitterID")
    skypeID = xml_models.CharField(xpath="/contactResponse/contact/skypeID")

    finders = {
        (uid, ): DEFAULT_GET_URL % __model__ + "&uid=%s",
    }
Example #24
0
class ContactListItem(xml_models.Model):
    """ Contact List Item Entity """

    contactUid = xml_models.IntField(xpath="/contactListItem/contactUid")
    utcFirstCreated = xml_models.CharField(
        xpath="/contactListItem/utcFirstCreated")
    utcLastModified = xml_models.CharField(
        xpath="/contactListItem/utcLastModified")
    lastUpdatedUid = xml_models.CharField(
        xpath="/contactListItem/lastUpdatedUid")
    salutation = xml_models.CharField(xpath="/contactListItem/salutation")
    givenName = xml_models.CharField(xpath="/contactListItem/givenName")
    middleInitials = xml_models.CharField(
        xpath="/contactListItem/middleInitials")
    familyName = xml_models.CharField(xpath="/contactListItem/familyName")
    dateOfBirth = xml_models.DateField(xpath="/contactListItem/dateOfBirth",
                                       date_format="%Y-%m-%d")

    organisation = xml_models.CharField(xpath="/contactListItem/organisation")
    organisationName = xml_models.CharField(
        xpath="/contactListItem/organisationName")
    organisationAbn = xml_models.CharField(
        xpath="/contactListItem/organisationAbn")
    abn = xml_models.CharField(xpath="/contactListItem/abn")

    organizationWebsite = xml_models.CharField(
        xpath="/contactListItem/organizationWebsite")
    organizationPosition = xml_models.CharField(
        xpath="/contactListItem/organizationPosition")
    emailAddress = xml_models.CharField(xpath="/contactListItem/emailAddress")
    websiteUrl = xml_models.CharField(xpath="/contactListItem/websiteUrl")
    isActive = xml_models.BoolField(xpath="/contactListItem/isActive",
                                    default=True)

    mainPhone = xml_models.CharField(xpath="/contactListItem/mainPhone")
    homePhone = xml_models.CharField(xpath="/contactListItem/homePhone")
    mobilePhone = xml_models.CharField(xpath="/contactListItem/mobilePhone")
    otherPhone = xml_models.CharField(xpath="/contactListItem/otherPhone")
    fax = xml_models.CharField(xpath="/contactListItem/fax")

    street = xml_models.CharField(xpath="/contactListItem/street")
    city = xml_models.CharField(xpath="/contactListItem/city")
    state = xml_models.CharField(xpath="/contactListItem/state")
    postCode = xml_models.CharField(xpath="/contactListItem/postCode")
    country = xml_models.CharField(xpath="/contactListItem/country")

    otherStreet = xml_models.CharField(xpath="/contactListItem/otherStreet")
    otherCity = xml_models.CharField(xpath="/contactListItem/otherCity")
    otherState = xml_models.CharField(xpath="/contactListItem/otherState")
    otherPostCode = xml_models.CharField(
        xpath="/contactListItem/otherPostCode")

    contactID = xml_models.CharField(xpath="/contactListItem/contactID")

    acceptDirectDeposit = xml_models.BoolField(
        xpath="/contactListItem/acceptDirectDeposit")
    directDepositAccountName = xml_models.CharField(
        xpath="/contactListItem/directDepositAccountName")
    directDepositBsb = xml_models.CharField(
        xpath="/contactListItem/directDepositBsb")
    directDepositAccountNumber = xml_models.CharField(
        xpath="/contactListItem/directDepositAccountNumber")

    acceptCheque = xml_models.BoolField(xpath="/contactListItem/acceptCheque")
    chequePayableTo = xml_models.CharField(
        xpath="/contactListItem/chequePayableTo")

    # Separate multiple tags by comma. Max. length per tag is 35 characters.
    tags = xml_models.CharField(xpath="/contactListItem/tags")

    customField1 = xml_models.CharField(xpath="/contactListItem/customField1")
    customField2 = xml_models.CharField(xpath="/contactListItem/customField2")
Example #25
0
 def test_may_have_a_default(self):
     field = xml_models.CharField(xpath='/root/kiddie/int2', default=-1)
     response = field.parse(XML, None)
     self.assertEquals(-1, response)
Example #26
0
class ModelB(xml_models.Model):
    name = xml_models.CharField(xpath='/modelb/name')
Example #27
0
class InventoryListItem(xml_models.Model):
    """ Inventory List Item Entity """

    uid = xml_models.IntField(xpath="/inventoryItem/@uid", default=0)
    lastUpdatedUid = xml_models.CharField(
        xpath="/inventoryItem/@lastUpdatedUid")
    utcFirstCreated = xml_models.CharField(
        xpath="/inventoryItem/utcFirstCreated")
    utcLastModified = xml_models.CharField(
        xpath="/inventoryItem/utcLastModified")

    code = xml_models.CharField(xpath="/inventoryItem/code")
    description = xml_models.CharField(xpath="/inventoryItem/description")
    isActive = xml_models.BoolField(xpath="/inventoryItem/isActive",
                                    default=True)
    isInventoried = xml_models.BoolField(xpath="/inventoryItem/isInventoried",
                                         default=False)

    assetAccountUid = xml_models.IntField(
        xpath="/inventoryItem/assetAccountUid", default=0)
    stockOnHand = xml_models.IntField(xpath="/inventoryItem/stockOnHand",
                                      default=0)
    currentValue = xml_models.IntField(xpath="/inventoryItem/currentValue",
                                       default=0)
    quantityOnOrder = xml_models.IntField(
        xpath="/inventoryItem/quantityOnOrder", default=0)
    quantityCommited = xml_models.IntField(
        xpath="/inventoryItem/quantityCommited", default=0)

    isBought = xml_models.BoolField(xpath="/inventoryItem/isBought",
                                    default=False)

    purchaseExpenseAccountUid = xml_models.IntField(
        xpath="/inventoryItem/purchaseExpenseAccountUid", default=0)
    minimumStockLevel = xml_models.IntField(
        xpath="/inventoryItem/minimumStockLevel", default=0)
    primarySupplierContactUid = xml_models.IntField(
        xpath="/inventoryItem/primarySupplierContactUid", default=0)
    defaultReOrderQuantity = xml_models.IntField(
        xpath="/inventoryItem/defaultReOrderQuantity", default=0)

    isSold = xml_models.BoolField(xpath="/inventoryItem/isSold", default=True)

    saleIncomeAccountUid = xml_models.IntField(
        xpath="/inventoryItem/saleIncomeAccountUid", default=0)
    saleTaxCode = xml_models.CharField(xpath="/inventoryItem/saleTaxCode")
    saleCoSAccountUid = xml_models.IntField(
        xpath="/inventoryItem/saleCoSAccountUid", default=0)
    sellingPrice = xml_models.FloatField(xpath="/inventoryItem/sellingPrice",
                                         default=0)

    isSellingPriceIncTax = xml_models.BoolField(
        xpath="/inventoryItem/isSellingPriceIncTax", default=True)
    buyingPrice = xml_models.FloatField(xpath="/inventoryItem/buyingPrice",
                                        default=0)
    isBuyingPriceIncTax = xml_models.BoolField(
        xpath="/inventoryItem/isBuyingPriceIncTax", default=True)
    isVoucher = xml_models.BoolField(xpath="/inventoryItem/isVoucher",
                                     default=False)

    validFrom = xml_models.DateField(xpath="/inventoryItem/validFrom",
                                     date_format="%Y-%m-%d")
    validTo = xml_models.DateField(xpath="/inventoryItem/validTo",
                                   date_format="%Y-%m-%d")

    isVirtual = xml_models.BoolField(xpath="/inventoryItem/isVirtual",
                                     default=True)
    isVisible = xml_models.BoolField(xpath="/inventoryItem/isVisisble",
                                     default=False)
Example #28
0
class ModelA(xml_models.Model):
    name = xml_models.CharField(xpath='/root/name')
    modelb = xml_models.OneToOneField(ModelB, xpath='/root/modelb')