Fix invoice on timesheet wizard when there is no invoice rate

bzr revid: ced-097a471a1db1c691b856225beb8d85d2517ed6d7
This commit is contained in:
ced 2007-10-12 10:53:47 +00:00
parent b8c1427bb1
commit d409c1be45
2 changed files with 13 additions and 11 deletions

View File

@ -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)

View File

@ -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 !')