Tryton 6.8: indexe neu, tests angepaßt
This commit is contained in:
parent
2cf42eb9f6
commit
2b6731d071
11 changed files with 143 additions and 52 deletions
10
model.py
10
model.py
|
@ -3,7 +3,8 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the
|
||||
# full copyright notices and license terms.
|
||||
|
||||
from trytond.model import MultiValueMixin, ValueMixin, fields, Unique, Model
|
||||
from trytond.model import (
|
||||
MultiValueMixin, ValueMixin, fields, Unique, Model, Index)
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond.cache import MemoryCache
|
||||
|
@ -290,12 +291,17 @@ def order_name_hierarchical(model_name, tables):
|
|||
class UserValueMixin(ValueMixin):
|
||||
iduser = fields.Many2One(
|
||||
model_name='res.user', string="User",
|
||||
select=True, ondelete='CASCADE', required=True)
|
||||
ondelete='CASCADE', required=True)
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(UserValueMixin, cls).__setup__()
|
||||
tab_val = cls.__table__()
|
||||
cls._sql_indexes.update({
|
||||
Index(
|
||||
tab_val,
|
||||
(tab_val.iduser, Index.Equality())),
|
||||
})
|
||||
cls._sql_constraints.extend([
|
||||
('val_uniq',
|
||||
Unique(tab_val, tab_val.iduser),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue