From 55f1a6ecd7afc5bc4426cd330fb6986f2ad892fe Mon Sep 17 00:00:00 2001 From: Brice bib Bartoletti Date: Wed, 23 Nov 2022 17:10:05 +0000 Subject: [PATCH] [FIX] account,pos,stock_account:add/update indexes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1) forward-port of this PR: https://github.com/odoo/odoo/pull/97000 commit: c9209664ce3a4b10142bba4da6afb912afc983c2 2) use btree_not_null instead of simple btree for space optimisation closes odoo/odoo#106484 X-original-commit: b743e736f764fd7d6e232d2c8eaf6b2e314c5f31 Signed-off-by: William André (wan) Signed-off-by: Brice Bartoletti (bib) --- addons/account/models/account_full_reconcile.py | 2 +- addons/point_of_sale/models/pos_order.py | 2 +- addons/stock_account/models/stock_valuation_layer.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/account/models/account_full_reconcile.py b/addons/account/models/account_full_reconcile.py index 9516045ffba..4bfa8e38a05 100644 --- a/addons/account/models/account_full_reconcile.py +++ b/addons/account/models/account_full_reconcile.py @@ -9,7 +9,7 @@ class AccountFullReconcile(models.Model): name = fields.Char(string='Number', required=True, copy=False, default=lambda self: self.env['ir.sequence'].next_by_code('account.reconcile')) partial_reconcile_ids = fields.One2many('account.partial.reconcile', 'full_reconcile_id', string='Reconciliation Parts') reconciled_line_ids = fields.One2many('account.move.line', 'full_reconcile_id', string='Matched Journal Items') - exchange_move_id = fields.Many2one('account.move') + exchange_move_id = fields.Many2one('account.move', index="btree_not_null") def unlink(self): """ When removing a full reconciliation, we need to revert the eventual journal entries we created to book the diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 61c903d36e8..0e38a5da4d2 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -265,7 +265,7 @@ class PosOrder(models.Model): [('draft', 'New'), ('cancel', 'Cancelled'), ('paid', 'Paid'), ('done', 'Posted'), ('invoiced', 'Invoiced')], 'Status', readonly=True, copy=False, default='draft') - account_move = fields.Many2one('account.move', string='Invoice', readonly=True, copy=False, index=True) + account_move = fields.Many2one('account.move', string='Invoice', readonly=True, copy=False, index="btree_not_null") picking_ids = fields.One2many('stock.picking', 'pos_order_id') picking_count = fields.Integer(compute='_compute_picking_count') failed_pickings = fields.Boolean(compute='_compute_picking_count') diff --git a/addons/stock_account/models/stock_valuation_layer.py b/addons/stock_account/models/stock_valuation_layer.py index 9b62a24d00a..7191c2fcb10 100644 --- a/addons/stock_account/models/stock_valuation_layer.py +++ b/addons/stock_account/models/stock_valuation_layer.py @@ -28,8 +28,8 @@ class StockValuationLayer(models.Model): stock_valuation_layer_id = fields.Many2one('stock.valuation.layer', 'Linked To', readonly=True, check_company=True) stock_valuation_layer_ids = fields.One2many('stock.valuation.layer', 'stock_valuation_layer_id') stock_move_id = fields.Many2one('stock.move', 'Stock Move', readonly=True, check_company=True, index=True) - account_move_id = fields.Many2one('account.move', 'Journal Entry', readonly=True, check_company=True) - account_move_line_id = fields.Many2one('account.move.line', 'Invoice Line', readonly=True, check_company=True, index=True) + account_move_id = fields.Many2one('account.move', 'Journal Entry', readonly=True, check_company=True, index="btree_not_null") + account_move_line_id = fields.Many2one('account.move.line', 'Invoice Line', readonly=True, check_company=True, index="btree_not_null") reference = fields.Char(related='stock_move_id.reference') price_diff_value = fields.Float('Invoice value correction with invoice currency')