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

Hi,

I have added Many2one field in product.packaging called products,

products_pack = fields.Many2one('product.product',string="Product Name")
so i want to drop down only the products that in stock.move.line products for the 
products_pack field.
plase help me if anyone knows the answer for this! :)
아바타
취소
베스트 답변

Try This

@api.model
def _default_products(self):
    ids = self.env['stock.move.line'].search([]).mapped('product_id').ids
    domain = [ ('id', 'in', ids) ]
    return self.env['product.product'].search(domain, limit=1)

products_pack = fields.Many2one('product.product',string="Product Name",default=_default_products)

아바타
취소
베스트 답변

You can follow this: https://youtu.be/XGqXEL2qQmE 

Hope it helps, Thanks

아바타
취소
관련 게시물 답글 화면 활동
1
3월 23
2124
4
4월 15
6753
1
6월 21
3897
3
9월 25
491
1
9월 25
1919