Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
2 Odpovědi
5199 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Nejlepší odpověď

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

Hope it helps, Thanks

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
bře 23
1810
4
dub 15
6254
1
čvn 21
3674
0
čvc 25
797
1
kvě 25
1528