Skip to content
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/modules170-180.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ Module coverage 17.0 -> 18.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| stock | Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| stock_account | | |
| stock_account | Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| stock_delivery | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
for company in env["res.company"].search([("chart_template", "!=", False)]):
if not company.country_id.code:
continue
module_name = "l10n_" + company.country_id.code.lower()
l10n_module = env["ir.module.module"].search(
[
("name", "=", module_name),
("state", "=", "installed"),
]
)
if not l10n_module:
continue
template_code = company.chart_template
ChartTemplate = env["account.chart.template"].with_company(company)
full_data = ChartTemplate._get_chart_template_data(template_code)
ChartTemplate._load_wip_accounts(company, full_data["res.company"])
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade, openupgrade_180


def convert_company_dependent(env):
openupgrade_180.convert_company_dependent(
env, "product.category", "property_cost_method"
)
openupgrade_180.convert_company_dependent(
env, "product.category", "property_stock_account_input_categ_id"
)
openupgrade_180.convert_company_dependent(
env, "product.category", "property_stock_account_output_categ_id"
)
openupgrade_180.convert_company_dependent(
env, "product.category", "property_stock_journal"
)
openupgrade_180.convert_company_dependent(
env, "product.category", "property_stock_valuation_account_id"
)
openupgrade_180.convert_company_dependent(
env, "product.category", "property_valuation"
)


@openupgrade.migrate()
def migrate(env, version):
convert_company_dependent(env)
openupgrade.delete_records_safely_by_xml_id(
env,
[
"stock_account.default_category_cost_method",
"stock_account.default_category_valuation",
],
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright 2025 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade


def delete_property_xmlids(env):
# avoid conflict in in _create_default_stock_accounts_properties
# they changed records from ir.property to ir.default
for field in [
"property_stock_account_output_categ_id",
"property_stock_account_input_categ_id",
]:
imd = env["ir.model.data"].search(
[("module", "=", "stock_account"), ("name", "=", field)]
)
if imd:
imd.unlink()


@openupgrade.migrate()
def migrate(env, version):
delete_property_xmlids(env)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---Models in module 'stock_account'---
---Fields in module 'stock_account'---
stock_account / product.category / property_cost_method (selection): needs conversion to v18-style company dependent
stock_account / product.category / property_stock_account_input_categ_id (many2one): needs conversion to v18-style company dependent
stock_account / product.category / property_stock_account_output_categ_id (many2one): needs conversion to v18-style company dependent
stock_account / product.category / property_stock_journal (many2one): needs conversion to v18-style company dependent
stock_account / product.category / property_stock_valuation_account_id (many2one): needs conversion to v18-style company dependent
stock_account / product.category / property_valuation (selection): needs conversion to v18-style company dependent
# DONE: post-migration: used openupgrade_180.convert_company_dependent

stock_account / res.company / account_production_wip_account_id (many2one): NEW relation: account.account
stock_account / res.company / account_production_wip_overhead_account_id (many2one): NEW relation: account.account
# DONE: end-migration: call _load_wip_accounts

stock_account / product.template / lot_valuated (boolean) : NEW hasdefault: compute
stock_account / stock.lot / standard_price (float) : NEW
stock_account / stock.lot / stock_valuation_layer_ids (one2many): NEW relation: stock.valuation.layer
stock_account / stock.valuation.layer / lot_id (many2one) : NEW relation: stock.lot
# NOTHING TO DO: new features

---XML records in module 'stock_account'---
NEW ir.actions.act_window: stock_account.action_revalue_layers
DEL ir.actions.act_window: stock_account.inventory_aging_action
# NOTHING TO DO

DEL ir.property: stock_account.default_category_cost_method (noupdate)
DEL ir.property: stock_account.default_category_valuation (noupdate)
# DONE: post-migration: delete old property safely (now it's an ir.default record created by ORM)

DEL ir.ui.menu: stock_account.menu_inventory_aging
NEW ir.ui.view: stock_account.view_picking_form
NEW ir.ui.view: stock_account.view_production_lot_form_stock_account
NEW ir.ui.view: stock_account.view_template_property_form_stock_account
# NOTHING TO DO