Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
5206 Vues

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! :)
Avatar
Ignorer
Meilleure réponse

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)

Avatar
Ignorer
Meilleure réponse

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

Hope it helps, Thanks

Avatar
Ignorer
Publications associées Réponses Vues Activité
1
mars 23
1812
4
avr. 15
6260
1
juin 21
3677
0
juil. 25
802
1
mai 25
1529