Skip to content

Is there an easy way to create an customer/invoice via this project? #38

Description

@Ryang20718

I see there's classes such as Customer, Invoice which I presume are created for common use cases.

Say my goal is to programmatically create a customer/invoice, is there a quickstart guide for doing so?

I.e once I'm authed with QB desktop, is there a way to create a customer and send that request to the webconnector to process?
either via raw xml or a model?

If yall could post a short snippet on either this README example https://github.com/weltlink/django-quickbooks#implementation

or provide guidance on how I would add this customer to the QBD Task queue, that would be greatly appreciated!
Trying to understand what the django_quickbooks.services is used for....

from django_quickbooks.objects import BillAddress, ShipAddress, Customer
from django_quickbooks.services.customer import CustomerService
from lxml import etree

customer_xml = """<?xml version="1.0"?><?qbxml version="13.0"?>
<QBXML>
    <QBXMLMsgsRq onError="stopOnError">
        <CustomerAddRq>
            <CustomerAdd>
                <Name>Amazon</Name>
                <FullName>Amazon</FullName>
                <IsActive>true</IsActive>
                <CompanyName>Amazon</CompanyName>
                <BillAddress>
                    <Addr1>2305 Litton Ln</Addr1>
                    <City>Hebron</City>
                    <State>Kentucky</State>
                    <PostalCode>41048</PostalCode>
                    <Country>United States</Country>
                    <Note>Nice address</Note>
                </BillAddress>
                <ShipAddress>
                    <Addr1>2305 Litton Ln</Addr1>
                    <City>Hebron</City>
                    <State>Kentucky</State>
                    <PostalCode>41048</PostalCode>
                    <Country>United States</Country>
                    <Note>Nice address</Note>
                </ShipAddress>
                <Phone>998909090909</Phone>
                <AltPhone>998909090910</AltPhone>
                <Fax>998909090911</Fax>
                <Email>info@amazon.com</Email>
                <Contact>Someone from Amazon</Contact>
                <AltContact>Some other one from Amazon</AltContact>
            </CustomerAdd>
        </CustomerAddRq>
    </QBXMLMsgsRq>
</QBXML>"""

root_lxml = etree.fromstring(customer_xml)
customer = Customer.from_lxml(root_lxml)
cs = CustomerService()
cs.add(customer)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions