[IMP]:Account:account_invoice_report.py
bzr revid: sunilsharma.sharma07@gmail.com-20130808055354-0379xbn60gbcmvsc
This commit is contained in:
@@ -29,7 +29,7 @@ class account_invoice_report(osv.osv):
|
||||
_auto = False
|
||||
_rec_name = 'date'
|
||||
|
||||
def _compute_amounts_in_user_currency(self, cr, uid, ids, field_names, args, context=None):
|
||||
def _compute_amounts_in_user_currency(self, cr, uid, ids, field_names=[], args={}, context=None):
|
||||
"""Compute the amounts in the currency of the user
|
||||
"""
|
||||
if context is None:
|
||||
@@ -103,6 +103,19 @@ 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
|
||||
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,
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user