Hi,
active_id is the current record's id. You can get the active_id from the context as this:
active_id = self.env.context.get('active_id')
The use cases are explained in this video in detail Active Id In Odoo Development
And for getting sale orders of the partner selected try this solution:
In your python file:
partner_id = fields.Many2one('res.partner', string='Customer')
def get_sale_orders(self):
return {
'name': _('Sale Orders'),
'type': 'ir.actions.act_window',
'res_model': 'sale.order',
'view_mode': 'kanban,tree,form',
'domain': [('partner_id', '=', self.partner_id.id)],
}
In your xml file define the button(type=object) and partner_id field:
Pass the domain:
'domain': [('partner_id', '=', self.partner_id.id)] , while returning from the button function
Thank you