I've made 3 models
class Budget(models.Model):
_name = 'budget.model'
value = fields.Integer()
description = fields.Text()
name = fields.Char()
class Ot(models.model):
_name = 'ot.model'
budget = fields.Many2one('budget.model')
description = fields.One2Many('ot.model.desciption', 'ot_description')
class OtDescription(models.model):
_name = "ot.model.description"
ot_description = fields.Many2one('ot.model')
quantity = fields.Integer()
value = fields.Integer()
description= fields.Text()
I would like to show description, value, and quantity = 0 from budget.model inside the description field of ot.model when someone click the budget field of ot.model
I've tryed something inside ot.model
@api.onchange('budget')
def _onchange(self)
if self.budget:
self.desciption = self.env['ot.model.description'].search([])
but It's wrong
Dear wildhen,
what is the relation betweet ot.model.description and budget.model. ?
You do one thing, create a budget field in ot.model.description.
Then you can search the description in on-change function.