コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
5233 ビュー

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
1851
4
4月 15
6300
1
6月 21
3693
0
7月 25
832
1
5月 25
1563