Skip to content

Instantly share code, notes, and snippets.

@name1984
Created November 12, 2024 17:01
Show Gist options
  • Save name1984/9aa386ec127c6f6e2a6a11f2c12b18f1 to your computer and use it in GitHub Desktop.
Save name1984/9aa386ec127c6f6e2a6a11f2c12b18f1 to your computer and use it in GitHub Desktop.
mostrar
apr_ids = apr_obj = env['account.partial.reconcile']
am_obj = env['account.move']
aml_obj = env['account.move.line']
act = {
'name': 'Todos los apuntes de la Facturas + CABA + Pago',
'type': 'ir.actions.act_window',
'res_model': 'account.move.line',
'target': 'current',
'view_mode': 'tree,form,pivot'
}
for aml in records.mapped('line_ids'):
if aml.account_id.reconcile:
apr_ids |= aml.matched_debit_ids | aml.matched_credit_ids
aml_ids = am_obj.search([('tax_cash_basis_rec_id','in', apr_ids.ids)]).mapped('line_ids') if apr_ids else aml_obj
aml_ids |= apr_ids.mapped('debit_move_id')
aml_ids |= apr_ids.mapped('credit_move_id')
aml_ids |= records.mapped('line_ids')
# /!\ NOTE: Repeating again to fetch the FX that could be in the Payment or somewhere else
apr_ids |= aml_ids.mapped('matched_debit_ids') | aml_ids.mapped('matched_credit_ids')
aml_ids |= apr_ids.mapped('debit_move_id')
aml_ids |= apr_ids.mapped('credit_move_id')
aml_ids |= aml_ids.mapped('move_id.line_ids')
act['domain'] = [('id', 'in', aml_ids.ids)]
action = act
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment