diff --git a/partner_password_reset/tests/test_res_partner_password_reset_wizard.py b/partner_password_reset/tests/test_res_partner_password_reset_wizard.py index 25bb71d2e..ade4fb907 100644 --- a/partner_password_reset/tests/test_res_partner_password_reset_wizard.py +++ b/partner_password_reset/tests/test_res_partner_password_reset_wizard.py @@ -17,6 +17,16 @@ class TestResPartnerPasswordResetWizard(TransactionCase): with self.assertRaises(Warning): wizard.fields_view_get() + def test_fields_view_get(self): + """ It should return the wizard correctly """ + partner = self.env.ref('portal.partner_demo_portal') + wizard = self.env['res.partner.password.reset.wizard'].with_context( + active_ids=partner.id + ) + output = wizard.fields_view_get() + self.assertEquals(output.get('name'), 'Send Password Reset Email') + self.assertEquals(type(output.get('fields').get('user_ids')), dict) + def test_action_submit(self): """ It should call user_ids.action_reset_password """ self.env['res.users']._patch_method( diff --git a/partner_password_reset/wizard/res_partner_password_reset_wizard.py b/partner_password_reset/wizard/res_partner_password_reset_wizard.py index 939036298..47c7e8b99 100644 --- a/partner_password_reset/wizard/res_partner_password_reset_wizard.py +++ b/partner_password_reset/wizard/res_partner_password_reset_wizard.py @@ -39,5 +39,4 @@ class ResPartnerPasswordResetWizard(models.TransientModel): @api.multi def action_submit(self): """ Reset the user passwords on submission """ - for rec in self: - rec.user_ids.action_reset_password() + self.mapped('user_ids').action_reset_password()