configuration.py 1.38 KB
Newer Older
Luca Cristaldi's avatar
Luca Cristaldi committed
1 2
# This file is part of Tryton.  The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
Luca Cristaldi's avatar
Luca Cristaldi committed
3
from trytond.model import ModelView, ModelSQL, ModelSingleton, fields
4
from trytond.pyson import Eval
Luca Cristaldi's avatar
Luca Cristaldi committed
5 6
from trytond.modules.company.model import (CompanyMultiValueMixin,
                                           CompanyValueMixin)
7 8 9 10

__all__ = ['Configuration', 'MemberSequence']


Luca Cristaldi's avatar
Luca Cristaldi committed
11 12
class Configuration(ModelSingleton, ModelSQL, ModelView,
                    CompanyMultiValueMixin):
13 14
    """Association Configuration"""
    __name__ = 'association.configuration'
Luca Cristaldi's avatar
Luca Cristaldi committed
15
    member_sequence = fields.MultiValue(
16 17 18 19 20 21 22
        fields.Many2One('ir.sequence', "Member Sequence", required=True,
            domain=[
                ('company', 'in',
                    [Eval('context', {}).get('company', -1), None]),
                ('code', '=', 'association.member'),
            ],
            help="Used to generate the number given to association members."))
23 24 25 26 27


class MemberSequence(ModelSQL, CompanyValueMixin):
    """Member Configuration Sequence"""
    __name__ = 'association.configuration.member_sequence'
28 29 30 31 32 33 34 35
    member_sequence = fields.Many2One('ir.sequence', "Member Sequence",
        required=True,
        domain=[
            ('company', 'in',
            [Eval('company', -1), None]),
            ('code', '=', 'association.member'),
        ],
        depends=['company'])