diff --git a/addons/account_voucher/voucher.py b/addons/account_voucher/voucher.py index 0b1b9b01b23..e1005512127 100644 --- a/addons/account_voucher/voucher.py +++ b/addons/account_voucher/voucher.py @@ -203,7 +203,7 @@ class account_voucher(osv.osv): } self.write(cr, uid, ids, res) else: - raise osv.except_osv('Invalid action !', 'You cannot post to Pro-Forma a voucher with Total amount = 0 !') + raise osv.except_osv(_('Invalid action !'), _('You can not post to Pro-Forma a voucher with Total amount = 0 !')) return True def proforma_voucher(self, cr, uid, ids, context={}): diff --git a/addons/account_voucher_payment/account_voucher_payment.py b/addons/account_voucher_payment/account_voucher_payment.py index dca7eebc977..2bae0e6f75a 100755 --- a/addons/account_voucher_payment/account_voucher_payment.py +++ b/addons/account_voucher_payment/account_voucher_payment.py @@ -45,7 +45,10 @@ class account_invoice(osv.osv): args += [('type','in', ['out_invoice', 'in_refund'])] elif ttype and ttype in ('pay_voucher', 'bank_pay_voucher'): args += [('type','in', ['in_invoice', 'out_refund'])] - + elif ttype and ttype in('journal_sale_vou', 'journal_pur_voucher', 'journal_voucher'): + raise osv.except_osv(_('Invalid action !'), _('You can not reconcile sales, purchase, or journal entry with invoice !')) + args += [('type','=', 'do_not_allow_search')] + res = super(account_invoice, self).search(cr, user, args, offset, limit, order, context, count) return res @@ -187,11 +190,12 @@ class account_voucher(osv.osv): move_line_id = move_line_pool.create(cr, uid, move_line) line_ids += [move_line_id] - if line.invoice_id: + if line.invoice_id and inv.type in ('pay_voucher', 'bank_pay_voucher', 'rec_voucher', 'bank_rec_voucher'): rec_ids += [move_line_id] for move_line in line.invoice_id.move_id.line_id: if line.account_id.id == move_line.account_id.id: - rec_ids += [move_line.id] + rec_ids += [move_line.id] + if rec_ids: move_line_pool.reconcile_partial(cr, uid, rec_ids)