{"record":{"id":"df47063130d82828","repo":"odoo/odoo","slug":"you-can-only-resequence-items-from-the-same-journa","errorCode":null,"errorMessage":"You can only resequence items from the same journal","messagePattern":"You can only resequence items from the same journal","errorType":"exception","errorClass":"UserError","httpStatus":null,"severity":"error","filePath":"addons/account/wizard/account_resequence.py","lineNumber":33,"sourceCode":"    sequence_number_reset = fields.Char(compute='_compute_sequence_number_reset')\n    first_date = fields.Date(help=\"Date (inclusive) from which the numbers are resequenced.\")\n    end_date = fields.Date(help=\"Date (inclusive) to which the numbers are resequenced. If not set, all Journal Entries up to the end of the period are resequenced.\")\n    first_name = fields.Char(compute=\"_compute_first_name\", readonly=False, store=True, required=True, string=\"First New Sequence\")\n    ordering = fields.Selection([('keep', 'Keep current order'), ('date', 'Reorder by accounting date')], required=True, default='keep')\n    move_ids = fields.Many2many('account.move')\n    new_values = fields.Text(compute='_compute_new_values')\n    preview_moves = fields.Text(compute='_compute_preview_moves')\n\n    @api.model\n    def default_get(self, fields):\n        values = super().default_get(fields)\n        if 'move_ids' not in fields:\n            return values\n        active_move_ids = self.env['account.move']\n        if self.env.context['active_model'] == 'account.move' and 'active_ids' in self.env.context:\n            active_move_ids = self.env['account.move'].browse(self.env.context['active_ids'])\n        if len(active_move_ids.journal_id) > 1:\n            raise UserError(_('You can only resequence items from the same journal'))\n        move_types = set(active_move_ids.mapped('move_type'))\n        if (\n            active_move_ids.journal_id.refund_sequence\n            and ('in_refund' in move_types or 'out_refund' in move_types)\n            and len(move_types) > 1\n        ):\n            raise UserError(_('The sequences of this journal are different for Invoices and Refunds but you selected some of both types.'))\n        is_payment = set(active_move_ids.mapped(lambda x: bool(x.origin_payment_id)))\n        if (\n            active_move_ids.journal_id.payment_sequence\n            and len(is_payment) > 1\n        ):\n            raise UserError(_('The sequences of this journal are different for Payments and non-Payments but you selected some of both types.'))\n        values['move_ids'] = [(6, 0, active_move_ids.ids)]\n        return values\n\n    @api.depends('first_name')\n    def _compute_sequence_number_reset(self):","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/odoo/odoo/blob/1e661df964b1b264c9cef3ab28430d4785be3fda/addons/account/wizard/account_resequence.py#L15-L51","documentation":"account.resequence.wizard.default_get refuses to resequence entries coming from more than one journal (len(active_move_ids.journal_id) > 1). Resequencing renumbers entries within a journal's sequence; mixing journals would make the resulting numbering ambiguous, so the wizard blocks it immediately.","triggerScenarios":"Selecting account.move records from two different journals (e.g. two customer invoices journals, or an invoice journal and a bank journal) and running the 'Resequence' action; the check uses the journals of all active_ids passed in context.","commonSituations":"Multi-journal list views where the journal column isn't visible; users selecting by date range across journals; automation passing unfiltered move ids to the wizard.","solutions":["Filter the entries list by a single journal before launching Resequence.","Run the wizard once per journal: split the selection on move.journal_id.","In code, pre-group: for journal, moves in groupby(moves, key=lambda m: m.journal_id) and call the wizard per group."],"exampleFix":"# before\nself.env['account.resequence.wizard'].with_context(\n    active_model='account.move', active_ids=moves.ids,  # multi-journal\n).create({})\n\n# after\nfrom itertools import groupby\nfor journal, grouped in groupby(moves.sorted('journal_id'), key=lambda m: m.journal_id):\n    self.env['account.resequence.wizard'].with_context(\n        active_model='account.move',\n        active_ids=self.env['account.move'].concat(*grouped).ids,\n    ).create({})","handlingStrategy":"validation","validationCode":"if len(moves.journal_id) > 1:\n    moves = moves.filtered(lambda m: m.journal_id == moves[0].journal_id)  # or split per journal","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Filter by one journal before running Resequence.","Show the Journal column in any list used for resequencing."],"tags":["accounting","sequence","journal","resequence","odoo"],"backgroundTag":null,"analyzedSha":"1e661df964b1b264c9cef3ab28430d4785be3fda","analyzedAt":"2026-08-15T05:22:16.142Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}