From e1fb8049d9c54975172ecc9dfbf0fe77be0626d2 Mon Sep 17 00:00:00 2001 From: Ted Salmon Date: Thu, 4 May 2017 14:07:12 -0700 Subject: [PATCH] [IMP] partner_password_reset: Changes per PR review * Raise test coverage & simplify syntax --- .../tests/test_res_partner_password_reset_wizard.py | 10 ++++++++++ .../wizard/res_partner_password_reset_wizard.py | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) 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()