Add from_date and to_date in Move.query_get
Add those fields to the context of GeneralLegder and IncomeStatement. issue6692 review43361002
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
* Add from and to date to General Ledger and Income Statement
|
||||
* Add move filtering on date range
|
||||
* Simplify default values for move line
|
||||
|
||||
Version 4.4.0 - 2017-05-01
|
||||
|
||||
+74
-2
@@ -14,7 +14,7 @@ from trytond.wizard import Wizard, StateView, StateAction, StateTransition, \
|
||||
Button
|
||||
from trytond.report import Report
|
||||
from trytond.tools import reduce_ids, grouped_slice
|
||||
from trytond.pyson import Eval, PYSONEncoder
|
||||
from trytond.pyson import Eval, If, PYSONEncoder
|
||||
from trytond.transaction import Transaction
|
||||
from trytond.pool import Pool
|
||||
from trytond import backend
|
||||
@@ -1283,13 +1283,25 @@ class GeneralLedgerAccount(ModelSQL, ModelView):
|
||||
period_ids.append(period.id)
|
||||
return period_ids
|
||||
|
||||
@classmethod
|
||||
def get_dates(cls, name):
|
||||
context = Transaction().context
|
||||
if name.startswith('start_'):
|
||||
return None, context.get('from_date')
|
||||
elif name.startswith('end_'):
|
||||
return None, context.get('to_date')
|
||||
return None, None
|
||||
|
||||
@classmethod
|
||||
def get_account(cls, records, name):
|
||||
pool = Pool()
|
||||
Account = pool.get('account.account')
|
||||
|
||||
period_ids = cls.get_period_ids(name)
|
||||
with Transaction().set_context(periods=period_ids):
|
||||
from_date, to_date = cls.get_dates(name)
|
||||
with Transaction().set_context(
|
||||
periods=period_ids,
|
||||
from_date=from_date, to_date=to_date):
|
||||
accounts = Account.browse(records)
|
||||
fname = name
|
||||
for test in ['start_', 'end_']:
|
||||
@@ -1335,6 +1347,20 @@ class GeneralLedgerAccountContext(ModelView):
|
||||
('start_date', '>=', (Eval('start_period'), 'start_date'))
|
||||
],
|
||||
depends=['fiscalyear', 'start_period'])
|
||||
from_date = fields.Date("From Date",
|
||||
domain=[
|
||||
If(Eval('to_date') & Eval('from_date'),
|
||||
('from_date', '<=', Eval('to_date')),
|
||||
()),
|
||||
],
|
||||
depends=['to_date'])
|
||||
to_date = fields.Date("To Date",
|
||||
domain=[
|
||||
If(Eval('from_date') & Eval('to_date'),
|
||||
('to_date', '>=', Eval('from_date')),
|
||||
()),
|
||||
],
|
||||
depends=['from_date'])
|
||||
company = fields.Many2One('company.company', 'Company', required=True)
|
||||
posted = fields.Boolean('Posted Move', help='Show only posted move')
|
||||
|
||||
@@ -1363,6 +1389,14 @@ class GeneralLedgerAccountContext(ModelView):
|
||||
def default_posted(cls):
|
||||
return Transaction().context.get('posted', False)
|
||||
|
||||
@classmethod
|
||||
def default_from_date(cls):
|
||||
return Transaction().context.get('from_date')
|
||||
|
||||
@classmethod
|
||||
def default_to_date(cls):
|
||||
return Transaction().context.get('to_date')
|
||||
|
||||
@fields.depends('fiscalyear', 'start_period', 'end_period')
|
||||
def on_change_fiscalyear(self):
|
||||
if (self.start_period
|
||||
@@ -1504,6 +1538,8 @@ class GeneralLedger(Report):
|
||||
report_context[period] = Period(context[period])
|
||||
else:
|
||||
report_context[period] = None
|
||||
report_context['from_date'] = context.get('from_date')
|
||||
report_context['to_date'] = context.get('to_date')
|
||||
|
||||
report_context['accounts'] = records
|
||||
return report_context
|
||||
@@ -1530,6 +1566,8 @@ class TrialBalance(Report):
|
||||
report_context[period] = Period(context[period])
|
||||
else:
|
||||
report_context[period] = None
|
||||
report_context['from_date'] = context.get('from_date')
|
||||
report_context['to_date'] = context.get('to_date')
|
||||
|
||||
report_context['accounts'] = records
|
||||
report_context['sum'] = cls.sum
|
||||
@@ -1602,6 +1640,20 @@ class IncomeStatementContext(ModelView):
|
||||
('start_date', '>=', (Eval('start_period'), 'start_date')),
|
||||
],
|
||||
depends=['start_period', 'fiscalyear'])
|
||||
from_date = fields.Date("From Date",
|
||||
domain=[
|
||||
If(Eval('to_date') & Eval('from_date'),
|
||||
('from_date', '<=', Eval('to_date')),
|
||||
()),
|
||||
],
|
||||
depends=['to_date'])
|
||||
to_date = fields.Date("To Date",
|
||||
domain=[
|
||||
If(Eval('from_date') & Eval('to_date'),
|
||||
('to_date', '>=', Eval('from_date')),
|
||||
()),
|
||||
],
|
||||
depends=['from_date'])
|
||||
company = fields.Many2One('company.company', 'Company', required=True)
|
||||
posted = fields.Boolean('Posted Move', help='Show only posted move')
|
||||
comparison = fields.Boolean('Comparison')
|
||||
@@ -1628,6 +1680,26 @@ class IncomeStatementContext(ModelView):
|
||||
'invisible': ~Eval('comparison', False),
|
||||
},
|
||||
depends=['start_period_cmp', 'fiscalyear_cmp'])
|
||||
from_date_cmp = fields.Date("From Date",
|
||||
domain=[
|
||||
If(Eval('to_date_cmp') & Eval('from_date_cmp'),
|
||||
('from_date_cmp', '<=', Eval('to_date_cmp')),
|
||||
()),
|
||||
],
|
||||
states={
|
||||
'invisible': ~Eval('comparison', False),
|
||||
},
|
||||
depends=['to_date_cmp', 'comparison'])
|
||||
to_date_cmp = fields.Date("To Date",
|
||||
domain=[
|
||||
If(Eval('from_date_cmp') & Eval('to_date_cmp'),
|
||||
('to_date_cmp', '>=', Eval('from_date_cmp')),
|
||||
()),
|
||||
],
|
||||
states={
|
||||
'invisible': ~Eval('comparison', False),
|
||||
},
|
||||
depends=['from_date_cmp', 'comparison'])
|
||||
|
||||
@staticmethod
|
||||
def default_fiscalyear():
|
||||
|
||||
+25
-12
@@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
|
||||
<office:meta><meta:generator>LibreOffice/5.2.7.2$Linux_X86_64 LibreOffice_project/20m0$Build-2</meta:generator><meta:creation-date>2008-06-07T15:26:41</meta:creation-date><dc:date>2008-08-27T17:03:36</dc:date><meta:editing-cycles>1</meta:editing-cycles><meta:editing-duration>PT0S</meta:editing-duration><meta:document-statistic meta:character-count="1538" meta:image-count="0" meta:non-whitespace-character-count="1464" meta:object-count="0" meta:page-count="4" meta:paragraph-count="49" meta:table-count="3" meta:word-count="123"/><meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/></office:meta>
|
||||
<office:meta><meta:generator>LibreOffice/5.2.7.2$Linux_X86_64 LibreOffice_project/20m0$Build-2</meta:generator><meta:creation-date>2008-06-07T15:26:41</meta:creation-date><dc:date>2008-08-27T17:03:36</dc:date><meta:editing-cycles>1</meta:editing-cycles><meta:editing-duration>PT0S</meta:editing-duration><meta:document-statistic meta:table-count="3" meta:image-count="0" meta:object-count="0" meta:page-count="3" meta:paragraph-count="53" meta:word-count="151" meta:character-count="1766" meta:non-whitespace-character-count="1668"/><meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/></office:meta>
|
||||
<office:settings>
|
||||
<config:config-item-set config:name="ooo:view-settings">
|
||||
<config:config-item config:name="ViewAreaTop" config:type="long">0</config:config-item>
|
||||
<config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
|
||||
<config:config-item config:name="ViewAreaWidth" config:type="long">43760</config:config-item>
|
||||
<config:config-item config:name="ViewAreaHeight" config:type="long">21691</config:config-item>
|
||||
<config:config-item config:name="ViewAreaWidth" config:type="long">23440</config:config-item>
|
||||
<config:config-item config:name="ViewAreaHeight" config:type="long">21451</config:config-item>
|
||||
<config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
|
||||
<config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
|
||||
<config:config-item-map-indexed config:name="Views">
|
||||
<config:config-item-map-entry>
|
||||
<config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
|
||||
<config:config-item config:name="ViewLeft" config:type="long">19976</config:config-item>
|
||||
<config:config-item config:name="ViewTop" config:type="long">5443</config:config-item>
|
||||
<config:config-item config:name="ViewLeft" config:type="long">16436</config:config-item>
|
||||
<config:config-item config:name="ViewTop" config:type="long">9798</config:config-item>
|
||||
<config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
|
||||
<config:config-item config:name="VisibleTop" config:type="long">0</config:config-item>
|
||||
<config:config-item config:name="VisibleRight" config:type="long">43759</config:config-item>
|
||||
<config:config-item config:name="VisibleBottom" config:type="long">21689</config:config-item>
|
||||
<config:config-item config:name="VisibleRight" config:type="long">23439</config:config-item>
|
||||
<config:config-item config:name="VisibleBottom" config:type="long">21449</config:config-item>
|
||||
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
|
||||
<config:config-item config:name="ViewLayoutColumns" config:type="short">0</config:config-item>
|
||||
<config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
|
||||
@@ -69,7 +69,7 @@
|
||||
<config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
|
||||
<config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
|
||||
<config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
|
||||
<config:config-item config:name="Rsid" config:type="int">3708925</config:config-item>
|
||||
<config:config-item config:name="Rsid" config:type="int">3802205</config:config-item>
|
||||
<config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
|
||||
<config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
|
||||
<config:config-item config:name="ApplyUserData" config:type="boolean">false</config:config-item>
|
||||
@@ -630,9 +630,18 @@
|
||||
<style:paragraph-properties fo:break-before="page"/>
|
||||
<style:text-properties style:text-underline-style="none"/>
|
||||
</style:style>
|
||||
<style:style style:name="P25" style:family="paragraph" style:parent-style-name="Text_20_body">
|
||||
<style:text-properties officeooo:paragraph-rsid="003a045d"/>
|
||||
</style:style>
|
||||
<style:style style:name="P26" style:family="paragraph" style:parent-style-name="Text_20_body">
|
||||
<style:text-properties officeooo:rsid="003955ec" officeooo:paragraph-rsid="003a045d"/>
|
||||
</style:style>
|
||||
<style:style style:name="T1" style:family="text">
|
||||
<style:text-properties officeooo:rsid="0037c304"/>
|
||||
</style:style>
|
||||
<style:style style:name="T2" style:family="text">
|
||||
<style:text-properties officeooo:rsid="0039b016"/>
|
||||
</style:style>
|
||||
<style:page-layout style:name="pm1">
|
||||
<style:page-layout-properties fo:page-width="8.5in" fo:page-height="11in" style:num-format="1" style:print-orientation="portrait" fo:margin-top="0.7874in" fo:margin-bottom="0.7874in" fo:margin-left="0.7874in" fo:margin-right="0.7874in" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="44" style:layout-grid-base-height="0.2165in" style:layout-grid-ruby-height="0in" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="true" style:layout-grid-display="true" style:footnote-max-height="0in">
|
||||
<style:footnote-sep style:width="0.0071in" style:distance-before-sep="0.0398in" style:distance-after-sep="0.0398in" style:line-style="none" style:adjustment="left" style:rel-width="25%" style:color="#000000"/>
|
||||
@@ -672,7 +681,7 @@
|
||||
<text:p text:style-name="Footer">User: <text:placeholder text:placeholder-type="text"><user.rec_name></text:placeholder></text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="Table1.A1" office:value-type="string">
|
||||
<text:p text:style-name="P3"><text:page-number text:select-page="current">4</text:page-number>/<text:page-count>4</text:page-count></text:p>
|
||||
<text:p text:style-name="P3"><text:page-number text:select-page="current">3</text:page-number>/<text:page-count>3</text:page-count></text:p>
|
||||
</table:table-cell>
|
||||
</table:table-row>
|
||||
</table:table>
|
||||
@@ -689,9 +698,13 @@
|
||||
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
|
||||
</text:sequence-decls>
|
||||
<text:p text:style-name="P22">General Ledger</text:p>
|
||||
<text:p text:style-name="P21"><text:span text:style-name="T1">Fiscal Year: </text:span><text:placeholder text:placeholder-type="text"><fiscalyear.rec_name></text:placeholder></text:p>
|
||||
<text:p text:style-name="P21"><text:span text:style-name="T1">From Period</text:span>: <text:placeholder text:placeholder-type="text"><start_period.name if start_period else ''></text:placeholder></text:p>
|
||||
<text:p text:style-name="P21"><text:span text:style-name="T1">To </text:span>Period: <text:placeholder text:placeholder-type="text"><end_period.name if end_period else ''></text:placeholder></text:p>
|
||||
<text:p text:style-name="P25"><text:span text:style-name="T1">Fiscal Year: </text:span><text:placeholder text:placeholder-type="text"><fiscalyear.rec_name></text:placeholder></text:p>
|
||||
<text:p text:style-name="P25"><text:placeholder text:placeholder-type="text"><if test="start_period or end_period"></text:placeholder></text:p>
|
||||
<text:p text:style-name="P25"><text:span text:style-name="T1">From Period</text:span>: <text:placeholder text:placeholder-type="text"><start_period.name if start_period else ''></text:placeholder> <text:span text:style-name="T2">To</text:span> <text:placeholder text:placeholder-type="text"><end_period.name if end_period else ''></text:placeholder></text:p>
|
||||
<text:p text:style-name="P25"><text:placeholder text:placeholder-type="text"></if></text:placeholder></text:p>
|
||||
<text:p text:style-name="P25"><text:placeholder text:placeholder-type="text"><if test="from_date or to_date"></text:placeholder></text:p>
|
||||
<text:p text:style-name="P26">From Date: <text:placeholder text:placeholder-type="text"><format_date(from_date, user.language) if from_date else ''></text:placeholder> <text:span text:style-name="T2">T</text:span>o <text:placeholder text:placeholder-type="text"><format_date(to_date, user.language) if to_date else ''></text:placeholder></text:p>
|
||||
<text:p text:style-name="P25"><text:placeholder text:placeholder-type="text"></if></text:placeholder></text:p>
|
||||
<text:p text:style-name="P18"><text:placeholder text:placeholder-type="text"><for each="account in accounts"></text:placeholder></text:p>
|
||||
<text:p text:style-name="P24"/>
|
||||
<table:table table:name="Table3" table:style-name="Table3">
|
||||
|
||||
@@ -6,7 +6,7 @@ from itertools import groupby, combinations
|
||||
from operator import itemgetter
|
||||
from collections import defaultdict
|
||||
|
||||
from sql import Null
|
||||
from sql import Null, Literal
|
||||
from sql.aggregate import Sum, Max
|
||||
from sql.conditionals import Coalesce, Case
|
||||
|
||||
@@ -56,8 +56,8 @@ class Move(ModelSQL, ModelView):
|
||||
states=_MOVE_STATES, depends=_MOVE_DEPENDS + ['company'], select=True)
|
||||
journal = fields.Many2One('account.journal', 'Journal', required=True,
|
||||
states=_MOVE_STATES, depends=_MOVE_DEPENDS)
|
||||
date = fields.Date('Effective Date', required=True, states=_MOVE_STATES,
|
||||
depends=_MOVE_DEPENDS)
|
||||
date = fields.Date('Effective Date', required=True, select=True,
|
||||
states=_MOVE_STATES, depends=_MOVE_DEPENDS)
|
||||
post_date = fields.Date('Post Date', readonly=True)
|
||||
description = fields.Char('Description', states=_MOVE_STATES,
|
||||
depends=_MOVE_DEPENDS)
|
||||
@@ -953,83 +953,61 @@ class Line(ModelSQL, ModelView):
|
||||
Period = pool.get('account.period')
|
||||
move = Move.__table__()
|
||||
period = Period.__table__()
|
||||
fiscalyear = FiscalYear.__table__()
|
||||
context = Transaction().context
|
||||
company = context.get('company')
|
||||
|
||||
if Transaction().context.get('date'):
|
||||
fiscalyear_ids = []
|
||||
where = Literal(True)
|
||||
|
||||
if context.get('posted'):
|
||||
where &= move.state == 'posted'
|
||||
|
||||
date = context.get('date')
|
||||
from_date, to_date = context.get('from_date'), context.get('to_date')
|
||||
fiscalyear_id = context.get('fiscalyear')
|
||||
period_ids = context.get('periods')
|
||||
if date:
|
||||
fiscalyears = FiscalYear.search([
|
||||
('start_date', '<=', Transaction().context['date']),
|
||||
('end_date', '>=', Transaction().context['date']),
|
||||
('company', '=', Transaction().context.get('company')),
|
||||
('start_date', '<=', date),
|
||||
('end_date', '>=', date),
|
||||
('company', '=', company),
|
||||
], limit=1)
|
||||
|
||||
fiscalyear_id = fiscalyears and fiscalyears[0].id or 0
|
||||
|
||||
if Transaction().context.get('posted'):
|
||||
return ((table.state != 'draft')
|
||||
& table.move.in_(move.join(period,
|
||||
condition=move.period == period.id
|
||||
).select(move.id,
|
||||
where=(period.fiscalyear == fiscalyear_id)
|
||||
& (move.date <= Transaction().context['date'])
|
||||
& (move.state == 'posted'))),
|
||||
[f.id for f in fiscalyears])
|
||||
if fiscalyears:
|
||||
fiscalyear_id = fiscalyears[0].id
|
||||
else:
|
||||
return ((table.state != 'draft')
|
||||
& table.move.in_(move.join(period,
|
||||
condition=move.period == period.id
|
||||
).select(move.id,
|
||||
where=(period.fiscalyear == fiscalyear_id)
|
||||
& (move.date <= Transaction().context['date']))),
|
||||
[f.id for f in fiscalyears])
|
||||
|
||||
if Transaction().context.get('periods'):
|
||||
if Transaction().context.get('fiscalyear'):
|
||||
fiscalyear_ids = [Transaction().context['fiscalyear']]
|
||||
else:
|
||||
fiscalyear_ids = []
|
||||
if Transaction().context.get('posted'):
|
||||
return ((table.state != 'draft')
|
||||
& table.move.in_(
|
||||
move.select(move.id,
|
||||
where=move.period.in_(
|
||||
Transaction().context['periods'])
|
||||
& (move.state == 'posted'))),
|
||||
fiscalyear_ids)
|
||||
else:
|
||||
return ((table.state != 'draft')
|
||||
& table.move.in_(
|
||||
move.select(move.id,
|
||||
where=move.period.in_(
|
||||
Transaction().context['periods']))),
|
||||
fiscalyear_ids)
|
||||
fiscalyear_id = -1
|
||||
fiscalyear_ids = map(int, fiscalyears)
|
||||
where &= period.fiscalyear == fiscalyear_id
|
||||
where &= move.date <= date
|
||||
elif fiscalyear_id or period_ids or from_date or to_date:
|
||||
if fiscalyear_id:
|
||||
fiscalyear_ids = [fiscalyear_id]
|
||||
where &= fiscalyear.id == fiscalyear_id
|
||||
if period_ids:
|
||||
where &= move.period.in_(period_ids)
|
||||
if from_date:
|
||||
where &= move.date >= from_date
|
||||
if to_date:
|
||||
where &= move.date <= to_date
|
||||
else:
|
||||
if not Transaction().context.get('fiscalyear'):
|
||||
fiscalyears = FiscalYear.search([
|
||||
where &= fiscalyear.state == 'open'
|
||||
where &= fiscalyear.company == company
|
||||
fiscalyears = FiscalYear.search([
|
||||
('state', '=', 'open'),
|
||||
('company', '=', Transaction().context.get('company')),
|
||||
('company', '=', company),
|
||||
])
|
||||
fiscalyear_ids = [f.id for f in fiscalyears] or [0]
|
||||
else:
|
||||
fiscalyear_ids = [Transaction().context.get('fiscalyear')]
|
||||
fiscalyear_ids = map(int, fiscalyears)
|
||||
|
||||
if Transaction().context.get('posted'):
|
||||
return ((table.state != 'draft')
|
||||
& table.move.in_(
|
||||
move.select(move.id,
|
||||
where=move.period.in_(
|
||||
period.select(period.id,
|
||||
where=period.fiscalyear.in_(
|
||||
fiscalyear_ids)))
|
||||
& (move.state == 'posted'))),
|
||||
fiscalyear_ids)
|
||||
else:
|
||||
return ((table.state != 'draft')
|
||||
& table.move.in_(
|
||||
move.select(move.id,
|
||||
where=move.period.in_(
|
||||
period.select(period.id,
|
||||
where=period.fiscalyear.in_(
|
||||
fiscalyear_ids))))),
|
||||
fiscalyear_ids)
|
||||
# Use LEFT JOIN to allow database optimization
|
||||
# if no joined table is used in the where clause.
|
||||
return ((table.state != 'draft')
|
||||
& table.move.in_(move
|
||||
.join(period, 'LEFT', condition=move.period == period.id)
|
||||
.join(fiscalyear, 'LEFT',
|
||||
condition=period.fiscalyear == fiscalyear.id)
|
||||
.select(move.id, where=where)),
|
||||
fiscalyear_ids)
|
||||
|
||||
@classmethod
|
||||
def on_write(cls, lines):
|
||||
|
||||
+20
-10
@@ -1,24 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
|
||||
<office:meta><meta:generator>LibreOffice/5.2.7.2$Linux_X86_64 LibreOffice_project/20m0$Build-2</meta:generator><meta:creation-date>2008-06-07T15:26:58</meta:creation-date><dc:date>2008-08-27T17:08:38</dc:date><meta:editing-cycles>1</meta:editing-cycles><meta:editing-duration>PT0S</meta:editing-duration><meta:document-statistic meta:character-count="1033" meta:image-count="0" meta:non-whitespace-character-count="986" meta:object-count="0" meta:page-count="1" meta:paragraph-count="26" meta:table-count="3" meta:word-count="73"/><meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/></office:meta>
|
||||
<office:meta><meta:generator>LibreOffice/5.2.7.2$Linux_X86_64 LibreOffice_project/20m0$Build-2</meta:generator><meta:creation-date>2008-06-07T15:26:58</meta:creation-date><dc:date>2008-08-27T17:08:38</dc:date><meta:editing-cycles>1</meta:editing-cycles><meta:editing-duration>PT0S</meta:editing-duration><meta:document-statistic meta:table-count="3" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="30" meta:word-count="105" meta:character-count="1262" meta:non-whitespace-character-count="1187"/><meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/></office:meta>
|
||||
<office:settings>
|
||||
<config:config-item-set config:name="ooo:view-settings">
|
||||
<config:config-item config:name="ViewAreaTop" config:type="long">0</config:config-item>
|
||||
<config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
|
||||
<config:config-item config:name="ViewAreaWidth" config:type="long">43760</config:config-item>
|
||||
<config:config-item config:name="ViewAreaHeight" config:type="long">21691</config:config-item>
|
||||
<config:config-item config:name="ViewAreaWidth" config:type="long">23440</config:config-item>
|
||||
<config:config-item config:name="ViewAreaHeight" config:type="long">21451</config:config-item>
|
||||
<config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
|
||||
<config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
|
||||
<config:config-item-map-indexed config:name="Views">
|
||||
<config:config-item-map-entry>
|
||||
<config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
|
||||
<config:config-item config:name="ViewLeft" config:type="long">20262</config:config-item>
|
||||
<config:config-item config:name="ViewTop" config:type="long">5443</config:config-item>
|
||||
<config:config-item config:name="ViewLeft" config:type="long">3784</config:config-item>
|
||||
<config:config-item config:name="ViewTop" config:type="long">10984</config:config-item>
|
||||
<config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
|
||||
<config:config-item config:name="VisibleTop" config:type="long">0</config:config-item>
|
||||
<config:config-item config:name="VisibleRight" config:type="long">43759</config:config-item>
|
||||
<config:config-item config:name="VisibleBottom" config:type="long">21689</config:config-item>
|
||||
<config:config-item config:name="VisibleRight" config:type="long">23439</config:config-item>
|
||||
<config:config-item config:name="VisibleBottom" config:type="long">21449</config:config-item>
|
||||
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
|
||||
<config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item>
|
||||
<config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
|
||||
@@ -69,7 +69,7 @@
|
||||
<config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
|
||||
<config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
|
||||
<config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
|
||||
<config:config-item config:name="Rsid" config:type="int">1456882</config:config-item>
|
||||
<config:config-item config:name="Rsid" config:type="int">1470702</config:config-item>
|
||||
<config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
|
||||
<config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
|
||||
<config:config-item config:name="ApplyUserData" config:type="boolean">false</config:config-item>
|
||||
@@ -376,6 +376,12 @@
|
||||
<style:style style:name="P8" style:family="paragraph" style:parent-style-name="Text_20_body">
|
||||
<style:text-properties officeooo:paragraph-rsid="00160b54"/>
|
||||
</style:style>
|
||||
<style:style style:name="P9" style:family="paragraph" style:parent-style-name="Text_20_body">
|
||||
<style:text-properties officeooo:rsid="0017781d" officeooo:paragraph-rsid="001670ee"/>
|
||||
</style:style>
|
||||
<style:style style:name="P10" style:family="paragraph" style:parent-style-name="Text_20_body">
|
||||
<style:text-properties officeooo:paragraph-rsid="001670ee"/>
|
||||
</style:style>
|
||||
<style:style style:name="T1" style:family="text">
|
||||
<style:text-properties officeooo:rsid="0037c304"/>
|
||||
</style:style>
|
||||
@@ -436,8 +442,12 @@
|
||||
</text:sequence-decls>
|
||||
<text:p text:style-name="P7">Trial Balance</text:p>
|
||||
<text:p text:style-name="P8"><text:span text:style-name="T1">Fiscal Year: </text:span><text:placeholder text:placeholder-type="text"><fiscalyear.rec_name></text:placeholder></text:p>
|
||||
<text:p text:style-name="Text_20_body">From Period: <text:placeholder text:placeholder-type="text"><start_period.name if start_period else ''></text:placeholder></text:p>
|
||||
<text:p text:style-name="Text_20_body">To Period: <text:placeholder text:placeholder-type="text"><end_period.name if end_period else ''></text:placeholder></text:p>
|
||||
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text"><if test="start_period or end_period"></text:placeholder></text:p>
|
||||
<text:p text:style-name="P10">From Period: <text:placeholder text:placeholder-type="text"><start_period.name if start_period else ''></text:placeholder> To <text:placeholder text:placeholder-type="text"><end_period.name if end_period else ''></text:placeholder></text:p>
|
||||
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text"></if></text:placeholder></text:p>
|
||||
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text"><if test="from_date or to_date"></text:placeholder></text:p>
|
||||
<text:p text:style-name="P9">From Date: <text:placeholder text:placeholder-type="text"><format_date(from_date, user.language) if from_date else ''></text:placeholder> To <text:placeholder text:placeholder-type="text"><format_date(to_date, user.language) if to_date else ''></text:placeholder></text:p>
|
||||
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text"></if></text:placeholder></text:p>
|
||||
<table:table table:name="Table1" table:style-name="Table1">
|
||||
<table:table-column table:style-name="Table1.A"/>
|
||||
<table:table-column table:style-name="Table1.B" table:number-columns-repeated="4"/>
|
||||
|
||||
@@ -12,4 +12,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="start_period"/>
|
||||
<label name="end_period"/>
|
||||
<field name="end_period"/>
|
||||
<newline/>
|
||||
<label name="from_date"/>
|
||||
<field name="from_date"/>
|
||||
<label name="to_date"/>
|
||||
<field name="to_date"/>
|
||||
</form>
|
||||
|
||||
@@ -13,6 +13,11 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<label name="end_period"/>
|
||||
<field name="end_period"/>
|
||||
<newline/>
|
||||
<label name="from_date"/>
|
||||
<field name="from_date"/>
|
||||
<label name="to_date"/>
|
||||
<field name="to_date"/>
|
||||
<newline/>
|
||||
<label name="comparison"/>
|
||||
<field name="comparison"/>
|
||||
<newline/>
|
||||
@@ -24,4 +29,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="start_period_cmp"/>
|
||||
<label name="end_period_cmp"/>
|
||||
<field name="end_period_cmp"/>
|
||||
<newline/>
|
||||
<label name="from_date_cmp"/>
|
||||
<field name="from_date_cmp"/>
|
||||
<label name="to_date_cmp"/>
|
||||
<field name="to_date_cmp"/>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user