odoo/odoo · error · UserError

Oops! You can only change the period or account for items th

Error message

Oops! You can only change the period or account for items that are not yet reconciled! Other ones aren't up for an adventure like that!

What it means

Guard in the automatic-entry wizard's default_get (addons/account/wizard/account_automatic_entry_wizard.py:150): none of the selected journal items may be reconciled. Reversing the period of a reconciled line would break the reconciliation link and the reported balances, so the wizard requires unreconciled lines.

Source

Thrown at addons/account/wizard/account_automatic_entry_wizard.py:150

                        "The date selected is protected by: %(lock_date_info)s.",
                        lock_date_info=self.env['res.company']._format_lock_dates(violated_lock_dates)
                    ))

    @api.model
    def default_get(self, fields):
        res = super().default_get(fields)
        if not set(fields) & set(['move_line_ids', 'company_id']):
            return res

        if self.env.context.get('active_model') != 'account.move.line' or not self.env.context.get('active_ids'):
            raise UserError(_('This can only be used on journal items'))
        move_line_ids = self.env['account.move.line'].browse(self.env.context['active_ids'])
        res['move_line_ids'] = [(6, 0, move_line_ids.ids)]

        if any(move.state != 'posted' for move in move_line_ids.mapped('move_id')):
            raise UserError(_("Oops! You can only change the period or account for posted entries! Other ones aren't up for an adventure like that!"))
        if any(move_line.reconciled for move_line in move_line_ids):
            raise UserError(_("Oops! You can only change the period or account for items that are not yet reconciled! Other ones aren't up for an adventure like that!"))
        if any(line.company_id.root_id != move_line_ids[0].company_id.root_id for line in move_line_ids):
            raise UserError(_('You cannot use this wizard on journal entries belonging to different companies.'))
        res['company_id'] = move_line_ids[0].company_id.root_id.id

        allowed_actions = set(dict(self._fields['action'].selection))
        if self.env.context.get('default_action'):
            allowed_actions = {self.env.context['default_action']}
        if any(line.account_id.account_type != move_line_ids[0].account_id.account_type for line in move_line_ids):
            allowed_actions.discard('change_period')
        if not allowed_actions:
            raise UserError(_('No possible action found with the selected lines.'))
        res['action'] = allowed_actions.pop()
        return res

    def _get_cut_off_label_format(self):
        """ Get the translated format string used in cut-off labels """
        self.ensure_one()
        return _("Cut-off {label}") if self.percentage == 100 else _("Cut-off {label} {percent}%")

View on GitHub (pinned to 1e661df964)

Solutions

  1. Unreconcile the concerned lines first (reset reconciliation), run the wizard, then re-reconcile.
  2. Select only lines that have no reconciliation (filter on reconciled = False).
  3. For paid items, post manual adjustment entries instead of re-perioding the original line.

Example fix

# before
# selection includes reconciled lines -> UserError

# after
open_lines = lines.filtered(lambda l: not l.reconciled)
            wizard = self.env['account.automatic.entry.wizard'].with_context(
                active_model='account.move.line', active_ids=open_lines.ids).create({})
Defensive patterns

Strategy: validation

Validate before calling

if any(l.reconciled for l in move_line_ids):
    move_line_ids = move_line_ids.filtered(lambda l: not l.reconciled)

Prevention

When it happens

Trigger: Opening the wizard on account.move.line records where any line has reconciled=True (linked via full/partial reconciliation), e.g. a paid invoice line or a matched bank statement line.

Common situations: Accrual/cut-off attempts on customer invoices already paid; selections including bank-reconciled statement lines; year-end cleanups on closed items.

Related errors


AI-assisted analysis of odoo/odoo@1e661df964 (2026-08-15). Data as JSON: /api/errors/dd7bcf9ec002d57d. Report an issue: GitHub.