Kirti Savalia(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-383657-ksa into 
lp:openobject-addons/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-383657-ksa/+merge/93343

Hello,

When unit quantity or factor value is zero at that time get the error of divide 
by zero.
This fix solve the issue.

Thanks.
KSA
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-383657-ksa/+merge/93343
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-383657-ksa.
=== modified file 'hr_expense/report/hr_expense_report.py'
--- hr_expense/report/hr_expense_report.py	2011-01-14 00:11:01 +0000
+++ hr_expense/report/hr_expense_report.py	2012-02-16 07:15:20 +0000
@@ -92,7 +92,7 @@
                      sum(l.unit_quantity * u.factor) as product_qty,
                      s.company_id as company_id,
                      sum(l.unit_quantity*l.unit_amount) as price_total,
-                     (sum(l.unit_quantity*l.unit_amount)/sum(l.unit_quantity * u.factor))::decimal(16,2) as price_average,
+                     (sum(l.unit_quantity*l.unit_amount)/sum(case when l.unit_quantity=0 or u.factor=0 then 1 else l.unit_quantity * u.factor end))::decimal(16,2) as price_average,
                      count(*) as nbr,
                      (select unit_quantity from hr_expense_line where id=l.id and product_id is not null) as no_of_products,
                      (select analytic_account from hr_expense_line where id=l.id and analytic_account is not null) as no_of_account,

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to