Skip to content

Commit 84b45b2

Browse files
authored
Merge pull request #4293 from coopiteasy/v16_mig_stock_account
[16.0][OU-ADD] stock_account: set display_type of cogs account move line
2 parents 6356918 + 213f026 commit 84b45b2

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

docsource/modules150-160.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ Module coverage 15.0 -> 16.0
770770
+-------------------------------------------------+----------------------+-------------------------------------------------+
771771
| stock | Done | |
772772
+-------------------------------------------------+----------------------+-------------------------------------------------+
773-
| stock_account | | |
773+
| stock_account | Done | |
774774
+-------------------------------------------------+----------------------+-------------------------------------------------+
775775
| stock_dropshipping | | |
776776
+-------------------------------------------------+----------------------+-------------------------------------------------+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2023 Coop IT Easy - Robin Keunen
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
def _account_move_line_fill_cogs_display_type(env):
8+
"""
9+
Fill the display type for journal items corresponding to Cost of Good Sold
10+
lines (COGS) for customer invoices.
11+
In v15, the lines were set to is_anglo_saxon_line == True, in v16
12+
field display_display is used.
13+
14+
openupgrade account migration script already sets display_type
15+
in _account_move_fast_fill_display_type (pre-migration)
16+
17+
cf _stock_account_prepare_anglo_saxon_out_lines_vals
18+
:param env:
19+
:return:
20+
"""
21+
openupgrade.logged_query(
22+
env.cr,
23+
"""
24+
UPDATE account_move_line
25+
SET display_type = 'cogs'
26+
WHERE is_anglo_saxon_line;
27+
""",
28+
)
29+
30+
31+
@openupgrade.migrate()
32+
def migrate(env, version):
33+
_account_move_line_fill_cogs_display_type(env)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---Models in module 'stock_account'---
2+
---Fields in module 'stock_account'---
3+
stock_account / account.move.line / is_anglo_saxon_line (boolean) : DEL
4+
stock_account / account.move.line / stock_valuation_layer_ids (one2many): NEW relation: stock.valuation.layer
5+
stock_account / stock.valuation.layer / account_move_line_id (many2one): NEW relation: account.move.line
6+
stock_account / stock.valuation.layer / price_diff_value (float) : NEW
7+
# NOTHING TO DO: new feature
8+
9+
---XML records in module 'stock_account'---
10+
NEW ir.actions.act_window: stock_account.stock_valuation_layer_report_action
11+
NEW ir.ui.view: stock_account.product_product_stock_tree_inherit_stock_account
12+
NEW ir.ui.view: stock_account.stock_valuation_layer_report_tree
13+
NEW ir.ui.view: stock_account.view_stock_quantity_history_inherit_stock_account
14+
# NOTHING TO DO: noupdate="0"

0 commit comments

Comments
 (0)