I am using odoo 10
I have a 2 models:
from odoo import models, fields, api
class BatchOrderLine(models.Model):
_name = 'batch.order.line'
product_id = fields.Many2one('product.product', string='Article')
description = fields.Text("Description")
class ProjectTask (models.Model):
_inherit = "project.task"
order_lines = fields.One2many('batch.order.line','batch_id',string="Articles")
@api.onchange('product_id')
def product_id_change(self):
self.description = self.product_id
xml file :
<field name="product_id" on_change="product_id_change(product_id)"/>
<field name="description" readonly="1"/>
My question is : how to update the "description" field value depending on the selected field "product_id" using onchange ?