Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd

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?

Avatar
Annuleer
Beste antwoord

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

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
2
mrt. 24
6218
2
aug. 23
4144
0
okt. 21
1725
1
sep. 19
5149
1
jun. 25
780