BusinessTemplate: make portal type role export stable with > 10 roles

This sort was based on the id of the role definition but this did not
work when the type definition had more than 10 documents, because:

    >>> sorted(['1', '2', '10'])
    ['1', '10', '2']

This switches to an approach of converting the id to integer, with a
fallback in case the id generator is customized.
1 job for master
in 0 seconds, using 0 compute credits, and was queued for 0 seconds