From e704376ec7b016d9292b26f337b5852202d6e8ab Mon Sep 17 00:00:00 2001 From: root Date: Sun, 4 Sep 2022 21:12:14 +0200 Subject: [PATCH] supp facture --- models/booking_event_registration.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/models/booking_event_registration.py b/models/booking_event_registration.py index fe59184..107508c 100644 --- a/models/booking_event_registration.py +++ b/models/booking_event_registration.py @@ -210,6 +210,12 @@ class EventRegistration(models.Model): invoice.state='draft' invoice_id=self.invoice_id self.invoice_id=False + #suppression des paiements liés à la facture + self.env['account.payment'].sudo().search([('move_id','=',int(invoice_id))]).unlink() + + #suppression des écritures comptables lié à la facture + self.env['account.move.line'].sudo().search([('move_id','=',int(invoice_id))]).unlink() + #suppression de la facture self.env['account.move'].sudo().search([('id','=',int(invoice_id))]).unlink() invoice=self.env['account.move'].sudo().search([('id','=',int(self.down_payment_invoice_id))])