Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][OU-ADD] stock_account: set display_type of cogs account move line #4293

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules150-160.rst
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ Module coverage 15.0 -> 16.0
+-------------------------------------------------+----------------------+-------------------------------------------------+
| stock | Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| stock_account | | |
| stock_account | Done | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
| stock_dropshipping | | |
+-------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
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)
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---Models in module 'stock_account'---
---Fields in module 'stock_account'---
stock_account / account.move.line / is_anglo_saxon_line (boolean) : DEL
stock_account / account.move.line / stock_valuation_layer_ids (one2many): NEW relation: stock.valuation.layer
stock_account / stock.valuation.layer / account_move_line_id (many2one): NEW relation: account.move.line
stock_account / stock.valuation.layer / price_diff_value (float) : NEW
# NOTHING TO DO: new feature
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be pointed that this would be addresed in purchase_stock (I'm not sure if it's necessary/possible/worth it) to rebuild past values


---XML records in module 'stock_account'---
NEW ir.actions.act_window: stock_account.stock_valuation_layer_report_action
NEW ir.ui.view: stock_account.product_product_stock_tree_inherit_stock_account
NEW ir.ui.view: stock_account.stock_valuation_layer_report_tree
NEW ir.ui.view: stock_account.view_stock_quantity_history_inherit_stock_account
# NOTHING TO DO: noupdate="0"
Loading