[FIX] cannot create advance invoice in a SO
authorARA (OpenERP) <ara@tinyerp.com>
Fri, 23 Sep 2011 11:59:02 +0000 (17:29 +0530)
committerARA (OpenERP) <ara@tinyerp.com>
Fri, 23 Sep 2011 11:59:02 +0000 (17:29 +0530)
lp bug: https://launchpad.net/bugs/856402 fixed

bzr revid: ara@tinyerp.com-20110923115902-0xy62ca4hb8jhq9b

addons/sale/wizard/sale_make_invoice_advance.py

index 4b1e451..959ed94 100644 (file)
@@ -65,6 +65,13 @@ class sale_advance_payment_inv(osv.osv_memory):
                              that is defined as 'Automatic Invoice after delivery'."))
                 val = obj_lines.product_id_change(cr, uid, [], sale_adv_obj.product_id.id,
                         uom = False, partner_id = sale.partner_id.id, fposition_id = sale.fiscal_position.id)
+                
+                if not val['value'].get('account_id'):
+                    raise osv.except_osv(_('Error !'),
+                                _('There is no income account defined ' \
+                                        'for this product: "%s" (id:%d)') % \
+                                        (sale_adv_obj.product_id.name, sale_adv_obj.product_id.id,))
+                
                 line_id = obj_lines.create(cr, uid, {
                     'name': val['value']['name'],
                     'account_id': val['value']['account_id'],