(self)
It toggles patient and partner activation.
It toggles patient and partner activation.
It toggles patient and partner activation .
def toggle_active(self):
        """ It toggles patient and partner activation. """
        for record in self:
            super(MedicalAbstractEntity, self).toggle_active()
            if record.active:
                record.partner_id.active = True
            else:
                entities = record.env[record._name].search([
                    ('partner_id', 'child_of', record.partner_id.id),
                    ('parent_id', 'child_of', record.partner_id.id),
                    ('active', '=', True),
                ])
                if not entities:
                    record.partner_id.active = False
def toggle_active ( self ) : for record in self : super ( MedicalAbstractEntity , self ) . toggle_active ( ) if record . active : record . partner_id . active = True else : entities = record . env [ record . _name ] . search ( [ ( 'partner_id' , 'child_of' , record . partner_id . id ) , ( 'parent_id' , 'child_of' , record . partner_id . id ) , ( 'active' , '=' , True ) , ] ) if not entities : record . partner_id . active = False