[FIX] hr_timesheet_invoice : Invoicing analytic entries wizard corrected for product

lp bug: https://launchpad.net/bugs/427982 fixed

bzr revid: jvo@tinyerp.com-20090914120017-n04v3zplm78d1shu
This commit is contained in:
Jay (Open ERP)
2009-09-14 17:30:17 +05:30
parent f30db50e9a
commit 9bee299b7f
@@ -92,19 +92,25 @@ class invoice_create(wizard.interface):
"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 one line has no product !'))
factor_name = ''
factor = pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2)
if factor.customer_name:
factor_name = product.name+' - '+factor.customer_name
if not data['form']['product']:
if factor.customer_name:
factor_name = product.name+' - '+factor.customer_name
else:
factor_name = product.name
else:
factor_name = product.name
factor_name = pool.get('product.product').name_get(cr, uid, [data['form']['product']], context=context)[0][1]
if account.pricelist_id:
pl = account.pricelist_id.id
price = pool.get('product.pricelist').price_get(cr,uid,[pl], product_id, qty or 1.0, account.partner_id.id)[pl]
price = pool.get('product.pricelist').price_get(cr,uid,[pl], data['form']['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
else:
price = 0.0
@@ -125,7 +131,7 @@ class invoice_create(wizard.interface):
'account_id': account_id,
'account_analytic_id': account.id,
}
#
# Compute for lines
#