Allow RPC on get_by_bank_account of statement journal
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Allow RPC on get_by_bank_account of statement journal
|
||||
* Search statement journal by bank account and currency
|
||||
* Support second currency on statement line
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from trytond.model import DeactivableMixin, ModelSQL, ModelView, Unique, fields
|
||||
from trytond.pool import Pool
|
||||
from trytond.pyson import Eval
|
||||
from trytond.rpc import RPC
|
||||
from trytond.transaction import Transaction
|
||||
|
||||
|
||||
@@ -59,6 +60,10 @@ class Journal(DeactivableMixin, ModelSQL, ModelView):
|
||||
Unique(t, t.bank_account, t.company),
|
||||
'account_statement.msg_journal_bank_account_unique'),
|
||||
]
|
||||
cls.__rpc__.update(
|
||||
get_by_bank_account=RPC(
|
||||
result=lambda r: int(r) if r is not None else None),
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def default_currency():
|
||||
|
||||
@@ -8,7 +8,7 @@ Imports::
|
||||
>>> from trytond.modules.account.tests.tools import create_chart, get_accounts
|
||||
>>> from trytond.modules.company.tests.tools import create_company, get_company
|
||||
>>> from trytond.modules.currency.tests.tools import get_currency
|
||||
>>> from trytond.tests.tools import activate_modules
|
||||
>>> from trytond.tests.tools import activate_modules, assertEqual
|
||||
|
||||
Activate modules::
|
||||
|
||||
@@ -64,3 +64,17 @@ Change currency of bank account::
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
AccountValidationError: ...
|
||||
|
||||
Get journal by bank account::
|
||||
|
||||
>>> assertEqual(
|
||||
... StatementJournal.get_by_bank_account(
|
||||
... company.id, 'BE82068896274468', context={}),
|
||||
... statement_journal.id)
|
||||
>>> assertEqual(
|
||||
... StatementJournal.get_by_bank_account(
|
||||
... company.id, 'BE82068896274468', 'EUR', context={}),
|
||||
... statement_journal.id)
|
||||
>>> StatementJournal.get_by_bank_account(company.id, 'foo', context={})
|
||||
>>> StatementJournal.get_by_bank_account(
|
||||
... company.id, 'BE82068896274468', 'USD', context={})
|
||||
|
||||
Reference in New Issue
Block a user