Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nil pointer exception is thrown if Tax property is not initialized #438

Open
forwardever opened this issue Dec 3, 2024 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@forwardever
Copy link

forwardever commented Dec 3, 2024

nil pointer exception is thrown if Tax property is not initialized

inv := &bill.Invoice{
    Tax: &bill.Tax{},
}

xinvoice.ConvertToXRechnungUBL(env)
github.com/invopop/gobl.ubl@v0.1.0/internal/gtou/gtou.go
line: 52 InvoiceTypeCode: inv.Tax.Ext[untdid.ExtKeyDocumentType].String(),

expected behaviour: should work also without initialization of Tax property

@samlown samlown added the bug Something isn't working label Dec 3, 2024
@samlown
Copy link
Collaborator

samlown commented Dec 3, 2024

Thanks @forwardever! I'm actually working on some changes now to help accessing Extension properties and avoiding panics, so I'll let @apardods know behind the scenes so we can incorporate this asap.

@apardods
Copy link
Contributor

apardods commented Dec 4, 2024

Hi! I have a added a fix in the UBL repo. It now returns an error explaining the document type extension must be present. However, adding the eu-en16931-v2017 addon in the $addons field of the invoice automatically adds that field from the document type, so you would never need to manually set the field! Let me know if you have any questions

@forwardever
Copy link
Author

okay, thank you for the quick response. I will build some xrechnungen in the next couple of days and will let you know if I face any problems and if the suggested solution (addon) works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants