Improve wizard that create invoice on analytic line

Don't take the line that have not to_invoice filled

bzr revid: ced-6f0052d94f6be42208a598f79c50502d631bedcc
This commit is contained in:
ced 2007-08-22 05:16:53 +00:00
parent ac3a4fc4a7
commit 2fc2d9c6af
2 changed files with 11 additions and 4 deletions

View File

@ -70,8 +70,11 @@ 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

@ -69,8 +69,12 @@ 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 (%s) GROUP BY product_id,to_invoice" % (account.id, ','.join(map(str,data['ids']))))
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(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():
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 !')