One2many fields aren't actually stored on the database table though. So you won't be able to query results using that field with sql. If you want to find your subscription lines per subscription, you could actually use the search function to return a list of ids, then browse, or read using the list of ids that are returned from the search function. Example:
class subscription_subscription(orm.Model):
def get_subscription_lines(self, cr, uid, sub_id, context=None):
subscription_line_obj = self.pool.get('subscription.function.subscription.line')
# get subscription lines based on the current subscription i
subscription_line_ids = subscription_line_obj.search(cr, uid, [('subscription_id','=',sub_id )], context)
# now subscription_line_ids should have a list of ids like this = [1,2,3]
# you can browse or read using the subscription_line_ids for the data
subscription_line_recs = subscription_line_obj.browse(cr, uid, subscription_line_ids, context)
subscription_line_vals = subscription_line_obj.read(cr, uid, subscription_line_ids, ['names','of','fields'], context)
# subscription_line_recs is a list of objects where the data can be used by using dot notation on the object
# subscription_line_vals is a list of dictionaries that contains the names of the fields specified in the read function
return subscription_line_recs or subscription_line_vals
If you still need to use sql to query subscription lines then you can use the database cursor to do this, but it is not recommended
cr.execute(""" SELECT * FROM subscription_function_subscription_line WHERE subscription_id = 1 """)
result_recs = cr.fetchall()