From 000d8eba12bf082d5b18f6e4ec159d80d973b85d Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Mon, 19 Dec 2016 17:26:31 +0100 Subject: [PATCH] [FIX] portal: allow to delete res.partner Do these steps: 1. Create a partner. 2. Grant him portal access through *Actions > Portal Access Management*. 3. Delete the created user. 4. Delete the partner. You will get this error: ``` Odoo Warning - Validation Error The operation cannot be completed, probably due to the following: - deletion: you may be trying to delete a record while other records still reference it - creation/update: a mandatory field is not correctly set [object with reference: Portal User Config - portal.wizard.user] ``` This happens because the wizard (which is a transient model) does not let the partner to be deleted. With this patch, we avoid that bug. Closes #12608 --- addons/portal/wizard/portal_wizard.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/portal/wizard/portal_wizard.py b/addons/portal/wizard/portal_wizard.py index df3ff61f4f3..ecbec057c75 100644 --- a/addons/portal/wizard/portal_wizard.py +++ b/addons/portal/wizard/portal_wizard.py @@ -117,7 +117,9 @@ class wizard_user(osv.osv_memory): _columns = { 'wizard_id': fields.many2one('portal.wizard', string='Wizard', required=True, ondelete='cascade'), - 'partner_id': fields.many2one('res.partner', string='Contact', required=True, readonly=True), + 'partner_id': fields.many2one( + 'res.partner', string='Contact', required=True, readonly=True, + ondelete='cascade'), 'email': fields.char(string='Email', size=240), 'in_portal': fields.boolean('In Portal'), }