From 6dcad4d12a098bbe42e8e65d6dae4ad6190cee98 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 20 Aug 2022 15:54:38 +0200 Subject: [PATCH] booking --- models/booking_event_registration.py | 10 +++++++--- models/payment_transaction.py | 13 +++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/models/booking_event_registration.py b/models/booking_event_registration.py index 87f8c30..f673fc2 100644 --- a/models/booking_event_registration.py +++ b/models/booking_event_registration.py @@ -269,6 +269,7 @@ class EventRegistration(models.Model): if reg.partner_id.email==reg.email: status=reg.partner_id.member_status #le participant n'est pas la personne qui s'est connecté + else: participant=self.env['res.partner'].sudo().search([('email','=',reg.email)],limit=1) if participant: @@ -276,7 +277,7 @@ class EventRegistration(models.Model): else: status='not member' - + product_price=event.booking_price if status=='not member':product_price=event.booking_price if status=='member':product_price=event.booking_member_price @@ -290,13 +291,16 @@ class EventRegistration(models.Model): if membership_product: if selected_registrant_options: for opt in selected_registrant_options: - if opt.booking_option_id==membership_product.id: + #raise Warning("opt.booking_option_id="+str(opt.booking_option_id.id)+" membership_product.id="+str(membership_product.id)) + if opt.booking_option_id.id==membership_product.id: membership_option=True + if status!="super member": product_price=event.booking_member_price - + if self.payment_adjustement!=0: product_price=product_price+self.payment_adjustement + #calcul du montant total à régler if end_of_stay_invoice:product_price=0 diff --git a/models/payment_transaction.py b/models/payment_transaction.py index 4888ba8..4921684 100644 --- a/models/payment_transaction.py +++ b/models/payment_transaction.py @@ -76,7 +76,16 @@ class PaymentTransaction(models.Model): def _compute_reference_prefix(self, values): if values and values.get('invoice_ids'): invoices = self.new({'invoice_ids': values['invoice_ids']}).invoice_ids - return ','.join(invoices.mapped('name')) + + if len(invoices)==1: + invoice=self.env['account.move'].sudo().search([('name','=',invoices.name)]) + reg=self.env['event.registration'].sudo().search(['|','|',('invoice_id','=',invoice.id),('balance_invoice_id','=',invoice.id),('down_payment_invoice_id','=',invoice.id)]) + if reg: + return 'txR-'+invoice.name + else: + return 'txP-'+invoice.name + else: + return ','.join(invoices.mapped('name')) if values and values.get('donation_ids'): @@ -101,7 +110,7 @@ class AcquirerSystempay(models.Model): delta=str(delta) delta=delta[:-1] prefix=values['reference'][2:3] - if prefix not in ('D','A'): prefix='P' + if prefix not in ('D','A','P','R'): prefix='' trans_id = prefix+delta.rjust(5)