Browse Source

[IMP] domain widget performance fix

pull/660/head
Joan Sisquella 4 years ago
parent
commit
c50b198f27
  1. 8
      account_financial_report/models/account_move_line.py
  2. 3
      account_financial_report/wizard/general_ledger_wizard_view.xml

8
account_financial_report/models/account_move_line.py

@ -28,3 +28,11 @@ class AccountMoveLine(models.Model):
self._cr.execute(""" self._cr.execute("""
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)

3
account_financial_report/wizard/general_ledger_wizard_view.xml

@ -71,7 +71,8 @@
<field name="analytic_tag_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/> <field name="analytic_tag_ids" widget="many2many_tags" nolabel="1" options="{'no_create': True}"/>
</page> </page>
<page string="Additional Filtering"> <page string="Additional Filtering">
<field name="domain" widget="domain" options="{'model': 'account.move.line', 'in_dialog': True}"/>
<style>.o_domain_show_selection_button {display: none}</style>
<field name="domain" widget="domain" options="{'model': 'account.move.line', 'in_dialog': True}" context="{'skip_search_count': 1}"/>
</page> </page>
</notebook> </notebook>
</div> </div>

Loading…
Cancel
Save