Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
1550 Weergaven

How to make product invisible in next line, if product is already selected in previous line of one2Many..????


Avatar
Annuleer

See dependent dropdown (many2one): https://goo.gl/CBP9og

Beste antwoord

I think you need an @api.onchange function that returns a domain for the Many2one field. Sometthing like that:

@api.onchange('o2m_field')
def onchange_attack(self):
   result = {
     'domain': {'m2o_field': [('id', 'not in', self.one2many_field.ids)], },
       }

And you also can use this domain in the field:

m2o_field = fields.Many2one('module.model' domain="[('id', 'not in', o2m_field)]")
Avatar
Annuleer