Browse Source
[ADD] partner_password_reset: Create module
* Create module that allows you to send the password reset emails from the Partner view to any associated `res.users`
pull/383/head
Ted Salmon
8 years ago
committed by
Dave Lasley
No known key found for this signature in database
GPG Key ID: 7DDBA4BA81B934CF
8 changed files with
151 additions and
0 deletions
-
partner_password_reset/README.rst
-
partner_password_reset/__init__.py
-
partner_password_reset/__openerp__.py
-
partner_password_reset/models/__init__.py
-
partner_password_reset/models/res_partner.py
-
partner_password_reset/tests/__init__.py
-
partner_password_reset/tests/test_res_partner.py
-
partner_password_reset/views/res_partner_view.xml
|
@ -0,0 +1,58 @@ |
|
|
|
|
|
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
|
|
|
|
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html |
|
|
|
|
|
:alt: License: AGPL-3 |
|
|
|
|
|
|
|
|
|
|
|
===================== |
|
|
|
|
|
Parner Password Reset |
|
|
|
|
|
===================== |
|
|
|
|
|
|
|
|
|
|
|
This module provides an action that allows users to send a password reset |
|
|
|
|
|
email from the Partner view. |
|
|
|
|
|
|
|
|
|
|
|
Configuration |
|
|
|
|
|
============= |
|
|
|
|
|
|
|
|
|
|
|
None required |
|
|
|
|
|
|
|
|
|
|
|
Usage |
|
|
|
|
|
===== |
|
|
|
|
|
|
|
|
|
|
|
To use this module, simply select "Send password reset email" under the partner |
|
|
|
|
|
view. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bug Tracker |
|
|
|
|
|
=========== |
|
|
|
|
|
|
|
|
|
|
|
Bugs are tracked on `GitHub Issues |
|
|
|
|
|
<https://github.com/OCA/partner-contact/issues>`_. In case of trouble, please |
|
|
|
|
|
check there if your issue has already been reported. If you spotted it first, |
|
|
|
|
|
help us smash it by providing detailed and welcomed feedback. |
|
|
|
|
|
|
|
|
|
|
|
Credits |
|
|
|
|
|
======= |
|
|
|
|
|
|
|
|
|
|
|
Images |
|
|
|
|
|
------ |
|
|
|
|
|
|
|
|
|
|
|
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. |
|
|
|
|
|
|
|
|
|
|
|
Contributors |
|
|
|
|
|
------------ |
|
|
|
|
|
|
|
|
|
|
|
* Ted Salmon <tsalmon@laslabs.com> |
|
|
|
|
|
|
|
|
|
|
|
Maintainer |
|
|
|
|
|
---------- |
|
|
|
|
|
|
|
|
|
|
|
.. image:: https://odoo-community.org/logo.png |
|
|
|
|
|
:alt: Odoo Community Association |
|
|
|
|
|
:target: https://odoo-community.org |
|
|
|
|
|
|
|
|
|
|
|
This module is maintained by the OCA. |
|
|
|
|
|
|
|
|
|
|
|
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. |
|
|
|
|
|
|
|
|
|
|
|
To contribute to this module, please visit https://odoo-community.org. |
|
@ -0,0 +1,5 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2017 LasLabs Inc. |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
|
|
|
|
from . import models |
|
@ -0,0 +1,22 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2017 LasLabs Inc. |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
"name": "Partner User Password Reset", |
|
|
|
|
|
"summary": "Add Action to allow resetting of a Partner's associated user " |
|
|
|
|
|
"password from within the partner view.", |
|
|
|
|
|
"version": "9.0.1.0.0", |
|
|
|
|
|
"category": "Customer Relationship Management", |
|
|
|
|
|
"website": "https://laslabs.com/", |
|
|
|
|
|
"author": "LasLabs, " |
|
|
|
|
|
"Odoo Community Association (OCA)", |
|
|
|
|
|
"license": "AGPL-3", |
|
|
|
|
|
"installable": True, |
|
|
|
|
|
'depends': [ |
|
|
|
|
|
'auth_signup', |
|
|
|
|
|
], |
|
|
|
|
|
'data': [ |
|
|
|
|
|
'views/res_partner_view.xml', |
|
|
|
|
|
], |
|
|
|
|
|
} |
|
@ -0,0 +1,5 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2017 LasLabs Inc. |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
|
|
|
|
from . import res_partner |
|
@ -0,0 +1,13 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2017 LasLabs Inc. |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
|
|
|
|
from openerp import api, models |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ResPartner(models.Model): |
|
|
|
|
|
_inherit = 'res.partner' |
|
|
|
|
|
|
|
|
|
|
|
@api.multi |
|
|
|
|
|
def action_reset_user_password(self): |
|
|
|
|
|
self.mapped('user_ids').action_reset_password() |
|
@ -0,0 +1,5 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2017 LasLabs Inc. |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
|
|
|
|
from . import test_res_partner |
|
@ -0,0 +1,23 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# Copyright 2017 LasLabs Inc. |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
|
|
|
|
|
|
from mock import MagicMock |
|
|
|
|
|
from openerp.tests.common import TransactionCase |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestResPartner(TransactionCase): |
|
|
|
|
|
|
|
|
|
|
|
def setUp(self): |
|
|
|
|
|
super(TestResPartner, self).setUp() |
|
|
|
|
|
self.partner = self.env['res.partner'].search([ |
|
|
|
|
|
('user_ids', '!=', ''), |
|
|
|
|
|
], limit=1) |
|
|
|
|
|
|
|
|
|
|
|
def test_action_reset_user_password(self): |
|
|
|
|
|
""" It should call user_ids.action_reset_password """ |
|
|
|
|
|
self.env['res.users']._patch_method( |
|
|
|
|
|
'action_reset_password', MagicMock() |
|
|
|
|
|
) |
|
|
|
|
|
self.partner.action_reset_user_password() |
|
|
|
|
|
self.env['res.users'].action_reset_password.assert_called_once() |
|
@ -0,0 +1,20 @@ |
|
|
|
|
|
<?xml version="1.0" encoding="utf-8"?> |
|
|
|
|
|
<odoo> |
|
|
|
|
|
|
|
|
|
|
|
<record id="view_partner_reset_user_password" model="ir.ui.view"> |
|
|
|
|
|
<field name="name">Partner Reset User Password</field> |
|
|
|
|
|
<field name="model">res.partner</field> |
|
|
|
|
|
<field name="inherit_id" ref="base.view_partner_form"/> |
|
|
|
|
|
<field name="arch" type="xml"> |
|
|
|
|
|
<xpath expr="//form/sheet" position="before"> |
|
|
|
|
|
<header> |
|
|
|
|
|
<button name="action_reset_user_password" type="object" |
|
|
|
|
|
string="Send Password Reset Email" |
|
|
|
|
|
attrs="{'invisible': [('user_ids', '=', '')]}" |
|
|
|
|
|
groups="base.group_user" /> |
|
|
|
|
|
</header> |
|
|
|
|
|
</xpath> |
|
|
|
|
|
</field> |
|
|
|
|
|
</record> |
|
|
|
|
|
|
|
|
|
|
|
</odoo> |