diff --git a/addons/hr_recruitment/models/hr_applicant.py b/addons/hr_recruitment/models/hr_applicant.py index 18b05892aab..ec5ace5235c 100644 --- a/addons/hr_recruitment/models/hr_applicant.py +++ b/addons/hr_recruitment/models/hr_applicant.py @@ -39,7 +39,7 @@ class Applicant(models.Model): inverse='_inverse_partner_email', store=True, index='trigram') email_normalized = fields.Char(index='trigram') # inherited via mail.thread.blacklist probability = fields.Float("Probability") - partner_id = fields.Many2one('res.partner', "Contact", copy=False) + partner_id = fields.Many2one('res.partner', "Contact", copy=False, index='btree_not_null') create_date = fields.Datetime("Applied on", readonly=True) stage_id = fields.Many2one('hr.recruitment.stage', 'Stage', ondelete='restrict', tracking=True, compute='_compute_stage', store=True, readonly=False, diff --git a/addons/im_livechat/models/discuss_channel.py b/addons/im_livechat/models/discuss_channel.py index 5dc702bcc45..171cf4712a0 100644 --- a/addons/im_livechat/models/discuss_channel.py +++ b/addons/im_livechat/models/discuss_channel.py @@ -22,7 +22,7 @@ class DiscussChannel(models.Model): duration = fields.Float('Duration', compute='_compute_duration', help='Duration of the session in hours') livechat_active = fields.Boolean('Is livechat ongoing?', help='Livechat session is active until visitor leaves the conversation.') livechat_channel_id = fields.Many2one('im_livechat.channel', 'Channel') - livechat_operator_id = fields.Many2one('res.partner', string='Operator') + livechat_operator_id = fields.Many2one('res.partner', string='Operator', index='btree_not_null') chatbot_current_step_id = fields.Many2one('chatbot.script.step', string='Chatbot Current Step') chatbot_message_ids = fields.One2many('chatbot.message', 'discuss_channel_id', string='Chatbot Messages') country_id = fields.Many2one('res.country', string="Country", help="Country of the visitor of the channel") diff --git a/addons/portal_rating/models/rating_rating.py b/addons/portal_rating/models/rating_rating.py index 4a9ed3b094b..21e5cd2ca02 100644 --- a/addons/portal_rating/models/rating_rating.py +++ b/addons/portal_rating/models/rating_rating.py @@ -9,7 +9,8 @@ class Rating(models.Model): # Adding information for comment a rating message publisher_comment = fields.Text("Publisher comment") publisher_id = fields.Many2one('res.partner', 'Commented by', - ondelete='set null', readonly=True) + ondelete='set null', readonly=True, + index='btree_not_null') publisher_datetime = fields.Datetime("Commented on", readonly=True) @api.model_create_multi diff --git a/addons/purchase/models/purchase_order_line.py b/addons/purchase/models/purchase_order_line.py index 45d0fd86971..00a7ee26380 100644 --- a/addons/purchase/models/purchase_order_line.py +++ b/addons/purchase/models/purchase_order_line.py @@ -63,7 +63,7 @@ class PurchaseOrderLine(models.Model): qty_to_invoice = fields.Float(compute='_compute_qty_invoiced', string='To Invoice Quantity', store=True, readonly=True, digits='Product Unit of Measure') - partner_id = fields.Many2one('res.partner', related='order_id.partner_id', string='Partner', readonly=True, store=True) + partner_id = fields.Many2one('res.partner', related='order_id.partner_id', string='Partner', readonly=True, store=True, index='btree_not_null') currency_id = fields.Many2one(related='order_id.currency_id', store=True, string='Currency', readonly=True) date_order = fields.Datetime(related='order_id.date_order', string='Order Date', readonly=True) date_approve = fields.Datetime(related="order_id.date_approve", string='Confirmation Date', readonly=True) diff --git a/addons/sale/models/sale_order.py b/addons/sale/models/sale_order.py index 87d74ebfc41..aadff39eabf 100644 --- a/addons/sale/models/sale_order.py +++ b/addons/sale/models/sale_order.py @@ -139,13 +139,15 @@ class SaleOrder(models.Model): string="Invoice Address", compute='_compute_partner_invoice_id', store=True, readonly=False, required=True, precompute=True, - domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]") + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + index='btree_not_null') partner_shipping_id = fields.Many2one( comodel_name='res.partner', string="Delivery Address", compute='_compute_partner_shipping_id', store=True, readonly=False, required=True, precompute=True, - domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]",) + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + index='btree_not_null') fiscal_position_id = fields.Many2one( comodel_name='account.fiscal.position', diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 63fbdafc06e..5a9bf1f94bc 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -82,7 +82,8 @@ class StockMove(models.Model): partner_id = fields.Many2one( 'res.partner', 'Destination Address ', help="Optional address where goods are to be delivered, specifically used for allotment", - compute='_compute_partner_id', store=True, readonly=False) + compute='_compute_partner_id', store=True, readonly=False, + index='btree_not_null') move_dest_ids = fields.Many2many( 'stock.move', 'stock_move_move_rel', 'move_orig_id', 'move_dest_id', 'Destination Moves', copy=False, @@ -147,7 +148,8 @@ class StockMove(models.Model): readonly=True, help='Quantity in stock that can still be reserved for this move') # used to depict a restriction on the ownership of quants to consider when marking this move as 'done' restrict_partner_id = fields.Many2one( - 'res.partner', 'Owner ', check_company=True) + 'res.partner', 'Owner ', check_company=True, + index='btree_not_null') route_ids = fields.Many2many( 'stock.route', 'stock_route_move', 'move_id', 'route_id', 'Destination route', help="Preferred route") warehouse_id = fields.Many2one('stock.warehouse', 'Warehouse', help="the warehouse to consider for the route selection on the next procurement (if any).") diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index 4ee0bdf2a2f..ff5154ee22a 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -56,7 +56,7 @@ class StockMoveLine(models.Model): date = fields.Datetime('Date', default=fields.Datetime.now, required=True) owner_id = fields.Many2one( 'res.partner', 'From Owner', - check_company=True, + check_company=True, index='btree_not_null', help="When validating the transfer, the products will be taken from this owner.") location_id = fields.Many2one( 'stock.location', 'From', domain="[('usage', '!=', 'view')]", check_company=True, required=True, diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 40fa5c03f0e..5b904eb1fde 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -464,7 +464,7 @@ class Picking(models.Model): hide_picking_type = fields.Boolean(compute='_compute_hide_picking_type') partner_id = fields.Many2one( 'res.partner', 'Contact', - check_company=True) + check_company=True, index='btree_not_null') company_id = fields.Many2one( 'res.company', string='Company', related='picking_type_id.company_id', readonly=True, store=True, index=True) @@ -488,7 +488,7 @@ class Picking(models.Model): help='Technical Field used to decide whether the button "Allocation" should be displayed.') owner_id = fields.Many2one( 'res.partner', 'Assign Owner', - check_company=True, + check_company=True, index='btree_not_null', help="When validating the transfer, the products will be assigned to this owner.") printed = fields.Boolean('Printed', copy=False) signature = fields.Image('Signature', help='Signature', copy=False, attachment=True) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 733c8dd5926..57d5158cf6b 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -73,7 +73,8 @@ class StockQuant(models.Model): help='The package containing this quant', ondelete='restrict', check_company=True, index=True) owner_id = fields.Many2one( 'res.partner', 'Owner', - help='This is the owner of the quant', check_company=True) + help='This is the owner of the quant', check_company=True, + index='btree_not_null') quantity = fields.Float( 'Quantity', help='Quantity of products in this quant, in the default unit of measure of the product', diff --git a/addons/website_blog/models/website_blog.py b/addons/website_blog/models/website_blog.py index a301f3a1e5a..eaf4f91f99a 100644 --- a/addons/website_blog/models/website_blog.py +++ b/addons/website_blog/models/website_blog.py @@ -168,7 +168,7 @@ class BlogPost(models.Model): ''' name = fields.Char('Title', required=True, translate=True, default='') subtitle = fields.Char('Sub Title', translate=True) - author_id = fields.Many2one('res.partner', 'Author', default=lambda self: self.env.user.partner_id) + author_id = fields.Many2one('res.partner', 'Author', default=lambda self: self.env.user.partner_id, index='btree_not_null') author_avatar = fields.Binary(related='author_id.image_128', string="Avatar", readonly=False) author_name = fields.Char(related='author_id.display_name', string="Author Name", readonly=False, store=True) active = fields.Boolean('Active', default=True)