Invoice billing_address and shipping_address are empty when using custom button

Invoice billing_address and shipping_address are empty when using custom button

I have created a custom button in books for invoices, and there is the parameter invoice as map.

However, the billing and shipping adresses are empty when executing:

info invoice.get("billing_address");
info invoice.get("shipping_address");

Output:
{"zip":"","country":"","address":"","city":"","phone":"","attention":"","street2":"","state":"","fax":""}
{"zip":"","country":"","address":"","city":"","phone":"","attention":"","street2":"","state":"","fax":""}

However, if I do this inside a custom function with the same invoice id, the adresses are not empy!

Is this an intentional behaviour or is this a bug?