if repair.state in ('draft','cancel') or repair.invoice_id:
continue
if not (repair.partner_id.id and repair.partner_invoice_id.id):
- raise osv.except_osv(_('No partner !'),_('You have to select a partner in the repair form !'))
+ raise osv.except_osv(_('No partner !'),_('You have to select a partner and invoicing address in the repair form !'))
comment=repair.quotation_notes
if (repair.invoice_method != 'none'):
if group and repair.partner_invoice_id.id in invoices_group:
name = repair.name + '-' + operation.name
else:
name = operation.name
-
+
if operation.product_id.property_account_income:
account_id = operation.product_id.property_account_income
elif operation.product_id.categ_id.property_account_income_categ:
else:
raise osv.except_osv(_('Error !'), _('No account defined for product "%s".') % operation.product_id.name )
- invoice_line_id=self.pool.get('account.invoice.line').create(cr, uid, {
+ invoice_line_id = self.pool.get('account.invoice.line').create(cr, uid, {
'invoice_id': inv_id,
'name': name,
'origin':repair.name,
name = repair.name + '-' + fee.name
else:
name = fee.name
- invoice_fee_id=self.pool.get('account.invoice.line').create(cr, uid, {
+ if not fee.product_id:
+ raise osv.except_osv(_('Warning !'), _('No product defined on Fees!'))
+ if fee.product_id.property_account_income:
+ account_id = fee.product_id.property_account_income
+ elif fee.product_id.categ_id.property_account_income_categ:
+ account_id = fee.product_id.categ_id.property_account_income_categ.id
+ else:
+ raise osv.except_osv(_('Error !'), _('No account defined for product "%s".') % fee.product_id.name)
+ invoice_fee_id = self.pool.get('account.invoice.line').create(cr, uid, {
'invoice_id': inv_id,
'name': name,
'origin':repair.name,
- 'account_id': a,
+ 'account_id': account_id,
'quantity': fee.product_uom_qty,
'invoice_line_tax_id': [(6,0,[x.id for x in fee.tax_id])],
'uos_id': fee.product_uom.id,