[IMP] improved code to show invoice bar value
authorTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Fri, 16 Aug 2013 13:27:54 +0000 (18:57 +0530)
committerTurkesh Patel (Open ERP) <tpa@tinyerp.com>
Fri, 16 Aug 2013 13:27:54 +0000 (18:57 +0530)
bzr revid: tpa@tinyerp.com-20130816132754-tgnd3xoi9v3o5711

addons/crm/crm.py
addons/sale_crm/sale_crm.py
addons/sale_crm/sale_crm_view.xml

index 0f9759a..a947900 100644 (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
index 5333016..c48c874 100644 (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')
index 0526efe..3656fa0 100644 (file)
             <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>