[MERGE] Account: Dashboard problem on entries report

bzr revid: mra@mra-laptop-20110105073712-nbjkpbp2i513df9r
This commit is contained in:
Mustufa Rangwala 2011-01-05 13:07:12 +05:30
commit 45248478f5
4 changed files with 16 additions and 20 deletions

View File

@ -124,7 +124,6 @@ class account_analytic_line(osv.osv):
result = round(amount, prec)
if not flag:
result *= -1
return {'value': {
'amount': result,
'general_account_id': a,

View File

@ -27,6 +27,7 @@
<field name="view_mode">tree,graph</field>
<field name="context">{'group_by':['user_type'], 'group_by_no_leaf':1}</field>
<field name="view_id" ref="account.view_account_entries_report_tree"/>
<field name="domain">[('year','=',time.strftime('%Y'))]</field>
</record>
<record id="action_treasory_graph" model="ir.actions.act_window">
<field name="name">Treasury</field>

View File

@ -94,25 +94,21 @@ class account_entries_report(osv.osv):
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, *args, **kwargs):
todel=[]
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
if context is None:
context = {}
fiscalyear_obj = self.pool.get('account.fiscalyear')
period_obj = self.pool.get('account.period')
for arg in domain:
if arg[0] == 'period_id' and arg[2] == 'current_period':
current_period = period_obj.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 = fiscalyear_obj.find(cr, uid)
ids = fiscalyear_obj.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, *args, **kwargs)
if context.get('period', False) == 'current_period':
current_period = period_obj.find(cr, uid)[0]
domain.append(['period_id','in',[current_period]])
elif context.get('year', False) == 'current_year':
current_year = fiscalyear_obj.find(cr, uid)
ids = fiscalyear_obj.read(cr, uid, [current_year], ['period_ids'])[0]['period_ids']
domain.append(['period_id','in',ids])
else:
domain = domain
return super(account_entries_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby)
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_entries_report')

View File

@ -70,11 +70,11 @@
<group colspan="10" col="12">
<filter icon="terp-go-year" string="This F.Year"
name="thisyear"
domain="[('period_id','in','current_year')]"
context="{'year':'current_year'}"
help="Journal Entries with period in current year"/>
<filter icon="terp-go-month" string="This Period"
name="period"
domain="[('period_id','in','current_period')]"
context="{'period':'current_period'}"
help="Journal Entries with period in current period"/>
<separator orientation="vertical"/>
<filter string="Unposted" icon="terp-document-new" domain="[('move_state','=','draft')]" help = "entries"/>