changeset c83414c63fee in modules/account_payment_braintree:default
details:
https://hg.tryton.org/modules/account_payment_braintree?cmd=changeset&node=c83414c63fee
description:
Use declarative index definition for ModelSQL
issue5757
review361251002
diffstat:
account.py | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (35 lines):
diff -r 3e154c3ca24a -r c83414c63fee account.py
--- a/account.py Sun Oct 09 13:15:41 2022 +0200
+++ b/account.py Tue Oct 11 00:44:49 2022 +0200
@@ -19,7 +19,7 @@
from trytond.config import config
from trytond.i18n import gettext
from trytond.model import (
- DeactivableMixin, ModelSQL, ModelView, Workflow, fields)
+ DeactivableMixin, Index, ModelSQL, ModelView, Workflow, fields)
from trytond.modules.account_payment.exceptions import (
PaymentValidationError, ProcessError)
from trytond.modules.company.model import (
@@ -576,6 +576,13 @@
@classmethod
def __setup__(cls):
super().__setup__()
+ t = cls.__table__()
+ cls._sql_indexes.add(
+ Index(
+ t,
+ (t.state, Index.Equality()),
+ where=t.state.in_([
+ 'draft', 'submitted', 'approved', 'processing'])))
cls.__access__.add('payment')
cls._transitions |= set((
('draft', 'submitted'),
@@ -904,7 +911,7 @@
__name__ = 'account.payment.braintree.customer'
_history = True
party = fields.Many2One(
- 'party.party', "Party", required=True, select=True,
+ 'party.party', "Party", required=True,
states={
'readonly': (
Eval('braintree_customer_id') | Eval('braintree_nonce')),