[MERGE] [FIX] division by zero in product margins with 0 sale price and 0 qty (#591893)
bzr revid: jri@openerp.com-20140307132929-jz4ebc37u1huj4nl
This commit is contained in:
commit
cb3791d83d
|
@ -53,9 +53,9 @@ class product_product(osv.osv):
|
|||
states = ('draft', 'open', 'paid')
|
||||
|
||||
sqlstr="""select
|
||||
sum(l.price_unit * l.quantity)/sum(l.quantity) as avg_unit_price,
|
||||
sum(l.price_unit * l.quantity)/sum(nullif(l.quantity,0)) as avg_unit_price,
|
||||
sum(l.quantity) as num_qty,
|
||||
sum(l.quantity * (l.price_subtotal/l.quantity)) as total,
|
||||
sum(l.quantity * (l.price_subtotal/(nullif(l.quantity,0)))) as total,
|
||||
sum(l.quantity * pt.list_price) as sale_expected,
|
||||
sum(l.quantity * pt.standard_price) as normal_cost
|
||||
from account_invoice_line l
|
||||
|
|
Loading…
Reference in New Issue