Prevent refund of supplier invoice/credit note

review662003
This commit is contained in:
Cédric Krier committed 2013-02-23 17:43:35 +01:00
1 parent e329d56ac7
commit d19067f3f6
2 files changed
+8 -1

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
* Prevent refund of supplier invoice/credit note
* Make period's invoice sequences optional and use fiscal year's ones if empty
* Cancel state delete or cancel existing move on Invoice
* Create draft move for Supplier Invoice when validated
+7 -1
View File
@@ -2558,6 +2558,8 @@ class CreditInvoice(Wizard):
'an invoice that is not posted!'),
'refund_with_payement': ('You can not credit with refund '
'an invoice with payments!'),
'refund_supplier': ('You can not credit with refund '
'a supplier invoice/credit note.'),
})
def default_start(self, fields):
@@ -2566,7 +2568,9 @@ class CreditInvoice(Wizard):
'with_refund': True,
}
for invoice in Invoice.browse(Transaction().context['active_ids']):
if invoice.state != 'posted' or invoice.payment_lines:
if (invoice.state != 'posted'
or invoice.payment_lines
or invoice.type in ('in_invoice', 'in_credit_note')):
default['with_refund'] = False
break
return default
@@ -2584,6 +2588,8 @@ class CreditInvoice(Wizard):
self.raise_user_error('refund_non_posted')
if invoice.payment_lines:
self.raise_user_error('refund_with_payement')
if invoice.type in ('in_invoice', 'in_credit_note'):
self.raise_user_error('refund_supplier')
invoice_ids = Invoice.credit(invoices, refund=refund)