Skip to content

Instantly share code, notes, and snippets.

@umiphos
Created February 21, 2019 06:00
Show Gist options
  • Save umiphos/6be5abb187cc376c8b63bdff7379f952 to your computer and use it in GitHub Desktop.
Save umiphos/6be5abb187cc376c8b63bdff7379f952 to your computer and use it in GitHub Desktop.
This gist will fix fix the account_id from a bad placed account in a move.
right_journal = env.ref('absa.account_journal_B2353')
bad_account = env.ref('absa.account_account_102_01_016')
for rec in records:
move_id = rec.mapped('move_id')
move_id.button_cancel()
for line in move_id.line_ids:
if line.journal_id == right_journal and line.account_id == bad_account:
line.write({'account_id':
right_journal.default_debit_account_id.id})
move_id.action_post()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment