Skip to content

Instantly share code, notes, and snippets.

@mrvdb
Last active August 29, 2015 14:23
Show Gist options
  • Save mrvdb/75b583c649c34bee02bb to your computer and use it in GitHub Desktop.
Save mrvdb/75b583c649c34bee02bb to your computer and use it in GitHub Desktop.
SELECT xmlroot (
xmlelement(
name "address-book",
xmlattributes ('ODOO addresses' as name),
xmlagg(person)),
version '1.0',
standalone YES)
FROM (
SELECT xmlelement(
name person,
xmlattributes(id as uid, name as "nick-name", name as cn),
xmlelement(
name "address-list",
xmlelement(
name "address",
xmlattributes(id||'-1' as uid, email as email))
)) as person
FROM res_partner
WHERE email IS NOT NULL AND
is_company = False AND
active = True ) as people
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment