跳至內容
選單
此問題已被標幟
2 回覆
5221 瀏覽次數

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
1839
4
4月 15
6278
1
6月 21
3686
0
7月 25
827
1
5月 25
1554