[IMP] improved code to show invoice bar value

bzr revid: tpa@tinyerp.com-20130816132754-tgnd3xoi9v3o5711
This commit is contained in:
Turkesh Patel (Open ERP) 2013-08-16 18:57:54 +05:30
parent 91403dbcb7
commit a3508b45d7
3 changed files with 3 additions and 5 deletions

View File

@ -136,8 +136,6 @@ class crm_case_section(osv.osv):
base_currency_id = self.pool.get('res.company').browse(cr, uid, groupby['__domain'][0][2], context=context).currency_id.id
elif inner_groupby[0] == 'pricelist_id':
base_currency_id = self.pool.get('product.pricelist').browse(cr, uid, groupby['__domain'][0][2], context=context).currency_id.id
else :
base_currency_id = groupby['__domain'][0][2]
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
value = self.pool.get('res.currency').compute(cr, uid, base_currency_id, user.company_id.currency_id.id, groupby.get(value_field, 0))
section_result[month]['value'] = section_result[month]['value'] + value

View File

@ -64,7 +64,7 @@ class crm_case_section(osv.osv):
groupby_begin = (month_begin + relativedelta.relativedelta(months=-4)).strftime(tools.DEFAULT_SERVER_DATE_FORMAT)
for id in ids:
created_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'cancel']), ('date', '>=', groupby_begin)]
res[id] = self.__get_bar_values(cr, uid, obj, created_domain, ['price_total', 'date','currency_id'], 'price_total', ['date','currency_id'], context=context)
res[id] = self.__get_bar_values(cr, uid, obj, created_domain, ['date'], 'user_currency_price_total', 'date', context=context)
return res
def _compute_amounts_in_user_currency(self, cr, uid, ids, field_names, args, context=None):
@ -103,7 +103,7 @@ class crm_case_section(osv.osv):
}
def action_forecast(self, cr, uid, id, value, context=None):
return self.write(cr, uid, [id], {'invoiced_forecast': int(value)}, context=context)
return self.write(cr, uid, [id], {'invoiced_forecast': int(float(value))}, context=context)
def write(self, cr, uid, ids, vals, context=None):
currency_obj = self.pool.get('res.currency')

View File

@ -236,7 +236,7 @@
<field name="res_model">account.invoice.report</field>
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="domain">[('state','=','paid'),('section_id', '=', active_id)]</field>
<field name="domain">[('section_id', '=', active_id)]</field>
<field name="context">{'search_default_month':1}</field>
<field name="help">From this report, you can have an overview of the amount invoiced to your customer. The tool search can also be used to personalise your Invoices reports and so, match this analysis to your needs.</field>
</record>