[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
This commit is contained in:
Jairo Llopis 2016-12-19 17:26:31 +01:00 committed by Martin Trigaux
parent 20ba16e777
commit 000d8eba12
1 changed files with 3 additions and 1 deletions

View File

@ -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'),
}