Skip to content

Fix a bug in ClientePresenter searching the address

Administrator requested to merge fix/castiphone-invoice-address into master

With the previous form we are searching all the invoice address in the DB:

self.partner.child_ids.search([('type', '=', 'invoice')]) === self.env['res.partner'].search([('type', '=', 'invoice')])

If we want to use the childs_ids we have to use the filtered() method to manage the record set.

Is more efficient, if you don't need the rest of the collection, filter them in the query:

invoice_address = self.partner.search(
    [
        ("type", "=", "invoice"),
        ("parent_id", "=", self.partner.id),
    ],
)

Merge request reports