[IMP]:User_Currency:

bzr revid: sunilsharma.sharma07@gmail.com-20130813063315-i45q7dykm6sp3a94
This commit is contained in:
Sunil Sharma (OpenERP Trainee) 2013-08-13 12:03:15 +05:30
parent c80f758989
commit 418c77da30
2 changed files with 11 additions and 5 deletions

View File

@ -144,9 +144,15 @@ class crm_case_section(osv.osv):
if inner_groupby:
groupby_company = obj.read_group(cr, uid, group.get('__domain'), read_fields, inner_groupby, context=context)
for groupby in groupby_company:
company = self.pool.get('res.company').browse(cr, uid, groupby['__domain'][0][2], context=context)
if inner_groupby[0] == 'company_id':
company = self.pool.get('res.company').browse(cr, uid, groupby['__domain'][0][2], context=context)
base_currency_id = company.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, company.currency_id.id, user.company_id.currency_id.id, groupby.get(value_field, 0))
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
return section_result

View File

@ -52,9 +52,9 @@ class crm_case_section(osv.osv):
for id in ids:
res[id] = dict()
created_domain = [('section_id', '=', id), ('state', 'in', ['draft', 'sent']), ('date_order', '>=', groupby_begin)]
res[id]['monthly_quoted'] = self.__get_bar_values(cr, uid, obj, created_domain, ['amount_total', 'date_order'], 'amount_total', 'date_order', context=context)
res[id]['monthly_quoted'] = self.__get_bar_values(cr, uid, obj, created_domain, ['amount_total', 'date_order','pricelist_id'], 'amount_total', ['date_order','pricelist_id'], context=context)
validated_domain = [('section_id', '=', id), ('state', 'not in', ['draft', 'sent']), ('date_confirm', '>=', groupby_begin)]
res[id]['monthly_confirmed'] = self.__get_bar_values(cr, uid, obj, validated_domain, ['amount_total', 'date_confirm'], 'amount_total', 'date_confirm', context=context)
res[id]['monthly_confirmed'] = self.__get_bar_values(cr, uid, obj, validated_domain, ['amount_total', 'date_confirm','pricelist_id'], 'amount_total', ['date_confirm','pricelist_id'], context=context)
return res
def _get_invoices_data(self, cr, uid, ids, field_name, arg, context=None):
@ -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'], 'price_total', 'date', context=context)
res[id] = self.__get_bar_values(cr, uid, obj, created_domain, ['price_total', 'date','currency_id'], 'price_total', ['date','currency_id'], context=context)
return res
def _compute_amounts_in_user_currency(self, cr, uid, ids, field_names, args, context=None):