From b84248c04cf86c8bfa56e275181bf7b9dce8723d Mon Sep 17 00:00:00 2001 From: Ferdinand <> Date: Thu, 8 Sep 2011 14:52:29 +0530 Subject: [PATCH] [FIX] hr_timesheet_invoice : Added Configuration Error when no income account is set for service product lp bug: https://launchpad.net/bugs/838887 fixed bzr revid: bde@tinyerp.com-20110908092229-2fg0xixgpjgsdjwm --- .../wizard/hr_timesheet_final_invoice_create.py | 4 ++++ .../wizard/hr_timesheet_invoice_create.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py index 66975695814..0e056b81e61 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py @@ -126,6 +126,8 @@ class final_invoice_create(osv.osv_memory): taxes = [] tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes) + if not account_id: + raise osv.except_osv(_("Configuration Error"), _("No income account defined for product '%s'") % product.name) curr_line = { 'price_unit': -amount, 'quantity': 1.0, @@ -146,6 +148,8 @@ class final_invoice_create(osv.osv_memory): taxes = product.taxes_id tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes) account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id + if not account_id: + raise osv.except_osv(_("Configuration Error"), _("No income account defined for product '%s'") % product.name) curr_line = { 'price_unit': account.amount_max - amount_total, 'quantity': 1.0, 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 4372a19a89a..502d35ff2d1 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -155,6 +155,8 @@ class hr_timesheet_invoice_create(osv.osv_memory): taxes = product.taxes_id tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes) account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id + if not account_id: + raise osv.except_osv(_("Configuration Error"), _("No income account defined for product '%s'") % product.name) curr_line = { 'price_unit': price, 'quantity': qty,