Fix invoice on timesheet wizard when there is no invoice rate
bzr revid: ced-097a471a1db1c691b856225beb8d85d2517ed6d7
This commit is contained in:
parent
b8c1427bb1
commit
d409c1be45
|
@ -86,11 +86,12 @@ class final_invoice_create(wizard.interface):
|
|||
|
||||
context2=context.copy()
|
||||
context2['lang'] = partner.lang
|
||||
cr.execute("SELECT product_id, to_invoice, sum(unit_amount) \
|
||||
FROM account_analytic_line as line \
|
||||
WHERE account_id = %d AND to_invoice IS NOT NULL \
|
||||
GROUP BY product_id, to_invoice", (account.id,))
|
||||
for product_id, factor_id, qty in cr.fetchall():
|
||||
cr.execute("SELECT product_id, to_invoice, sum(unit_amount) " \
|
||||
"FROM account_analytic_line as line " \
|
||||
"WHERE account_id = %d " \
|
||||
"AND to_invoice IS NOT NULL " \
|
||||
"GROUP BY product_id, to_invoice", (account.id,))
|
||||
for product_id,factor_id,qty in cr.fetchall():
|
||||
product = pool.get('product.product').browse(cr, uid, product_id, context2)
|
||||
factor_name = ''
|
||||
factor = pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2)
|
||||
|
|
|
@ -88,12 +88,13 @@ class invoice_create(wizard.interface):
|
|||
|
||||
context2=context.copy()
|
||||
context2['lang'] = partner.lang
|
||||
cr.execute("SELECT product_id, to_invoice, sum(unit_amount) \
|
||||
FROM account_analytic_line as line \
|
||||
WHERE account_id = %d AND id IN ("+','.join(map(str,data['ids']))+") \
|
||||
AND to_invoice IS NOT NULL \
|
||||
GROUP BY product_id, to_invoice", (account.id,))
|
||||
for product_id, factor_id, qty in cr.fetchall():
|
||||
cr.execute("SELECT product_id, to_invoice, sum(unit_amount) " \
|
||||
"FROM account_analytic_line as line " \
|
||||
"WHERE account_id = %d " \
|
||||
"AND id IN (" + ','.join([str(x) for x in data['ids']]) + ") " \
|
||||
"AND to_invoice IS NOT NULL " \
|
||||
"GROUP BY product_id,to_invoice", (account.id,))
|
||||
for product_id,factor_id,qty in cr.fetchall():
|
||||
product = pool.get('product.product').browse(cr, uid, product_id, context2)
|
||||
if not product:
|
||||
raise wizard.except_wizard('Error', 'At least on line have no product !')
|
||||
|
|
Loading…
Reference in New Issue