mirror of
https://github.com/NaN-tic/trytond-patches.git
synced 2023-12-14 06:03:03 +01:00
28 lines
1.2 KiB
Diff
28 lines
1.2 KiB
Diff
diff -r a79db218f578 invoice.py
|
|
--- a/trytond/trytond/modules/account_invoice/invoice.py Mon Jun 10 19:14:56 2019 +0200
|
|
+++ b/trytond/trytond/modules/account_invoice/invoice.py Sat Jul 13 10:00:36 2019 +0200
|
|
@@ -1306,6 +1306,8 @@
|
|
Credit invoices and return ids of new invoices.
|
|
Return the list of new invoice
|
|
'''
|
|
+ MoveLine = Pool().get('account.move.line')
|
|
+
|
|
new_invoices = [i._credit() for i in invoices]
|
|
cls.save(new_invoices)
|
|
cls.update_taxes(new_invoices)
|
|
@@ -1317,9 +1319,11 @@
|
|
gettext('account_invoice'
|
|
'.msg_invoice_credit_refund_not_posted',
|
|
invoice=invoice.rec_name))
|
|
- invoice.cancel_move = new_invoice.move
|
|
- cls.save(invoices)
|
|
- cls.cancel(invoices)
|
|
+ if new_invoice.state == 'posted':
|
|
+ MoveLine.reconcile([l for l in invoice.lines_to_pay
|
|
+ if not l.reconciliation] +
|
|
+ [l for l in new_invoice.lines_to_pay
|
|
+ if not l.reconciliation])
|
|
return new_invoices
|
|
|
|
@classmethod
|