[FIX]: improvement and fix proposed by the pap@tinyerp.com

bzr revid: mga@tinyerp.com-20100814143022-7jks4ktnghiyqhtt
This commit is contained in:
pap@tinyerp.com 2010-08-14 20:00:22 +05:30 committed by Mantavya Gajjar
parent 684a10886e
commit 4bfa139099
3 changed files with 45 additions and 9 deletions

View File

@ -70,6 +70,42 @@ class account_entries_report(osv.osv):
'company_id': fields.many2one('res.company', 'Company', readonly=True),
}
_order = 'date desc'
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
for arg in args:
if arg[0] == 'period_id' and arg[2] == 'current_period':
current_period = self.pool.get('account.period').find(cr, uid)[0]
args.append(['period_id','in',[current_period]])
break
elif arg[0] == 'period_id' and arg[2] == 'current_year':
current_year = self.pool.get('account.fiscalyear').find(cr, uid)
ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
args.append(['period_id','in',ids])
for a in [['period_id','in','current_year'], ['period_id','in','current_period']]:
if a in args:
args.remove(a)
return super(account_entries_report, self).search(cr, uid, args=args, offset=offset, limit=limit, order=order,
context=context, count=count)
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None):
todel=[]
for arg in domain:
if arg[0] == 'period_id' and arg[2] == 'current_period':
current_period = self.pool.get('account.period').find(cr, uid)[0]
domain.append(['period_id','in',[current_period]])
todel.append(arg)
break
elif arg[0] == 'period_id' and arg[2] == 'current_year':
current_year = self.pool.get('account.fiscalyear').find(cr, uid)
ids = self.pool.get('account.fiscalyear').read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
domain.append(['period_id','in',ids])
todel.append(arg)
for a in [['period_id','in','current_year'], ['period_id','in','current_period']]:
if a in domain:
domain.remove(a)
return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context)
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_entries_report')
cr.execute("""

View File

@ -52,14 +52,14 @@
<field name="arch" type="xml">
<search string="Entries Analysis">
<group colspan="10" col="12">
<filter icon="terp-go-year" string="Year"
name="year"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Entries created in this year"/>
<filter icon="terp-go-month" string="Period"
name="period"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Entries created in this period"/>
<filter icon="terp-go-year" string="This Year"
name="year"
domain="[('period_id','in','current_year')]"
help="Entries created in current year"/>
<filter icon="terp-go-month" string="This Month"
name="period"
domain="[('period_id','in','current_period')]"
help="Entries created in current period"/>
<separator orientation="vertical"/>
<filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]" help = "Draft entries"/>
<filter string="Posted" icon="terp-camera_test" domain="[('state','=','posted')]" help = "Posted entries"/>

View File

@ -47,7 +47,7 @@
I check the opening entries By using "Entries by Line wizard"
-
!record {model: account.move.journal, id: account_move_journal_0}:
journal_id: account.sales_journal
{}
-
I clicked on Open Journal Button to check the entries