Skip to content

Commit

Permalink
password_security: enable module on existing companies
Browse files Browse the repository at this point in the history
  • Loading branch information
sebalix committed Sep 22, 2023
1 parent 6eb2d9b commit 367a85c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion password_security/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Password Security",
"summary": "Allow admin to set password security requirements.",
"version": "15.0.1.1.4",
"version": "15.0.1.2.0",
"author": "LasLabs, "
"Onestein, "
"Kaushal Prajapati, "
Expand Down
17 changes: 17 additions & 0 deletions password_security/migrations/15.0.1.2.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2023 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)

import logging

from odoo import SUPERUSER_ID, api

_logger = logging.getLogger(__name__)


def migrate(cr, version):
if not version:
return
env = api.Environment(cr, SUPERUSER_ID, {})
companies = env["res.company"].with_context(active_test=False).search([])
_logger.info("Enable the password policy on %s companies", len(companies))
companies.write({"password_policy_enabled": True})

0 comments on commit 367a85c

Please sign in to comment.