From fcfb571112fbcfc8793f212951a1f31d65a376ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Sainl=C3=A9ger?= Date: Thu, 5 Jun 2025 08:42:31 +0200 Subject: [PATCH 1/2] [IMP] event_generate_quotation_from_registration: prevent edition attempts of done sale orders --- .../models/event_registration.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/event_generate_quotation_from_registration/models/event_registration.py b/event_generate_quotation_from_registration/models/event_registration.py index f862595..ec7e575 100644 --- a/event_generate_quotation_from_registration/models/event_registration.py +++ b/event_generate_quotation_from_registration/models/event_registration.py @@ -36,8 +36,9 @@ class EventRegistration(models.Model): financier.quotation_id = sale_order else: order_lines = self.env['sale.order.line'].search([ - ('order_id','=',financier.quotation_id.id), - ('product_id','=',financier.get_product_id()) + ('order_id','=',financier.quotation_id.id), + ('product_id','=',financier.get_product_id()), + ('state', '!=', 'done'), ]) if order_lines: order_lines[0].price_unit = financier.amount -- 2.49.1 From cb302a30b42698346aa61ef3ec45cf86977f9065 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Sainl=C3=A9ger?= Date: Thu, 5 Jun 2025 09:05:45 +0200 Subject: [PATCH 2/2] [IMP] event_generate_quotation_from_registration: block field edition of event.registration.financier if the quotation is done. --- .../models/event_registration_financier.py | 4 ++++ .../views/event_registration_views.xml | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/event_generate_quotation_from_registration/models/event_registration_financier.py b/event_generate_quotation_from_registration/models/event_registration_financier.py index 67dce93..6299dae 100644 --- a/event_generate_quotation_from_registration/models/event_registration_financier.py +++ b/event_generate_quotation_from_registration/models/event_registration_financier.py @@ -17,6 +17,10 @@ class EventRegistrationFinancier(models.Model): financier_id = fields.Many2one('res.partner', string="Financeur", required=True) terms = fields.Char('Modalités') amount = fields.Monetary('Montant', currency_field="company_currency_id") + state = fields.Selection( + related='quotation_id.state', + string="Order Status", + copy=False, store=True, precompute=True) def get_product_id(self): diff --git a/event_generate_quotation_from_registration/views/event_registration_views.xml b/event_generate_quotation_from_registration/views/event_registration_views.xml index b8eebd6..095df3b 100644 --- a/event_generate_quotation_from_registration/views/event_registration_views.xml +++ b/event_generate_quotation_from_registration/views/event_registration_views.xml @@ -10,9 +10,10 @@ - - - + + + + -- 2.49.1