changeset 5ca9b1b466a7 in modules/account_es_sii:default
details: 
https://hg.tryton.org/modules/account_es_sii?cmd=changeset&node=5ca9b1b466a7
description:
        Use declarative index definition for ModelSQL

        issue5757
        review361251002
diffstat:

 account.py |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (33 lines):

diff -r 0b6b3f25cad8 -r 5ca9b1b466a7 account.py
--- a/account.py        Tue Oct 04 08:49:40 2022 +0200
+++ b/account.py        Tue Oct 11 00:44:49 2022 +0200
@@ -11,7 +11,7 @@
 
 from trytond.config import config
 from trytond.i18n import gettext
-from trytond.model import ModelSQL, ModelView, Unique, Workflow, fields
+from trytond.model import Index, ModelSQL, ModelView, Unique, Workflow, fields
 from trytond.model.exceptions import AccessError
 from trytond.modules.company.model import CompanyValueMixin
 from trytond.pool import Pool, PoolMeta
@@ -269,7 +269,7 @@
             ('sent', "Sent"),
             ('wrong', "Wrong"),
             ('rejected', "Rejected"),
-            ], "State", readonly=True, select=True)
+            ], "State", readonly=True)
 
     @classmethod
     def __setup__(cls):
@@ -281,6 +281,11 @@
             ('invoice_unique', Unique(t, t.invoice),
                 'account_es_sii.msg_es_sii_invoice_unique'),
             ]
+        cls._sql_indexes.add(
+            Index(
+                t,
+                (t.state, Index.Equality()),
+                where=t.state.in_(['pending', 'wrong', 'rejected'])))
 
     @classmethod
     def default_state(cls):

Reply via email to