Skip to content
Snippets Groups Projects
Commit 9bf54f09 authored by Dylan Kiss (dyki)'s avatar Dylan Kiss (dyki)
Browse files

[FIX] account: reset draft move name in nonempty period


Currently, when we create a draft move in an empty period, a sequence
number (name) gets generated and set on the move. This is fine.

When subsequently we change the date of that move to a period that
already has entries in it, the sequence number (name) for our draft move
is recalculated according to the new period.

When we post a new move in this same period afterwards, and then
delete our previous draft move, we are left with a gap in the sequence.

Example: We already have a move on 2023-01-01 with name `2023/01/0001`.
We add two new moves `A` and `B` as follows.

| Step | Move | Action      | Date       | Name           |
| ---- | ---- | ----------- | ---------- | -------------- |
| 1    | `A`  | Add         | 2023-02-01 | `2023/02/0001` |
| 2    | `A`  | Change date | 2023-01-10 | `2023/01/0002` |
| 3    | `B`  | Add         | 2023-01-15 | `/`            |
| 4    | `B`  | Post        | 2023-01-15 | `2023/01/0003` |
| 5    | `A`  | Delete      |            |                |

A gap is now created, since we have `2023/01/0001` and `2023/01/0003`,
but `2023/01/0002` was deleted (possible since it was in draft).

To solve this issue, we now make sure that when a draft entry is moved
to a period that already has entries in it, we reset the name to `/`,
to not consume a sequence number and prevent possible gaps in the
sequence later on.

task-3326834

closes odoo/odoo#121565

Signed-off-by: default avatarWilliam André (wan) <wan@odoo.com>
parent bfaee3b5
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment