How can I read from a related field, all sale.order objects which are on 'draft' state?
I've tried this:
class account_budget_bsi(models.Model):
_name = 'account.budget.bsi'
_inherit = ['crossovered.budget', 'sale.order', 'stock.location', 'stock.move', 'purchase.order']
sale_order = fields.Many2one('sale.order')
sales_bsi = fields.Many2one('sale.order' , related="sale_order.state.draft", string="Sales Planned")
But it's not working as it seems.
Any idea on how to achieve this?
I mean, the issue is that all the sale orders must be on 'draft' state, I know that maybe the Many2one related field isn't working because 'state' is a Selection one, but can't figure out how to load it like that.