python - Read all sale.order objects on draft state from a custom module - Odoo v8 -


how can read related field, sale.order objects 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 seems.

any idea on how achieve this?

i mean, issue sale orders must on 'draft' state, know maybe many2one related field isn't working because 'state' selection one, can't figure out how load that.

that not related fields for. should achieve computed field somehow this:

sales_bsi =  fields.one2many('sale.order',              compute="_compute_sales_bsi")  @api.one def _compute_sales_bsi(self):     self.sales_bsi = self.env['sale.order'].search([('state', '=', 'draft')]) 

what searches sale.order model records in draft state, , adds them field sales_bsi. if understand right want achieve.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -