[IMP] domain widget performance fix

pull/939/head
Joan Sisquella 2020-08-20 11:31:18 +02:00 committed by David Ramia
parent 9f5e01683f
commit cace7052c3
2 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# Copyright 2019 ACSONE SA/NV (<http://acsone.eu>) # Copyright 2019 ACSONE SA/NV (<http://acsone.eu>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).- # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).-
from odoo import models from odoo import api, models
class AccountMoveLine(models.Model): class AccountMoveLine(models.Model):
@ -30,3 +30,11 @@ class AccountMoveLine(models.Model):
CREATE INDEX account_move_line_account_id_partner_id_index CREATE INDEX account_move_line_account_id_partner_id_index
ON account_move_line (account_id, partner_id)""" ON account_move_line (account_id, partner_id)"""
) )
@api.model
def search_count(self, args):
# In Big DataBase every time you change the domain widget this method
# takes a lot of time. This improves performance
if self.env.context.get("skip_search_count"):
return 0
return super(AccountMoveLine, self).search_count(args)

View File

@ -94,10 +94,13 @@
/> />
</page> </page>
<page string="Additional Filtering"> <page string="Additional Filtering">
<style
>.o_domain_show_selection_button {display: none}</style>
<field <field
name="domain" name="domain"
widget="domain" widget="domain"
options="{'model': 'account.move.line', 'in_dialog': True}" options="{'model': 'account.move.line', 'in_dialog': True}"
context="{'skip_search_count': 1}"
/> />
</page> </page>
</notebook> </notebook>