Skip to content

Commit

Permalink
[OU-ADD] product_email_template
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-filament committed Sep 16, 2024
1 parent 2c37220 commit 6675788
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2024 Le Filament <https://le-filament.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openupgradelib import openupgrade


def update_product_template_mail_model(env):
"""
Mail template model has changed from product.template to account.move in v13
"""
account_move_model = env["ir.model"].search([("model", "=", "account.move")])
mail_template_ids = env["product.template"].search(
[("email_template_id", "!=", False)]
).mapped("email_template_id")
mail_template_ids.filtered(lambda t: t.model=='product.template').write(
{"model_id": account_move_model.id}
)


@openupgrade.migrate()
def migrate(env, version):
update_product_template_mail_model(env)

0 comments on commit 6675788

Please sign in to comment.