Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
5334 Vizualizări

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! :)
Imagine profil
Abandonează
Cel mai bun răspuns

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)

Imagine profil
Abandonează
Cel mai bun răspuns

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

Hope it helps, Thanks

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
mar. 23
1950
4
apr. 15
6524
1
iun. 21
3775
3
sept. 25
217
1
sept. 25
438