Skip to content

Commit

Permalink
[MIG] base_user_empty_password: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chaule97 committed Oct 10, 2024
1 parent ff3ea59 commit da8c346
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 38 deletions.
17 changes: 12 additions & 5 deletions base_user_empty_password/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Empty users password
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github
:target: https://github.com/OCA/server-auth/tree/14.0/base_user_empty_password
:target: https://github.com/OCA/server-auth/tree/18.0/base_user_empty_password
:alt: OCA/server-auth
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-auth-14-0/server-auth-14-0-base_user_empty_password
:target: https://translation.odoo-community.org/projects/server-auth-18-0/server-auth-18-0-base_user_empty_password
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=14.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/server-auth&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -44,7 +44,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-auth/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20base_user_empty_password%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/server-auth/issues/new?body=module:%20base_user_empty_password%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand All @@ -60,6 +60,13 @@ Contributors
------------

- Akim Juillerat [email protected]
- Chau Le [email protected]

Other credits
-------------

The migration of this module from 14.0 to 18.0 was financially supported
by Camptocamp.

Maintainers
-----------
Expand All @@ -82,6 +89,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-grindtildeath|

This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/14.0/base_user_empty_password>`_ project on GitHub.
This module is part of the `OCA/server-auth <https://github.com/OCA/server-auth/tree/18.0/base_user_empty_password>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 1 addition & 2 deletions base_user_empty_password/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Empty users password",
"summary": "Allows to empty password of users",
"version": "14.0.1.0.0",
"version": "18.0.1.0.0",
"development_status": "Beta",
"category": "Uncategorized",
"website": "https://github.com/OCA/server-auth",
Expand All @@ -14,7 +14,6 @@
"base",
],
"data": [
# "data/ir_actions.xml",
"security/ir.model.access.csv",
"views/res_users.xml",
"wizard/empty_password.xml",
Expand Down
20 changes: 8 additions & 12 deletions base_user_empty_password/i18n/base_user_empty_password.pot
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Project-Id-Version: Odoo Server 18.1alpha1+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-27 05:16+0000\n"
"PO-Revision-Date: 2024-09-27 05:16+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -35,7 +37,6 @@ msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__display_name
#: model:ir.model.fields,field_description:base_user_empty_password.field_res_users__display_name
msgid "Display Name"
msgstr ""

Expand All @@ -57,16 +58,9 @@ msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__id
#: model:ir.model.fields,field_description:base_user_empty_password.field_res_users__id
msgid "ID"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard____last_update
#: model:ir.model.fields,field_description:base_user_empty_password.field_res_users____last_update
msgid "Last Modified on"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__write_uid
msgid "Last Updated by"
Expand All @@ -78,11 +72,13 @@ msgid "Last Updated on"
msgstr ""

#. module: base_user_empty_password
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__user_ids
msgid "User"
#. odoo-python
#: code:addons/base_user_empty_password/wizard/empty_password.py:0
msgid "This can only be used on users."
msgstr ""

#. module: base_user_empty_password
#: model:ir.model,name:base_user_empty_password.model_res_users
msgid "Users"
#: model:ir.model.fields,field_description:base_user_empty_password.field_empty_password_wizard__user_ids
msgid "User"
msgstr ""
1 change: 1 addition & 0 deletions base_user_empty_password/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
- Akim Juillerat <[email protected]>
- Chau Le <[email protected]>
1 change: 1 addition & 0 deletions base_user_empty_password/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The migration of this module from 14.0 to 18.0 was financially supported by Camptocamp.
28 changes: 19 additions & 9 deletions base_user_empty_password/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -274,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Empty users password</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:512d1e5b2dee0d04bf83cf2186bc757d4bc2e0f660342c92128bce2ba1bb571c
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-auth/tree/14.0/base_user_empty_password"><img alt="OCA/server-auth" src="https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-auth-14-0/server-auth-14-0-base_user_empty_password"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-auth&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-auth/tree/18.0/base_user_empty_password"><img alt="OCA/server-auth" src="https://img.shields.io/badge/github-OCA%2Fserver--auth-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-auth-18-0/server-auth-18-0-base_user_empty_password"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-auth&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module provides a wizard to allow emptying users password field.</p>
<p>This could be useful to force the user to use another sign on method
than Odoo.</p>
Expand All @@ -379,7 +380,8 @@ <h1 class="title">Empty users password</h1>
<li><a class="reference internal" href="#credits" id="toc-entry-2">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-3">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-4">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-5">Maintainers</a></li>
<li><a class="reference internal" href="#other-credits" id="toc-entry-5">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-6">Maintainers</a></li>
</ul>
</li>
</ul>
Expand All @@ -389,7 +391,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-auth/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/server-auth/issues/new?body=module:%20base_user_empty_password%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/server-auth/issues/new?body=module:%20base_user_empty_password%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -404,18 +406,26 @@ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Akim Juillerat <a class="reference external" href="mailto:akim.juilllerat&#64;camptocamp.com">akim.juilllerat&#64;camptocamp.com</a></li>
<li>Chau Le <a class="reference external" href="mailto:chaulb&#64;trobz.com">chaulb&#64;trobz.com</a></li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-5">Other credits</a></h2>
<p>The migration of this module from 14.0 to 18.0 was financially supported
by Camptocamp.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/grindtildeath"><img alt="grindtildeath" src="https://github.com/grindtildeath.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-auth/tree/14.0/base_user_empty_password">OCA/server-auth</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/server-auth/tree/18.0/base_user_empty_password">OCA/server-auth</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
23 changes: 13 additions & 10 deletions base_user_empty_password/wizard/empty_password.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from odoo import fields, models
from odoo import _, api, fields, models
from odoo.exceptions import UserError


class EmptyPasswordWizard(models.TransientModel):
_name = "empty.password.wizard"
_description = "Empty Password Wizard"

user_ids = fields.Many2many(
"res.users", readonly=True, default=lambda w: w._default_user_ids()
)
user_ids = fields.Many2many("res.users", readonly=True)

def _default_user_ids(self):
return (
self.env.context.get("active_model") == "res.users"
and self.env.context.get("active_ids")
or []
)
@api.model
def default_get(self, fields):
res = super().default_get(fields)

if self.env.context.get("active_model") != "res.users":
raise UserError(_("This can only be used on users."))

res["user_ids"] = self.env.context.get("active_ids") or []

return res

def empty_password_button(self):
self.ensure_one()
Expand Down

0 comments on commit da8c346

Please sign in to comment.