[IMP] improved code to show invoice analysis report amounts in current user currency.

bzr revid: tpa@tinyerp.com-20130808091645-8loajee0ss41d1u4
This commit is contained in:
Turkesh Patel (Open ERP) 2013-08-08 14:46:45 +05:30
parent edf31c829c
commit 3fa5247928
3 changed files with 14 additions and 3 deletions

View File

@ -103,6 +103,18 @@ class account_invoice_report(osv.osv):
}
_order = 'date desc'
#FIX:To show sum of values of function fields in groupby
def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False):
res = super(account_invoice_report, self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby)
for group in res:
group['user_currency_price_total'] = 0
if group.get('__domain'):
group_ids = self.search(cr, uid, group.get('__domain'),context=context)
record = self._compute_amounts_in_user_currency(cr, uid, group_ids, context=context)
for id, rec in record.iteritems():
group['user_currency_price_total'] += rec['user_currency_price_total']
return res
def _select(self):
select_str = """
SELECT sub.id, sub.date, sub.year, sub.month, sub.day, sub.product_id, sub.partner_id, sub.country_id,

View File

@ -30,7 +30,7 @@
<field name="nbr" sum="# of Lines"/>
<field name="product_qty" sum="Qty"/>
<!-- <field name="reconciled" sum="# Reconciled"/> -->
<field name="price_total" sum="Total Without Tax"/>
<field name="user_currency_price_total" sum="Total Without Tax"/>
</tree>
</field>
</record>
@ -41,7 +41,7 @@
<field name="arch" type="xml">
<graph string="Invoices Analysis" type="bar">
<field name="product_id"/>
<field name="price_total"/>
<field name="user_currency_price_total"/>
</graph>
</field>
</record>

View File

@ -1,7 +1,6 @@
.openerp .oe_kanban_view .oe_kanban_crm_salesteams {
width: 345px;
cursor: default;
min-height: 240px !important;
}
.openerp .oe_kanban_view .oe_kanban_crm_salesteams .oe_avatars {
text-align: right;