Skip to content
Snippets Groups Projects
Commit de07c642 authored by Andrius Preimantas's avatar Andrius Preimantas Committed by Martin Trigaux
Browse files

[FIX] base: delete parent partner reset use_parent_address

When deleting a partner with some contacts, if the contacts had selected
the "use parent address" checkbox, the address of the contacts was stucked in
readonly mode (no checkbox to disable it).
Disable use_parent_address for orphan partners.

Fixes #3611 #3613
parent fc85a7ee
Branches
Tags
No related merge requests found
......@@ -508,6 +508,14 @@ class res_partner(osv.osv, format_address):
if not parent.is_company:
parent.write({'is_company': True})
def unlink(self, cr, uid, ids, context=None):
orphan_contact_ids = self.search(cr, uid,
[('parent_id', 'in', ids), ('id', 'not in', ids), ('use_parent_address', '=', True)], context=context)
if orphan_contact_ids:
# no longer have a parent address
self.write(cr, uid, orphan_contact_ids, {'use_parent_address': False}, context=context)
return super(res_partner, self).unlink(cr, uid, ids, context=context)
def write(self, cr, uid, ids, vals, context=None):
if isinstance(ids, (int, long)):
ids = [ids]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment