xero-python icon indicating copy to clipboard operation
xero-python copied to clipboard

accounting_api.get_invoice & get_invoices return credit notes without allocations

Open ton77v opened this issue 8 months ago • 2 comments

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

ton77v avatar Apr 10 '25 06:04 ton77v