|
|
@ -117,18 +117,26 @@ class BookingEvent(models.Model): |
|
|
|
header_ligne='Nom & Prénom;Genre;Rôle;Options;Montant retraite;Adhésion;Autre options;Montant à payer;Statut commande;Type de paiement;Règlement\n' |
|
|
|
csv_lines='' |
|
|
|
for reg in booking.registration_ids: |
|
|
|
if reg.state in ('draft','cancel'): continue |
|
|
|
name=str(reg.name) |
|
|
|
if reg.firstname:name=name+' '+str(reg.firstname) |
|
|
|
gender=str(reg.gender) |
|
|
|
if reg.gender=='male':gender='homme' |
|
|
|
elif reg.gender=='femelle':gender='femme' |
|
|
|
else:gender='N/A' |
|
|
|
role=self._compute_member_status(reg) |
|
|
|
if role=='not member':role='non adhérent' |
|
|
|
elif role=='member':role='adhérent' |
|
|
|
elif role=='super member':role='membre de soutien' |
|
|
|
else: role='N/A' |
|
|
|
|
|
|
|
options=self._compute_invoice_options(reg) |
|
|
|
booking_amount=self._compute_booking_amount(reg) |
|
|
|
membership_amount=self._compute_membership_amount(reg) |
|
|
|
invoice_options_amount= self._compute_invoice_options_amount(reg) |
|
|
|
amount_to_be_paid=self._compute_amount_to_be_paid(reg) |
|
|
|
booking_amount=str(round(self._compute_booking_amount(reg))) |
|
|
|
membership_amount=str(round(self._compute_membership_amount(reg))) |
|
|
|
invoice_options_amount= str(round(self._compute_invoice_options_amount(reg))) |
|
|
|
amount_to_be_paid=str(round(self._compute_amount_to_be_paid(reg))) |
|
|
|
payment_status=str(reg.payment_status) |
|
|
|
payment_mode=self._compute_payment_mode(reg) |
|
|
|
amount_paid=self._compute_amount_paid(reg) |
|
|
|
amount_paid=str(round(self._compute_amount_paid(reg))) |
|
|
|
|
|
|
|
csv_lines=csv_lines+name+';'+gender+';'+role+';'+options+';'+booking_amount+';'+membership_amount+';'+invoice_options_amount+';'+amount_to_be_paid+';'+payment_status+';'+payment_mode+';'+amount_paid+'\n' |
|
|
|
|
|
|
@ -155,7 +163,7 @@ class BookingEvent(models.Model): |
|
|
|
if rec.end_of_stay_invoice_id: |
|
|
|
amount_paid=amount_paid+rec.end_of_stay_invoice_id.amount_total-rec.end_of_stay_invoice_id.amount_residual |
|
|
|
|
|
|
|
return str(amount_paid) |
|
|
|
return amount_paid |
|
|
|
def _compute_amount_to_be_paid(self,rec): |
|
|
|
|
|
|
|
amount_to_be_paid=0 |
|
|
@ -167,7 +175,7 @@ class BookingEvent(models.Model): |
|
|
|
amount_to_be_paid=amount_to_be_paid+rec.balance_invoice_id.amount_residual |
|
|
|
if rec.end_of_stay_invoice_id: |
|
|
|
amount_to_be_paid=amount_to_be_paid+rec.end_of_stay_invoice_id.amount_residual |
|
|
|
return str(amount_to_be_paid) |
|
|
|
return amount_to_be_paid |
|
|
|
def _compute_invoice_options_amount(self,rec): |
|
|
|
membership_product=self.env['product.product'].sudo().search([('membership_product','=',True)],limit=1) |
|
|
|
|
|
|
@ -200,7 +208,7 @@ class BookingEvent(models.Model): |
|
|
|
invoice_options_amount=invoice_options_amount+line.price_subtotal |
|
|
|
|
|
|
|
i=i+1 |
|
|
|
return str(invoice_options_amount) |
|
|
|
return invoice_options_amount |
|
|
|
|
|
|
|
def _compute_booking_amount(self,rec): |
|
|
|
membership_product=self.env['product.product'].sudo().search([('membership_product','=',True)],limit=1) |
|
|
@ -227,7 +235,7 @@ class BookingEvent(models.Model): |
|
|
|
booking_amount=booking_amount+line.price_subtotal |
|
|
|
break |
|
|
|
|
|
|
|
return str(booking_amount) |
|
|
|
return booking_amount |
|
|
|
|
|
|
|
def _compute_member_status(self,reg): |
|
|
|
|
|
|
@ -262,7 +270,7 @@ class BookingEvent(models.Model): |
|
|
|
if line.name==membership_product.name: |
|
|
|
membership_amount=line.price_subtotal |
|
|
|
|
|
|
|
return str(membership_amount) |
|
|
|
return membership_amount |
|
|
|
|
|
|
|
|
|
|
|
def _compute_invoice_options(self,rec): |
|
|
|