[IMP] domain widget performance fix
parent
bf8ba49e8b
commit
159c772efd
|
@ -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)
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue