Skip to content

Commit 2627c93

Browse files
authored
Merge pull request #4 from steingabelgaard/18.0-fix-move-sequence-mixin-hhg
We need sequence_prefix/number to avoid falsely made_sequence_gap
2 parents 7e74cf6 + 91e60f3 commit 2627c93

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

openupgrade_scripts/scripts/account/18.0.1.3/pre-migration.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,20 @@ def fill_statement_line_fields(env):
198198
)
199199

200200

201+
def fill_missing_sequence_mixin_fields(env):
202+
openupgrade.logged_query(
203+
env.cr,
204+
"""
205+
UPDATE account_move
206+
SET sequence_prefix = substring(
207+
name, '^(.*?)(?:\\d{0,9})(?:\\D*?)$'),
208+
sequence_number = CAST(COALESCE(NULLIF(substring(
209+
name, '^(?:.*?)(\\d{0,9})(?:\\D*?)$'),''), '0') as int)
210+
WHERE name IS NOT NULL and name <> '/'
211+
""",
212+
)
213+
214+
201215
def fill_account_move_made_sequence_gap(env):
202216
openupgrade.logged_query(
203217
env.cr,
@@ -265,4 +279,5 @@ def migrate(env, version):
265279
"account.action_account_unreconcile",
266280
],
267281
)
282+
fill_missing_sequence_mixin_fields(env)
268283
fill_account_move_made_sequence_gap(env)

0 commit comments

Comments
 (0)