odoo computed many2one code example
Example: odoo computed many2one
customer_of_division_id = fields.Many2one(compute='_get_division_id', comodel_name='res.partner', string='Customer of the division', store=True) @api.depends('sale_id','partner_id') def _get_division_id(self): if self.sale_id: self.customer_of_division_id = self.sale_id.customer_of_division_id.id elif self.partner_id: self.customer_of_division_id = self.partner_id.customer_of_division_id.id