Skip to content

accounting_api.get_invoice & get_invoices return credit notes without allocations #183

@ton77v

Description

@ton77v

Even for the invoices with actually allocated CNs with amount_credited

To reproduce, let's use Demo Company and e.g. Invoice INV-0005 for Hamilton Smith Ltd paid with Credit Note CN-0015:

from xero_python.accounting import AccountingApi


XERO_TENANT_ID = ...  # use your credentials
accounting_api = AccountingApi(...)  # ...

resp = accounting_api.get_invoices(  # or .get_invoice by ID, whatever
	xero_tenant_id=XERO_TENANT_ID, invoice_numbers=["INV-0005"]
)
invoice = resp.invoices[0]
cn = invoice.credit_notes[0]
print(cn.allocations)  # None

res = accounting_api.get_credit_note(
	xero_tenant_id=XERO_TENANT_ID,
	credit_note_id=cn.credit_note_id,
)
cn_full = res.credit_notes[0]
print(f"{len(cn_full.allocations)=}")  # len(cn_full.allocations)=1

version 7.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions