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,