تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
5185 أدوات العرض

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
مارس 23
1806
4
أبريل 15
6248
1
يونيو 21
3668
0
يوليو 25
789
1
مايو 25
1521