Accout_Report:Replaced expression_status field by 2 limit indicators and added 2 booleans for tree and graph.

bzr revid: jvo@tinyerp.com-20081010065659-s12b5gsfxlxn997a
This commit is contained in:
Jay Vora 2008-10-10 12:26:59 +05:30
parent 31c9e6fb38
commit 3878a43025
2 changed files with 34 additions and 23 deletions

View File

@ -85,25 +85,26 @@ class account_report(osv.osv):
'balance': _calc_balance,
'report': _calc_report,
}
if field_name=='status':
fld_name = 'expression_status'
else:
fld_name = 'expression'
# if field_name=='status':
# fld_name = 'expression_status'
# else:
# fld_name = 'expression'
try:
val = eval(getattr(rep, fld_name), objdict)
val = eval(getattr(rep,'expression'), objdict)
except:
val = 0.0
if field_name=='status':
if val<-1:
if val<rep.badness_limit:
result[rep.id] = 'very bad'
elif val<0:
elif val==rep.badness_limit:
result[rep.id] = 'bad'
elif val==0:
elif val<rep.goodness_limit:
result[rep.id] = 'normal'
elif val<1:
elif val==rep.goodness_limit:
result[rep.id] = 'good'
else:
result[rep.id] = 'excellent'
result[rep.id] = 'very good'
else:
result[rep.id] = val
return result
@ -129,7 +130,9 @@ class account_report(osv.osv):
('other','Others')],
'Type', required=True),
'expression': fields.char('Expression', size=240, required=True),
'expression_status': fields.char('Status expression', size=240, required=True),
# 'expression_status': fields.char('Status expression', size=240, required=True),
'badness_limit' :fields.float('Badness Indicator Limit', digits=(16,2),help='This Value depicts the limit of badness.'),
'goodness_limit' :fields.float('Goodness Indicator Limit', digits=(16,2),help='This Value depicts the limit of goodness.'),
'parent_id': fields.many2one('account.report.report', 'Parent'),
'child_ids': fields.one2many('account.report.report', 'parent_id', 'Childs'),
'note': fields.text('Note'),
@ -140,11 +143,13 @@ class account_report(osv.osv):
selection=[
('very bad', 'Very Bad'),
('bad', 'Bad'),
('normal', ''),
('normal', 'Normal'),
('good', 'Good'),
('excellent', 'Excellent')
('very good', 'Very Good')
],
string='Status'),
'disp_tree':fields.boolean('Display Tree',help='When the indicators will be printed, if one indicator is set with this field to True, then it will display one more graph with all its children in tree'),
'disp_graph':fields.boolean('Display as a Graph',help='If the field is set to True,information will be printed as a Graph; as an array otherwise.'),
# 'style': fields.selection(_style, 'Style', required=True),
# 'color_font' : fields.selection(_color, 'Font Color', help="Font Color for the report"),
# 'color_back' : fields.selection(_color, 'Back Color')

View File

@ -10,18 +10,22 @@
<form string="Accounting reporting">
<notebook>
<page string="General">
<field colspan="3" name="name" select="1"/>
<field colspan="4" name="name" select="1"/>
<field name="code" select="1"/>
<field name="active" select="1"/>
<field name="parent_id" on_change="onchange_parent_id(parent_id)"/>
<field name="sequence"/>
<field name="type" select="1"/>
<newline/>
<!-- <field name="style"/>
<field name="color_font"/>
<field name="color_back"/>-->
<newline/>
<field name="badness_limit"/>
<field name="goodness_limit"/>
<field colspan="4" name="expression"/>
<field colspan="4" name="expression_status"/>
<field name="disp_tree"/>
<field name="disp_graph"/>
<!-- <field colspan="4" name="expression_status"/>-->
<separator colspan="4" string="Legend of operators"/>
<label align="1.0" string="Account debit:"/>
<label align="0.0" string="debit('ACCOUNT_CODE')"/>
@ -35,18 +39,20 @@
<label align="0.0" string="+ - * / ( )"/>
<label colspan="4" string="Example: (balance('6','45') - credit('7')) / report('RPT1')"/>
<separator colspan="4" string="Return value for status"/>
<group col="2" colspan="1">
<label align="1.0" string="&lt; -1:"/>
<group col="2" colspan="2">
<label align="1.0" string="&lt; Badness Indicator Limit:"/>
<label align="0.0" string="Very bad"/>
<label align="1.0" string="-1:"/>
<label align="1.0" string="= Badness Indicator Limit:"/>
<label align="0.0" string="Bad"/>
<label align="1.0" string="0:"/>
<label align="0.0" string="Normal"/>
<label align="1.0" string="1:"/>
<!--<label align="1.0" string="0:"/>
<label align="0.0" string="Normal"/>-->
<label align="1.0" string="= Goodness Indicator Limit:"/>
<label align="0.0" string="Good"/>
<label align="1.0" string="&gt; 1:"/>
<label align="1.0" string="&gt; Goodness Indicator Limit:"/>
<label align="0.0" string="Very Good"/>
</group>
<group col="2" colspan="2">
</group>
</page>
<page string="Notes">
<field colspan="4" name="note" nolabel="1"/>