{"record":{"id":"dd7bcf9ec002d57d","repo":"odoo/odoo","slug":"oops-you-can-only-change-the-period-or-account-fo-dd7bcf","errorCode":null,"errorMessage":"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!","messagePattern":"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!","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"addons/account/wizard/account_automatic_entry_wizard.py","lineNumber":150,"sourceCode":"                        \"The date selected is protected by: %(lock_date_info)s.\",\n                        lock_date_info=self.env['res.company']._format_lock_dates(violated_lock_dates)\n                    ))\n\n    @api.model\n    def default_get(self, fields):\n        res = super().default_get(fields)\n        if not set(fields) & set(['move_line_ids', 'company_id']):\n            return res\n\n        if self.env.context.get('active_model') != 'account.move.line' or not self.env.context.get('active_ids'):\n            raise UserError(_('This can only be used on journal items'))\n        move_line_ids = self.env['account.move.line'].browse(self.env.context['active_ids'])\n        res['move_line_ids'] = [(6, 0, move_line_ids.ids)]\n\n        if any(move.state != 'posted' for move in move_line_ids.mapped('move_id')):\n            raise UserError(_(\"Oops! You can only change the period or account for posted entries! Other ones aren't up for an adventure like that!\"))\n        if any(move_line.reconciled for move_line in move_line_ids):\n            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!\"))\n        if any(line.company_id.root_id != move_line_ids[0].company_id.root_id for line in move_line_ids):\n            raise UserError(_('You cannot use this wizard on journal entries belonging to different companies.'))\n        res['company_id'] = move_line_ids[0].company_id.root_id.id\n\n        allowed_actions = set(dict(self._fields['action'].selection))\n        if self.env.context.get('default_action'):\n            allowed_actions = {self.env.context['default_action']}\n        if any(line.account_id.account_type != move_line_ids[0].account_id.account_type for line in move_line_ids):\n            allowed_actions.discard('change_period')\n        if not allowed_actions:\n            raise UserError(_('No possible action found with the selected lines.'))\n        res['action'] = allowed_actions.pop()\n        return res\n\n    def _get_cut_off_label_format(self):\n        \"\"\" Get the translated format string used in cut-off labels \"\"\"\n        self.ensure_one()\n        return _(\"Cut-off {label}\") if self.percentage == 100 else _(\"Cut-off {label} {percent}%\")","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/odoo/odoo/blob/1e661df964b1b264c9cef3ab28430d4785be3fda/addons/account/wizard/account_automatic_entry_wizard.py#L132-L168","documentation":"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.","triggerScenarios":"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.","commonSituations":"Accrual/cut-off attempts on customer invoices already paid; selections including bank-reconciled statement lines; year-end cleanups on closed items.","solutions":["Unreconcile the concerned lines first (reset reconciliation), run the wizard, then re-reconcile.","Select only lines that have no reconciliation (filter on reconciled = False).","For paid items, post manual adjustment entries instead of re-perioding the original line."],"exampleFix":"# before\n# selection includes reconciled lines -> UserError\n\n# after\nopen_lines = lines.filtered(lambda l: not l.reconciled)\n            wizard = self.env['account.automatic.entry.wizard'].with_context(\n                active_model='account.move.line', active_ids=open_lines.ids).create({})","handlingStrategy":"validation","validationCode":"if any(l.reconciled for l in move_line_ids):\n    move_line_ids = move_line_ids.filtered(lambda l: not l.reconciled)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Unreconcile before re-perioding; re-reconcile afterwards.","Exclude paid/matched lines from wizard selections (filter on reconciled=False).","Prefer adjusting entries over editing reconciled history."],"tags":["odoo","wizard","reconciliation","journal-item","validation"],"backgroundTag":null,"analyzedSha":"1e661df964b1b264c9cef3ab28430d4785be3fda","analyzedAt":"2026-08-15T05:22:16.142Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}