Skip to content

Instantly share code, notes, and snippets.

@ecarreras
Created September 12, 2012 07:35
Show Gist options
  • Save ecarreras/3704978 to your computer and use it in GitHub Desktop.
Save ecarreras/3704978 to your computer and use it in GitHub Desktop.
Eliminem duplicats quan s'ha apretat més d'una vegada el botó
fids = O.AccountInvoice.search([('date_invoice', '=', '2012-08-31']))
delete = []
done = []
for factura in O.AccountInvoice.read(fids, ['name']):
if factura['name'] in done:
delete.append(factura['id'])
else:
done.append(factura['name'])
O.AccountInvoice.unlink(delete)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment