Backport missing features in general ledger from account_jasper_reports (#8)
* Backport missing features in general ledger from account_jasper_reports #159087 * double comment * get or none * replace fiscal_year None to '' --------- Co-authored-by: Bernat <bernat@nan-tic.com>
This commit is contained in:
parent
be2b099a97
commit
e445748364
|
@ -22,8 +22,14 @@ class PrintGeneralLedgerStart(ModelView):
|
|||
'Print General Ledger'
|
||||
__name__ = 'account_reports.print_general_ledger.start'
|
||||
fiscalyear = fields.Many2One('account.fiscalyear', 'Fiscal Year',
|
||||
required=True)
|
||||
states={
|
||||
'invisible': Eval('start_date') | Eval('end_date'),
|
||||
'required': ~Eval('start_date') & ~Eval('end_date'),
|
||||
})
|
||||
start_period = fields.Many2One('account.period', 'Start Period',
|
||||
states={
|
||||
'invisible': Eval('start_date') | Eval('end_date'),
|
||||
},
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
If(Bool(Eval('end_period')),
|
||||
|
@ -32,6 +38,9 @@ class PrintGeneralLedgerStart(ModelView):
|
|||
),
|
||||
], depends=['fiscalyear', 'end_period'])
|
||||
end_period = fields.Many2One('account.period', 'End Period',
|
||||
states={
|
||||
'invisible': Eval('start_date') | Eval('end_date'),
|
||||
},
|
||||
domain=[
|
||||
('fiscalyear', '=', Eval('fiscalyear')),
|
||||
If(Bool(Eval('start_period')),
|
||||
|
@ -40,6 +49,30 @@ class PrintGeneralLedgerStart(ModelView):
|
|||
),
|
||||
],
|
||||
depends=['fiscalyear', 'start_period'])
|
||||
start_date = fields.Date('Initial Posting Date',
|
||||
domain=[
|
||||
If(Eval('start_date') & Eval('end_date'),
|
||||
('start_date', '<=', Eval('end_date', None)),
|
||||
()),
|
||||
],
|
||||
states={
|
||||
'invisible': Eval('start_period') | Eval('end_period'),
|
||||
'required': ((Eval('start_date') | Eval('end_date')) &
|
||||
~Bool(Eval('start_period') | Eval('end_period'))),
|
||||
},
|
||||
depends=['end_date'])
|
||||
end_date = fields.Date('Final Posting Date',
|
||||
domain=[
|
||||
If(Eval('start_date') & Eval('end_date'),
|
||||
('end_date', '>=', Eval('start_date', None)),
|
||||
()),
|
||||
],
|
||||
states={
|
||||
'invisible': Bool(Eval('periods')),
|
||||
'required': ((Eval('end_date') | Eval('start_date')) &
|
||||
~Bool(Eval('start_period') | Eval('end_period')))
|
||||
},
|
||||
depends=['start_date'])
|
||||
accounts = fields.Many2Many('account.account', None, None, 'Accounts')
|
||||
all_accounts = fields.Boolean('All accounts with and without balance',
|
||||
help='If unchecked only print accounts with previous balance different'
|
||||
|
@ -104,9 +137,11 @@ class PrintGeneralLedger(Wizard):
|
|||
end_period = self.start.end_period.id
|
||||
data = {
|
||||
'company': self.start.company.id,
|
||||
'fiscalyear': self.start.fiscalyear.id,
|
||||
'fiscalyear': self.start.fiscalyear.id if self.start.fiscalyear else None,
|
||||
'start_period': start_period,
|
||||
'end_period': end_period,
|
||||
'start_date': self.start.start_date,
|
||||
'end_date': self.start.end_date,
|
||||
'accounts': [x.id for x in self.start.accounts],
|
||||
'all_accounts': self.start.all_accounts,
|
||||
'parties': [x.id for x in self.start.parties],
|
||||
|
@ -146,6 +181,7 @@ class GeneralLedgerReport(HTMLReport):
|
|||
@classmethod
|
||||
def prepare(cls, data):
|
||||
pool = Pool()
|
||||
Company = pool.get('company.company')
|
||||
FiscalYear = pool.get('account.fiscalyear')
|
||||
Period = pool.get('account.period')
|
||||
Account = pool.get('account.account')
|
||||
|
@ -176,13 +212,16 @@ class GeneralLedgerReport(HTMLReport):
|
|||
key = currentKey[0].id
|
||||
return key
|
||||
|
||||
fiscalyear = FiscalYear(data['fiscalyear'])
|
||||
fiscalyear = (FiscalYear(data['fiscalyear']) if data.get('fiscalyear')
|
||||
else None)
|
||||
start_period = None
|
||||
if data['start_period']:
|
||||
start_period = Period(data['start_period'])
|
||||
end_period = None
|
||||
if data['end_period']:
|
||||
end_period = Period(data['end_period'])
|
||||
start_date = data.get('start_date', None)
|
||||
end_date = data.get('end_date', None)
|
||||
with Transaction().set_context(active_test=False):
|
||||
accounts = Account.browse(data.get('accounts', []))
|
||||
parties = Party.browse(data.get('parties', []))
|
||||
|
@ -208,7 +247,12 @@ class GeneralLedgerReport(HTMLReport):
|
|||
else:
|
||||
parties_subtitle = ''
|
||||
|
||||
company = fiscalyear.company
|
||||
if data['company']:
|
||||
company = Company(data['company'])
|
||||
elif fiscalyear:
|
||||
company = fiscalyear.company
|
||||
else:
|
||||
company = Company(Transaction().context.get('company', -1))
|
||||
|
||||
parameters = {}
|
||||
parameters['company'] = company.rec_name
|
||||
|
@ -216,7 +260,11 @@ class GeneralLedgerReport(HTMLReport):
|
|||
and company.party.tax_identifier.code) or ''
|
||||
parameters['start_period'] = start_period and start_period or ''
|
||||
parameters['end_period'] = end_period and end_period or ''
|
||||
parameters['fiscal_year'] = fiscalyear.rec_name
|
||||
parameters['start_date'] = (start_date.strftime('%d/%m/%Y')
|
||||
if start_date else '')
|
||||
parameters['end_date'] = (end_date.strftime('%d/%m/%Y')
|
||||
if end_date else '')
|
||||
parameters['fiscal_year'] = fiscalyear.rec_name if fiscalyear else ''
|
||||
parameters['accounts'] = accounts_subtitle
|
||||
parameters['parties'] = parties_subtitle
|
||||
parameters['now'] = format_datetime(datetime.now(), format='short',
|
||||
|
@ -229,10 +277,15 @@ class GeneralLedgerReport(HTMLReport):
|
|||
else:
|
||||
where += "aa.parent is not null "
|
||||
|
||||
filter_periods = fiscalyear.get_periods(start_period, end_period)
|
||||
|
||||
where += "and am.period in (%s) " % (
|
||||
",".join([str(a.id) for a in filter_periods]))
|
||||
if start_date:
|
||||
if company:
|
||||
where += "and am.company = %s " % company.id
|
||||
where += "and am.date >= '%s' " % start_date
|
||||
where += "and am.date <= '%s' " % end_date
|
||||
else:
|
||||
filter_periods = fiscalyear.get_periods(start_period, end_period)
|
||||
where += "and am.period in (%s) " % (
|
||||
",".join([str(a.id) for a in filter_periods]))
|
||||
|
||||
if parties:
|
||||
where += " and aml.party in (%s)" % (
|
||||
|
@ -256,8 +309,9 @@ class GeneralLedgerReport(HTMLReport):
|
|||
aml.account,
|
||||
-- Sort by party only when account is of
|
||||
-- type 'receivable' or 'payable'
|
||||
CASE WHEN aat.receivable or aat.payable THEN
|
||||
aml.party ELSE 0 END,
|
||||
-- or party_requierd is True
|
||||
CASE WHEN aat.receivable or aat.payable or
|
||||
aa.party_required THEN aml.party ELSE 0 END,
|
||||
am.date,
|
||||
am.id,
|
||||
am.description,
|
||||
|
@ -265,8 +319,9 @@ class GeneralLedgerReport(HTMLReport):
|
|||
""" % where)
|
||||
line_ids = [x[0] for x in cursor.fetchall()]
|
||||
|
||||
start_date = (start_period.start_date if start_period
|
||||
else fiscalyear.start_date)
|
||||
if not start_date:
|
||||
start_date = (start_period.start_date if start_period
|
||||
else fiscalyear.start_date)
|
||||
initial_balance_date = start_date - timedelta(days=1)
|
||||
with Transaction().set_context(date=initial_balance_date):
|
||||
init_values = {}
|
||||
|
@ -274,7 +329,7 @@ class GeneralLedgerReport(HTMLReport):
|
|||
init_values = Account.read_account_vals(accounts,
|
||||
with_moves=False, exclude_party_moves=True)
|
||||
init_party_values = Party.get_account_values_by_party(
|
||||
parties, accounts, fiscalyear.company)
|
||||
parties, accounts, company)
|
||||
|
||||
records = {}
|
||||
parties_general_ledger = set()
|
||||
|
@ -404,41 +459,48 @@ class GeneralLedgerReport(HTMLReport):
|
|||
'total_credit': credit,
|
||||
}
|
||||
|
||||
if parties:
|
||||
if parties or parties_general_ledger:
|
||||
account_ids = [k for k, _ in init_party_values.items()]
|
||||
accounts = dict((a.id, a) for a in Account.browse(account_ids))
|
||||
parties = dict((p.id, p) for p in parties)
|
||||
if parties:
|
||||
parties = dict((p.id, p) for p in parties)
|
||||
elif parties_general_ledger:
|
||||
parties = dict((p, Party(p))
|
||||
for a, av in init_party_values.items()
|
||||
for p, pv in av.items()
|
||||
if p and p not in parties_general_ledger)
|
||||
|
||||
for k, v in init_party_values.items():
|
||||
account = accounts[k]
|
||||
for p, z in v.items():
|
||||
# check if party is in current general ledger
|
||||
if p in parties_general_ledger:
|
||||
continue
|
||||
party = parties[p]
|
||||
if account.type.receivable or account.type.payable:
|
||||
currentKey = (account, party)
|
||||
else:
|
||||
currentKey = (account,)
|
||||
sequence += 1
|
||||
credit = z.get('credit', Decimal(0))
|
||||
debit = z.get('debit', Decimal(0))
|
||||
balance = z.get('balance', Decimal(0))
|
||||
if parties:
|
||||
for k, v in init_party_values.items():
|
||||
account = accounts[k]
|
||||
for p, z in v.items():
|
||||
# check if party is in current general ledger
|
||||
if p in parties_general_ledger:
|
||||
continue
|
||||
party = parties[p]
|
||||
if account.type.receivable or account.type.payable:
|
||||
currentKey = (account, party)
|
||||
else:
|
||||
currentKey = (account,)
|
||||
sequence += 1
|
||||
credit = z.get('credit', Decimal(0))
|
||||
debit = z.get('debit', Decimal(0))
|
||||
balance = z.get('balance', Decimal(0))
|
||||
|
||||
key = _get_key(currentKey)
|
||||
if records.get(key):
|
||||
records[key]['total_debit'] += debit
|
||||
records[key]['total_credit'] += credit
|
||||
else:
|
||||
records[key] = {
|
||||
'account': account.name,
|
||||
'code': account.code or str(account.id),
|
||||
'lines': [],
|
||||
'party_required': account.party_required,
|
||||
'previous_balance': (balance + credit - debit),
|
||||
'total_debit': debit,
|
||||
'total_credit': credit,
|
||||
}
|
||||
key = _get_key(currentKey)
|
||||
if records.get(key):
|
||||
records[key]['total_debit'] += debit
|
||||
records[key]['total_credit'] += credit
|
||||
else:
|
||||
records[key] = {
|
||||
'account': account.name,
|
||||
'code': account.code or str(account.id),
|
||||
'lines': [],
|
||||
'party_required': account.party_required,
|
||||
'previous_balance': (balance + credit - debit),
|
||||
'total_debit': debit,
|
||||
'total_credit': credit,
|
||||
}
|
||||
|
||||
accounts = {}
|
||||
for record in records.keys():
|
||||
|
|
|
@ -8,14 +8,14 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2023-05-09 16:54+0200\n"
|
||||
"POT-Creation-Date: 2023-05-17 16:32+0200\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.10.3\n"
|
||||
"Generated-By: Babel 2.11.0\n"
|
||||
|
||||
#: templates/detail_lines_macro.html:7 templates/detail_macro.html:15
|
||||
msgid "Previous balance..."
|
||||
|
@ -69,35 +69,43 @@ msgstr ""
|
|||
msgid "VAT"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:41
|
||||
msgid "Fiscal Year"
|
||||
#: templates/header_macro.html:42
|
||||
msgid "Start Date"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:42
|
||||
msgid "End Date"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
msgid "Fiscal Year"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:45
|
||||
msgid "Start Period"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:43
|
||||
#: templates/header_macro.html:46
|
||||
msgid "End Period"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
#: templates/header_macro.html:48
|
||||
msgid "Parties"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
#: templates/header_macro.html:48
|
||||
msgid "All Parties"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:45
|
||||
#: templates/header_macro.html:49
|
||||
msgid "Accounts"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:45
|
||||
#: templates/header_macro.html:49
|
||||
msgid "All Accounts"
|
||||
msgstr ""
|
||||
|
||||
#: templates/header_macro.html:50
|
||||
#: templates/header_macro.html:54
|
||||
msgid ""
|
||||
"When the Move number is between '()' means it hasn't Post Number and the "
|
||||
"shown number is the provisional one."
|
||||
|
|
|
@ -38,9 +38,13 @@ header {
|
|||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
{{ _('Fiscal Year') }}: {{ data['parameters']['fiscal_year'] }}
|
||||
{% if data['parameters']['start_period'] %} {{ _('Start Period') }}: {{ data['parameters']['start_period'].name|render }}{% endif %}
|
||||
{% if data['parameters']['end_period'] %} {{ _('End Period') }}: {{ data['parameters']['end_period'].name|render }}{% endif %} <br>
|
||||
{% if data['parameters']['start_date'] %}
|
||||
<p>{{ _('Start Date') }}: {{ data['parameters']['start_date'] }} {{ _('End Date') }}: {{ data['parameters']['end_date'] }}</p>
|
||||
{% else %}
|
||||
<p>{{ _('Fiscal Year') }}: {{ data['parameters']['fiscal_year'] }}
|
||||
{% if data['parameters']['start_period'] %} {{ _('Start Period') }}: {{ data['parameters']['start_period'].name|render }}{% endif %}
|
||||
{% if data['parameters']['end_period'] %} {{ _('End Period') }}: {{ data['parameters']['end_period'].name|render }}{% endif %}</p>
|
||||
{% endif %}
|
||||
{% if data['parameters']['parties'] %}{{ _('Parties') }}: {{ data['parameters']['parties'] }}{% else %}{{ _('All Parties' )}}{% endif %}<br/>
|
||||
{% if data['parameters']['accounts'] %}{{ _('Accounts') }}: {{ data['parameters']['accounts'] }}{% else %}{{ _('All Accounts' )}}{% endif %}
|
||||
</td>
|
||||
|
|
Binary file not shown.
|
@ -7,8 +7,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2023-05-09 16:54+0200\n"
|
||||
"PO-Revision-Date: 2023-05-09 16:54+0200\n"
|
||||
"POT-Creation-Date: 2023-05-17 16:32+0200\n"
|
||||
"PO-Revision-Date: 2023-05-17 16:33+0200\n"
|
||||
"Last-Translator: \n"
|
||||
"Language: es\n"
|
||||
"Language-Team: es <LL@li.org>\n"
|
||||
|
@ -16,7 +16,7 @@ msgstr ""
|
|||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.10.3\n"
|
||||
"Generated-By: Babel 2.11.0\n"
|
||||
"X-Generator: Poedit 2.4.2\n"
|
||||
|
||||
#: templates/detail_lines_macro.html:7 templates/detail_macro.html:15
|
||||
|
@ -71,35 +71,43 @@ msgstr "Llibre major"
|
|||
msgid "VAT"
|
||||
msgstr "NIF"
|
||||
|
||||
#: templates/header_macro.html:41
|
||||
#: templates/header_macro.html:42
|
||||
msgid "Start Date"
|
||||
msgstr "Data de comptabilització inicial"
|
||||
|
||||
#: templates/header_macro.html:42
|
||||
msgid "End Date"
|
||||
msgstr "Data de comptabilització final"
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
msgid "Fiscal Year"
|
||||
msgstr "Exercisi fiscal"
|
||||
|
||||
#: templates/header_macro.html:42
|
||||
#: templates/header_macro.html:45
|
||||
msgid "Start Period"
|
||||
msgstr "Període inicial"
|
||||
|
||||
#: templates/header_macro.html:43
|
||||
#: templates/header_macro.html:46
|
||||
msgid "End Period"
|
||||
msgstr "Període final"
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
#: templates/header_macro.html:48
|
||||
msgid "Parties"
|
||||
msgstr "Tercers"
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
#: templates/header_macro.html:48
|
||||
msgid "All Parties"
|
||||
msgstr "Tots els tercers"
|
||||
|
||||
#: templates/header_macro.html:45
|
||||
#: templates/header_macro.html:49
|
||||
msgid "Accounts"
|
||||
msgstr "Comptes"
|
||||
|
||||
#: templates/header_macro.html:45
|
||||
#: templates/header_macro.html:49
|
||||
msgid "All Accounts"
|
||||
msgstr "Tots els comptes"
|
||||
|
||||
#: templates/header_macro.html:50
|
||||
#: templates/header_macro.html:54
|
||||
msgid ""
|
||||
"When the Move number is between '()' means it hasn't Post Number and the "
|
||||
"shown number is the provisional one."
|
||||
|
|
Binary file not shown.
|
@ -7,8 +7,8 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: PROJECT VERSION\n"
|
||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||
"POT-Creation-Date: 2023-05-09 16:54+0200\n"
|
||||
"PO-Revision-Date: 2023-05-09 16:54+0200\n"
|
||||
"POT-Creation-Date: 2023-05-17 16:32+0200\n"
|
||||
"PO-Revision-Date: 2023-05-17 16:34+0200\n"
|
||||
"Last-Translator: \n"
|
||||
"Language: es\n"
|
||||
"Language-Team: es <LL@li.org>\n"
|
||||
|
@ -16,7 +16,7 @@ msgstr ""
|
|||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=utf-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Generated-By: Babel 2.10.3\n"
|
||||
"Generated-By: Babel 2.11.0\n"
|
||||
"X-Generator: Poedit 2.4.2\n"
|
||||
|
||||
#: templates/detail_lines_macro.html:7 templates/detail_macro.html:15
|
||||
|
@ -71,35 +71,43 @@ msgstr "Libro mayor"
|
|||
msgid "VAT"
|
||||
msgstr "NIF"
|
||||
|
||||
#: templates/header_macro.html:41
|
||||
#: templates/header_macro.html:42
|
||||
msgid "Start Date"
|
||||
msgstr "Fecha de contabilización inicial"
|
||||
|
||||
#: templates/header_macro.html:42
|
||||
msgid "End Date"
|
||||
msgstr "Fecha de contabilización final"
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
msgid "Fiscal Year"
|
||||
msgstr "Ejercicio fiscal"
|
||||
|
||||
#: templates/header_macro.html:42
|
||||
#: templates/header_macro.html:45
|
||||
msgid "Start Period"
|
||||
msgstr "Período inicial"
|
||||
|
||||
#: templates/header_macro.html:43
|
||||
#: templates/header_macro.html:46
|
||||
msgid "End Period"
|
||||
msgstr "Período final"
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
#: templates/header_macro.html:48
|
||||
msgid "Parties"
|
||||
msgstr "Terceros"
|
||||
|
||||
#: templates/header_macro.html:44
|
||||
#: templates/header_macro.html:48
|
||||
msgid "All Parties"
|
||||
msgstr "Todos los terceros"
|
||||
|
||||
#: templates/header_macro.html:45
|
||||
#: templates/header_macro.html:49
|
||||
msgid "Accounts"
|
||||
msgstr "Cuentas"
|
||||
|
||||
#: templates/header_macro.html:45
|
||||
#: templates/header_macro.html:49
|
||||
msgid "All Accounts"
|
||||
msgstr "Todas las cuentas"
|
||||
|
||||
#: templates/header_macro.html:50
|
||||
#: templates/header_macro.html:54
|
||||
msgid ""
|
||||
"When the Move number is between '()' means it hasn't Post Number and the "
|
||||
"shown number is the provisional one."
|
||||
|
|
|
@ -14,6 +14,10 @@ msgctxt "field:account_reports.print_general_ledger.start,company:"
|
|||
msgid "Company"
|
||||
msgstr "Empresa"
|
||||
|
||||
msgctxt "field:account_reports.print_general_ledger.start,end_date:"
|
||||
msgid "Final Posting Date"
|
||||
msgstr "Data de comptabilització final"
|
||||
|
||||
msgctxt "field:account_reports.print_general_ledger.start,end_period:"
|
||||
msgid "End Period"
|
||||
msgstr "Període final"
|
||||
|
@ -30,6 +34,10 @@ msgctxt "field:account_reports.print_general_ledger.start,parties:"
|
|||
msgid "Parties"
|
||||
msgstr "Tercers"
|
||||
|
||||
msgctxt "field:account_reports.print_general_ledger.start,start_date:"
|
||||
msgid "Initial Posting Date"
|
||||
msgstr "Data de comptabilització inicial"
|
||||
|
||||
msgctxt "field:account_reports.print_general_ledger.start,start_period:"
|
||||
msgid "Start Period"
|
||||
msgstr "Període inicial"
|
||||
|
|
|
@ -14,6 +14,10 @@ msgctxt "field:account_reports.print_general_ledger.start,company:"
|
|||
msgid "Company"
|
||||
msgstr "Empresa"
|
||||
|
||||
msgctxt "field:account_reports.print_general_ledger.start,end_date:"
|
||||
msgid "Final Posting Date"
|
||||
msgstr "Fecha de contabilización final"
|
||||
|
||||
msgctxt "field:account_reports.print_general_ledger.start,end_period:"
|
||||
msgid "End Period"
|
||||
msgstr "Período final"
|
||||
|
@ -30,6 +34,10 @@ msgctxt "field:account_reports.print_general_ledger.start,parties:"
|
|||
msgid "Parties"
|
||||
msgstr "Terceros"
|
||||
|
||||
msgctxt "field:account_reports.print_general_ledger.start,start_date:"
|
||||
msgid "Initial Posting Date"
|
||||
msgstr "Fecha de contabilización inicial"
|
||||
|
||||
msgctxt "field:account_reports.print_general_ledger.start,start_period:"
|
||||
msgid "Start Period"
|
||||
msgstr "Período inicial"
|
||||
|
|
|
@ -292,6 +292,8 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
print_general_ledger.start.fiscalyear = fiscalyear
|
||||
print_general_ledger.start.start_period = period
|
||||
print_general_ledger.start.end_period = last_period
|
||||
print_general_ledger.start.start_date = None
|
||||
print_general_ledger.start.end_date = None
|
||||
print_general_ledger.start.parties = []
|
||||
print_general_ledger.start.accounts = []
|
||||
print_general_ledger.start.output_format = 'pdf'
|
||||
|
@ -319,6 +321,10 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
self.assertEqual(credit, Decimal('730.0'))
|
||||
with_party = [line for k, m in records.items() for line in m['lines'] if not line['line'].party]
|
||||
self.assertEqual(len(with_party), 6)
|
||||
dates = sorted(set([line['line'].date for k, m in records.items() for line in m['lines']]))
|
||||
for date, expected_value in zip(dates, [period.start_date,
|
||||
last_period.end_date]):
|
||||
self.assertEqual(date, expected_value)
|
||||
|
||||
# Filtered by periods
|
||||
session_id, _, _ = PrintGeneralLedger.create()
|
||||
|
@ -327,6 +333,8 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
print_general_ledger.start.fiscalyear = fiscalyear
|
||||
print_general_ledger.start.start_period = period
|
||||
print_general_ledger.start.end_period = period
|
||||
print_general_ledger.start.start_date = None
|
||||
print_general_ledger.start.end_date = None
|
||||
print_general_ledger.start.parties = []
|
||||
print_general_ledger.start.accounts = []
|
||||
print_general_ledger.start.all_accounts = False
|
||||
|
@ -338,6 +346,33 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
debit = sum([line['debit'] for k, m in records.items() for line in m['lines']])
|
||||
self.assertEqual(credit, debit)
|
||||
self.assertEqual(credit, Decimal('380.0'))
|
||||
dates = sorted(set([line['line'].date for k, m in records.items() for line in m['lines']]))
|
||||
for date in dates:
|
||||
self.assertEqual(date, period.start_date)
|
||||
|
||||
# Filtered by dates
|
||||
session_id, _, _ = PrintGeneralLedger.create()
|
||||
print_general_ledger = PrintGeneralLedger(session_id)
|
||||
print_general_ledger.start.company = company
|
||||
print_general_ledger.start.fiscalyear = None
|
||||
print_general_ledger.start.start_period = None
|
||||
print_general_ledger.start.end_period = None
|
||||
print_general_ledger.start.start_date = period.start_date
|
||||
print_general_ledger.start.end_date = period.end_date
|
||||
print_general_ledger.start.parties = []
|
||||
print_general_ledger.start.accounts = []
|
||||
print_general_ledger.start.all_accounts = False
|
||||
print_general_ledger.start.output_format = 'pdf'
|
||||
_, data = print_general_ledger.do_print_(None)
|
||||
records, parameters = GeneralLedgerReport.prepare(data)
|
||||
self.assertEqual(len(records), 4)
|
||||
credit = sum([line['credit'] for k, m in records.items() for line in m['lines']])
|
||||
debit = sum([line['debit'] for k, m in records.items() for line in m['lines']])
|
||||
self.assertEqual(credit, debit)
|
||||
self.assertEqual(credit, Decimal('380.0'))
|
||||
dates = sorted(set([line['line'].date for k, m in records.items() for line in m['lines']]))
|
||||
for date in dates:
|
||||
self.assertEqual(date, period.start_date)
|
||||
|
||||
# Filtered by accounts
|
||||
expense, = Account.search([
|
||||
|
@ -349,6 +384,8 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
print_general_ledger.start.fiscalyear = fiscalyear
|
||||
print_general_ledger.start.start_period = period
|
||||
print_general_ledger.start.end_period = last_period
|
||||
print_general_ledger.start.start_date = None
|
||||
print_general_ledger.start.end_date = None
|
||||
print_general_ledger.start.parties = []
|
||||
print_general_ledger.start.accounts = [expense.id]
|
||||
print_general_ledger.start.all_accounts = False
|
||||
|
@ -370,6 +407,8 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
print_general_ledger.start.fiscalyear = fiscalyear
|
||||
print_general_ledger.start.start_period = period
|
||||
print_general_ledger.start.end_period = last_period
|
||||
print_general_ledger.start.start_date = None
|
||||
print_general_ledger.start.end_date = None
|
||||
print_general_ledger.start.parties = [customer1.id]
|
||||
print_general_ledger.start.accounts = []
|
||||
print_general_ledger.start.all_accounts = False
|
||||
|
@ -382,6 +421,10 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
debit = sum([line['debit'] for k, m in records.items() for line in m['lines']])
|
||||
self.assertEqual(credit, Decimal('0.0'))
|
||||
self.assertEqual(debit, Decimal('100.0'))
|
||||
credit = sum([line['credit'] for k, m in records.items() for line in m['lines'] if m['party'] == ''])
|
||||
debit = sum([line['debit'] for k, m in records.items() for line in m['lines'] if m['party'] == ''])
|
||||
self.assertEqual(credit, Decimal('0.0'))
|
||||
self.assertEqual(debit, Decimal('0.0'))
|
||||
parties = [line for k, m in records.items() for line in m['lines'] if not line['line'].party]
|
||||
self.assertEqual(len(parties), 0)
|
||||
|
||||
|
@ -395,6 +438,8 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
print_general_ledger.start.fiscalyear = fiscalyear
|
||||
print_general_ledger.start.start_period = period
|
||||
print_general_ledger.start.end_period = last_period
|
||||
print_general_ledger.start.start_date = None
|
||||
print_general_ledger.start.end_date = None
|
||||
print_general_ledger.start.parties = [customer1.id]
|
||||
print_general_ledger.start.accounts = [receivable.id]
|
||||
print_general_ledger.start.output_format = 'pdf'
|
||||
|
@ -409,6 +454,6 @@ class AccountReportsTestCase(CompanyTestMixin, ModuleTestCase):
|
|||
self.assertEqual(credit, Decimal('0.0'))
|
||||
self.assertEqual(debit, Decimal('100.0'))
|
||||
self.assertEqual(True, all([line for k, m in records.items() for line in m['lines'] if line['line'].party]))
|
||||
|
||||
|
||||
|
||||
del ModuleTestCase
|
||||
|
|
|
@ -10,6 +10,10 @@ copyright notices and license terms. -->
|
|||
<field name="start_period"/>
|
||||
<label name="end_period"/>
|
||||
<field name="end_period"/>
|
||||
<label name="start_date"/>
|
||||
<field name="start_date"/>
|
||||
<label name="end_date"/>
|
||||
<field name="end_date"/>
|
||||
<label id="select_parties" string="Left empty to select all parties"/>
|
||||
<field name="parties" colspan="4"/>
|
||||
<label id="select_accounts" string="Left empty to select all accounts"/>
|
||||
|
|
Loading…
Reference in New Issue