GL detail
This commit is contained in:
@@ -10,6 +10,7 @@ from dateutil.relativedelta import relativedelta
|
||||
from sql import Column, Literal, Null, Union, Window
|
||||
from sql.aggregate import Count, Max, Min, Sum
|
||||
from sql.conditionals import Case, Coalesce
|
||||
from sql.operators import Concat
|
||||
|
||||
from trytond import backend
|
||||
from trytond.i18n import gettext
|
||||
@@ -2851,14 +2852,17 @@ class GeneralLedgerDetail(DescriptionOriginMixin, ModelSQL, ModelView):
|
||||
return None, None
|
||||
return Lot.__table__(), Uom.__table__()
|
||||
|
||||
@classmethod
|
||||
def _account_label(cls, account):
|
||||
return Concat(
|
||||
Concat(Coalesce(account.code, ''), ' - '),
|
||||
Coalesce(account.name, ''))
|
||||
|
||||
@classmethod
|
||||
def _line_query(cls, name, context):
|
||||
Line, line, move, account, company = cls._tables()
|
||||
lot, uom = cls._lot_tables(Line)
|
||||
account_label = (
|
||||
Coalesce(account.code, '')
|
||||
+ Literal(' - ')
|
||||
+ Coalesce(account.name, ''))
|
||||
account_label = cls._account_label(account)
|
||||
quantity = Literal(None)
|
||||
unit = Literal(None)
|
||||
from_ = (line.join(move, condition=line.move == move.id)
|
||||
@@ -2943,10 +2947,7 @@ class GeneralLedgerDetail(DescriptionOriginMixin, ModelSQL, ModelView):
|
||||
@classmethod
|
||||
def _summary_query(cls, name, context):
|
||||
Line, line, move, account, company = cls._tables()
|
||||
account_label = (
|
||||
Coalesce(account.code, '')
|
||||
+ Literal(' - ')
|
||||
+ Coalesce(account.name, ''))
|
||||
account_label = cls._account_label(account)
|
||||
tx_currency = Coalesce(line.second_currency, company.currency)
|
||||
base_amount = Coalesce(line.debit, 0) - Coalesce(line.credit, 0)
|
||||
tx_amount = Case(
|
||||
|
||||
@@ -2119,6 +2119,12 @@ class AccountTestCase(
|
||||
'document_number']:
|
||||
self.assertIn(name, DetailContext._fields)
|
||||
|
||||
account = pool.get('account.account').__table__()
|
||||
account_label = Detail._account_label(account)
|
||||
self.assertIn('||', str(account_label))
|
||||
self.assertNotIn(' + ', str(account_label))
|
||||
self.assertEqual(account_label.params, ('', ' - ', ''))
|
||||
|
||||
@with_transaction()
|
||||
def test_general_ledger_detail_date_contexts(self):
|
||||
"Test General Ledger Detail opening and movement date contexts"
|
||||
|
||||
Reference in New Issue
Block a user