-
-
Notifications
You must be signed in to change notification settings - Fork 698
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] stock_account: set display_type to cogs
In v15, the lines were set to is_anglo_saxon_line == True in v16, field display_display is used.
- Loading branch information
1 parent
8e2a55e
commit c3107f8
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
openupgrade_scripts/scripts/stock_account/16.0.1.1/pre-migration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2023 Coop IT Easy - Robin Keunen | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from openupgradelib import openupgrade | ||
|
||
|
||
def _account_move_line_fill_cogs_display_type(env): | ||
""" | ||
Fill the display type for journal items corresponding to Cost of Good Sold | ||
lines (COGS) for customer invoices. | ||
In v15, the lines were set to is_anglo_saxon_line == True, in v16 | ||
field display_display is used. | ||
openupgrade account migration script already sets display_type | ||
in _account_move_fast_fill_display_type (pre-migration) | ||
cf _stock_account_prepare_anglo_saxon_out_lines_vals | ||
:param env: | ||
:return: | ||
""" | ||
openupgrade.logged_query( | ||
env.cr, | ||
""" | ||
UPDATE account_move_line | ||
SET display_type = 'cogs' | ||
WHERE is_anglo_saxon_line; | ||
""" | ||
) | ||
|
||
|
||
@openupgrade.migrate() | ||
def migrate(env, version): | ||
_account_move_line_fill_cogs_display_type(env) |