[account_invoice] Delete the link between account_invoice and account move when the reconciliation is deleted

041963
This commit is contained in:
Juanjo Garcia 2020-11-16 17:15:16 +01:00
parent 5dee6c90f8
commit e7c0caa73d
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,23 @@
diff --git a/account.py b/account.py
--- a/trytond/trytond/modules/account_invoice/account.py
+++ b/trytond/trytond/modules/account_invoice/account.py
@@ -292,11 +292,19 @@ class Reconciliation(metaclass=PoolMeta):
def delete(cls, reconciliations):
Invoice = Pool().get('account.invoice')
- move_ids = set(l.move.id for r in reconciliations for l in r.lines)
+ to_remove = []
+ move_ids = ()
+ for r in reconciliations:
+ for l in r.lines:
+ if l.invoice_payments:
+ to_remove.append(l)
+ move_ids = move_ids + (l.move.id,)
+
invoices = Invoice.search([
('move', 'in', list(move_ids)),
])
super(Reconciliation, cls).delete(reconciliations)
+ Invoice.remove_payment_lines(to_remove)
Invoice.process(invoices)

4
series
View File

@ -57,4 +57,6 @@ issue9797.diff # [account_payment_sepa] Slowness processing sepa
issue9802.diff # [stock] Improve performance when partially assigning moves
issue9519.diff # [sale + purchase] Use search context for product field on line
issue9814.diff #[product] Product template search bar showing non serchable product.product function fields as recomendation
issue9814.diff #[product] Product template search bar showing non serchable product.product function fields as recomendation
account_delete_reconcilation.diff # [account_invoice] Delete the link between account_invoice and account move when the reconciliation is deleted