콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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?

아바타
취소
베스트 답변

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

아바타
취소
관련 게시물 답글 화면 활동
2
3월 24
6341
2
8월 23
4396
0
10월 21
1818
1
9월 19
5335
1
6월 25
923