- you can try this way:
 
- Define the boolean fields: - "field_boolean1" on the "sale.order" model
- "field_boolean2" on the related "res.partner" model
 
- Inherit the "sale.order" model: - Create a new custom module or open an existing one where you want to make the changes.
- Inherit the "sale.order" model using the appropriate Odoo/OpenERP method (e.g., models.Model or models.TransientModel).
 
- Override the "partner_id" field: - Inside your custom module, override the "partner_id" field to modify its domain filter.
- Set the domain based on the conditions you specified:- If "field_boolean1" is true, show only the records in "partner_id" where "field_boolean2" is also true.
- Otherwise, show all records in "partner_id".
 
 
example:
from odoo import models, fields
class SaleOrderInherit(models.Model):
    _inherit = 'sale.order'
    partner_id = fields.Many2one(
        domain="[('field_boolean2', '=', True)]",
        compute='_compute_partner_id',
        store=True
    )
    @api.depends('field_boolean1', 'partner_id')
    def _compute_partner_id(self):
        for order in self:
            if order.field_boolean1:
                order.partner_id = order.partner_id.filtered(lambda r: r.field_boolean2)
            else:
                order.partner_id = order.partner_id
- Update your module:- Make sure to update your module dependencies and other required files (e.g., __manifest__.py) accordingly.
- Restart the Odoo server to load the changes.