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

Hello I have a form where one list object have a onchage that affect the domain in other list, and it works on create option, but if i select the edit option, this isn executed when the form is loaded, and if the user dont change the first list the second list dont get the domain, can someone help me. Here is my code.

    @api.onchange('client_id')
    def _validate_cliente(self):
        print('validation')
        if self.client_id:
            self.invoice_ids = self.env['account.invoice']
            return {
                'domain' : {
                    'invoice_ids' : [('partner_id', '=', self.client_id.id), ('type', '=', 'out_invoice')]
                }
            }

The type of the fields are:

    client_id = fields.Many2one('res.partner', string='Cliente', required=True, domain=[('customer', '=', True)])
    invoice_ids = fields.Many2many('account.invoice', string='Facturas', domain=[('type', '=', 'out_invoice')])

 

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
nov. 20
4266
2
ian. 19
8934
0
mar. 15
4255
1
mar. 15
3740
0
mar. 15
4998