Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
2 Risposte
5204 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Risposta migliore

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

Hope it helps, Thanks

Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
mar 23
1810
4
apr 15
6259
1
giu 21
3676
0
lug 25
802
1
mag 25
1529