Odoo Help

0

How to access the values of product.template within stock.move in odoo10?

By
acha aslam
on 5/18/17, 5:39 AM 198 views

I have a custom field in product.template.

class ProductTemplate(models.Model):

    _inherit = "product.template"

   serial_no = fields.Char(string="Serial#")

i add the same field in move for added in move_lines

class ProductTemplate(models.Model):

    _inherit = "product.template"

   serial_no = fields.Char(string="Serial#")

notes

 I click "search more" on the moveline. I got the field to appear but there doesn't seem to be any data in it.The search window using product.product view
I am using an onchange function in stock.moves

function

@api.onchange('product_id')

def on_change_product(self):

        self.serial_no = self.product_id.serial_no

i get the serial no when i use create and edit  option. i use this the product.product window is opend.

how to get the values of product.template in onchage function?

0
Esther Martín
On 5/19/17, 11:42 AM

If the field is set in product.template, you should access to it from product_id

self.serial_no = self.product_id.product_tmpl_id.serial_no

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 5/18/17, 5:39 AM
Seen: 198 times
Last updated: 5/19/17, 11:42 AM