trytond-account_es_pyme/account.py

53 lines
1.4 KiB
Python
Raw Permalink Normal View History

2018-01-08 19:13:55 +01:00
# The COPYRIGHT file at the top level of this repository contains the full
# copyright notices and license terms.
2017-07-14 17:09:10 +02:00
from trytond.model import fields
from trytond.pool import PoolMeta
__all__ = ['Account', 'FiscalYear', 'Period']
class Account:
2016-03-29 11:43:11 +02:00
__metaclass__ = PoolMeta
__name__ = 'account.account'
@classmethod
def __setup__(cls):
super(Account, cls).__setup__()
value = ('efective', 'Efective')
2018-01-08 19:13:55 +01:00
if value not in cls.kind.selection:
cls.kind.selection.append(value)
class FiscalYear:
__metaclass__ = PoolMeta
__name__ = 'account.fiscalyear'
code = fields.Char('Code', size=None)
@classmethod
def search_rec_name(cls, name, clause):
if clause[1].startswith('!') or clause[1].startswith('not '):
bool_op = 'AND'
else:
bool_op = 'OR'
return [bool_op,
('code',) + tuple(clause[1:]),
(cls._rec_name,) + tuple(clause[1:]),
]
class Period:
__metaclass__ = PoolMeta
__name__ = 'account.period'
code = fields.Char('Code', size=None)
@classmethod
def search_rec_name(cls, name, clause):
if clause[1].startswith('!') or clause[1].startswith('not '):
bool_op = 'AND'
else:
bool_op = 'OR'
return [bool_op,
('code',) + tuple(clause[1:]),
(cls._rec_name,) + tuple(clause[1:]),
]