From b4af1461c4a66db63e253d600cf3e35189d86fc1 Mon Sep 17 00:00:00 2001 From: ced <> Date: Tue, 23 Jan 2007 15:17:17 +0000 Subject: [PATCH] HR_TIMESHEET_INVOICE: improve create invoice bzr revid: ced-93af4c09cfc8446aad3e104aea1b65ec905a5915 --- addons/account/account_analytic_line.py | 2 +- .../wizard/hr_timesheet_invoice_create.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/account/account_analytic_line.py b/addons/account/account_analytic_line.py index 77e605c1d46..22434350849 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -41,7 +41,7 @@ class account_analytic_line(osv.osv): 'amount' : fields.float('Amount', required=True), 'unit_amount' : fields.float('Quantity'), 'product_uom_id' : fields.many2one('product.uom', 'UoM'), - 'product_id' : fields.many2one('product.product', 'Product'), + 'product_id' : fields.many2one('product.product', 'Product', required=True), 'account_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=True, ondelete='cascade', select=True), 'general_account_id' : fields.many2one('account.account', 'General account', required=True, ondelete='cascade'), 'move_id' : fields.many2one('account.move.line', 'General entry', ondelete='cascade', select=True), diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index 6ab95753f3e..f0c7623ad29 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -62,7 +62,7 @@ class invoice_create(wizard.interface): for account in pool.get('account.analytic.account').browse(cr, uid, account_ids, context): partner = account.partner_id if (not partner) or not (account.pricelist_id): - raise wizard.except_wizard('Analytic account incomplete', 'Plese fill in the partner and pricelist field in the analytic account:\n%s' % (account.name,)) + raise wizard.except_wizard('Analytic account incomplete', 'Please fill in the partner and pricelist field in the analytic account:\n%s' % (account.name,)) curr_invoice = { 'name': time.strftime('%D')+' - '+account.name, @@ -77,11 +77,13 @@ class invoice_create(wizard.interface): last_invoice = pool.get('account.invoice').create(cr, uid, curr_invoice) invoices.append(last_invoice) + 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(): - product = pool.get('product.product').browse(cr, uid, product_id, context) + 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, context) + factor = pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2) if factor.customer_name: factor_name = product.name+' - '+factor.customer_name else: