Skip to content

Instantly share code, notes, and snippets.

@nhomar
Created February 14, 2019 05:05
Show Gist options
  • Save nhomar/bc415799b31bd28260bf0bbf6174e399 to your computer and use it in GitHub Desktop.
Save nhomar/bc415799b31bd28260bf0bbf6174e399 to your computer and use it in GitHub Desktop.
# Available variables:
# - env: Odoo Environment on which the action is triggered
# - model: Odoo Model of the record on which the action is triggered; is a void recordset
# - record: record on which the action is triggered; may be void
# - records: recordset of all records on which the action is triggered in multi-mode; may be void
# - time, datetime, dateutil, timezone: useful Python libraries
# - log: log(message, level='info'): logging function to record debug information in ir.logging table
# - Warning: Warning Exception to use with raise
# To return an action, assign: action = {...}
bsl = env['bank.statement.line'].search([('amount_total', '=', record.amount), ('journal_id', '=', record.journal_id.id), ('date', '<=', record.payment_date)])
raise Warning('Found XXXXXXX %s ' % len(bsl))
if bsl and len(bsl) == 1:
bsl.reconcile(record.aml)
else:
record.message_post('No encontre nada con que conciliarme en los bancos consulte a tesorería', )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment