Hi,
you can do this from the DB directly. Do you have access to the database?
Execute:
UPDATE res_partner SET active = 'f' WHERE parent_id in (SELECT id FROM res_partner WHERE is_company = 't' AND active = 'f')
Also, you can create a function on_change for the active field of a partner like this:
def onchange_active_partner(self, cr, uid, ids, active, context=None):
if not active:
childs_ids = self.search(cr, uid, [('parent_id','in',ids)])
self.write(cr, uid, childs_ids, {'active': False})
return {'value' : {}, }
Hope this helps!
UPDATE:
You will have to create a new file (a good name will be res_partner.py)
# -*- coding: utf-8 -*-
from openerp.osv import osv, fields
class res_partner(osv.osv):
_inherit = 'res.partner'
def onchange_active_partner(self, cr, uid, ids, active, context=None):
if not active:
childs_ids = self.search(cr, uid, [('parent_id','in',ids)])
self.write(cr, uid, childs_ids, {'active': False})
return {'value' : {}, }
res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
And put it into the __init__.py file like
import res_partner
Finally add the onchange function to the views:
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_partner_form_onchange_inherit" model="ir.ui.view">
<field name="name">res.partner.with.onchange.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="active" position="attributes" >
<attribute name="on_change">onchange_active_partner(active)</attribute>
</field>
</field>
</record>
</data>
</openerp>