[FIX] account,pos,stock_account:add/update indexes

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) <wan@odoo.com>
Signed-off-by: Brice Bartoletti (bib) <bib@odoo.com>
This commit is contained in:
Brice bib Bartoletti
2022-11-24 23:18:44 +01:00
parent 875244b08e
commit 55f1a6ecd7
3 changed files with 4 additions and 4 deletions
@@ -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
+1 -1
View File
@@ -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')
@@ -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')