root 3 years ago
parent
commit
03194b3099
3 changed files with 61 additions and 20 deletions
  1. +58
    -19
      models/booking_event_registration.py
  2. +2
    -0
      views/booking_event_registration.xml
  3. +1
    -1
      views/event_templates_page_registration.xml

+ 58
- 19
models/booking_event_registration.py View File

@ -96,10 +96,18 @@ class EventRegistration(models.Model):
end_of_stay_invoice_id=fields.Many2one('account.move' ,string='end of stay invoice',ondelete="cascade") end_of_stay_invoice_id=fields.Many2one('account.move' ,string='end of stay invoice',ondelete="cascade")
payment_status=fields.Char(string='payment status',compute='_compute_payment_status')
payment_status=fields.Selection(string='payment status',selection=[('paid','Paid'),('not paid','Not paid'),('down payment not paid','down payment not paid'),('down payment paid','down payment paid')],compute='_compute_payment_status',translate=True)
to_be_paid_amount=fields.Monetary('to be paid amount',compute='_compute_to_be_paid_amount',currency_field='currency_id')
payment_adjustement=fields.Monetary('payment adjustement',currency_field='currency_id') payment_adjustement=fields.Monetary('payment adjustement',currency_field='currency_id')
def _compute_to_be_paid_amount(self):
for rec in self:
rec.to_be_paid_amount=0
if rec.invoice_id : rec.to_be_paid_amount=rec.invoice_id.amount_residual
else:
if rec.down_payment_invoice_id and balance_invoice_id:
rec.to_be_paid_amount=rec.down_payment_invoice_id.amount_residual+rec.balance_invoice_id.amount_residual
def _compute_payment_status(self): def _compute_payment_status(self):
for rec in self: for rec in self:
rec.payment_status='not paid' rec.payment_status='not paid'
@ -127,8 +135,8 @@ class EventRegistration(models.Model):
def _compute_kanban_color(self): def _compute_kanban_color(self):
for rec in self: for rec in self:
rec.kanban_color='' rec.kanban_color=''
if rec.gender=='male':rec.kanban_color="d0e0e3"
if rec.gender=='femelle':rec.kanban_color="eebbcc"
if rec.gender=='male':rec.kanban_color="50aaf3"
if rec.gender=='femelle':rec.kanban_color="ffffff"
@api.model @api.model
def _read_group_room_ids(self, stages, domain, order): def _read_group_room_ids(self, stages, domain, order):
return self.env['booking.room'].search([]) return self.env['booking.room'].search([])
@ -281,15 +289,23 @@ class EventRegistration(models.Model):
vals['partner_id']=int(reg.partner_id) vals['partner_id']=int(reg.partner_id)
vals['invoice_date']=datetime.now() vals['invoice_date']=datetime.now()
#mode de paiement CB par defaut
electronic_method=self.env['account.payment.method'].sudo().search([('code','=','electronic')],limit=1)
if electronic_method:
cb_mode=self.env['account.payment.mode'].sudo().search([('payment_method_id','=',int(electronic_method.id))],limit=1)
if cb_mode:
vals['payment_mode_id']=cb_mode.id
else:
raise Warning('please configure credit card mode')
#mode de paiement CB par defaut si frontoffice
if not backoffice:
electronic_method=self.env['account.payment.method'].sudo().search([('code','=','electronic')],limit=1)
if electronic_method:
cb_mode=self.env['account.payment.mode'].sudo().search([('payment_method_id','=',int(electronic_method.id))],limit=1)
if cb_mode:
vals['payment_mode_id']=cb_mode.id
else:
raise Warning('please configure credit card mode')
else:
check_mode=self.env['account.payment.mode'].sudo().search([('name','=','chèque')])
if check_mode:
vals['payment_mode_id']=check_mode.id
else:
raise Warning('please configure check mode')
vals['move_type']='out_invoice' vals['move_type']='out_invoice'
vals['state']='draft' vals['state']='draft'
#vals['currency_id']=self.currency_id.id #vals['currency_id']=self.currency_id.id
@ -411,13 +427,20 @@ class EventRegistration(models.Model):
vals['invoice_date']=datetime.now() vals['invoice_date']=datetime.now()
#mode de paiement CB par defaut #mode de paiement CB par defaut
electronic_method=self.env['account.payment.method'].sudo().search([('code','=','electronic')],limit=1)
if electronic_method:
cb_mode=self.env['account.payment.mode'].sudo().search([('payment_method_id','=',int(electronic_method.id))],limit=1)
if cb_mode:
vals['payment_mode_id']=cb_mode.id
else:
raise Warning('please configure credit card mode')
if not backoffice:
electronic_method=self.env['account.payment.method'].sudo().search([('code','=','electronic')],limit=1)
if electronic_method:
cb_mode=self.env['account.payment.mode'].sudo().search([('payment_method_id','=',int(electronic_method.id))],limit=1)
if cb_mode:
vals['payment_mode_id']=cb_mode.id
else:
raise Warning('please configure credit card mode')
else:
check_mode=self.env['account.payment.mode'].sudo().search([('name','=','chèque')])
if check_mode:
vals['payment_mode_id']=check_mode.id
else:
raise Warning('please configure check mode')
vals['move_type']='out_invoice' vals['move_type']='out_invoice'
vals['state']='draft' vals['state']='draft'
@ -490,6 +513,22 @@ class EventRegistration(models.Model):
vals['account_id']=int(account_credit.id) vals['account_id']=int(account_credit.id)
#mode de paiement CB par defaut
if not backoffice:
electronic_method=self.env['account.payment.method'].sudo().search([('code','=','electronic')],limit=1)
if electronic_method:
cb_mode=self.env['account.payment.mode'].sudo().search([('payment_method_id','=',int(electronic_method.id))],limit=1)
if cb_mode:
vals['payment_mode_id']=cb_mode.id
else:
raise Warning('please configure credit card mode')
else:
check_mode=self.env['account.payment.mode'].sudo().search([('name','=','chèque')])
if check_mode:
vals['payment_mode_id']=check_mode.id
else:
raise Warning('please configure check mode')
invoice_line=self.env['account.move.line'].with_context(check_move_validity=False).sudo().create(vals) invoice_line=self.env['account.move.line'].with_context(check_move_validity=False).sudo().create(vals)


+ 2
- 0
views/booking_event_registration.xml View File

@ -235,6 +235,8 @@
<field name="train_arrival_date" widget="date" /> <field name="train_arrival_date" widget="date" />
<field name="train_arrival_time" widget="float_time" /> <field name="train_arrival_time" widget="float_time" />
<field name="payment_status"/> <field name="payment_status"/>
<field name="to_be_paid_amount"/>
</xpath> </xpath>


+ 1
- 1
views/event_templates_page_registration.xml View File

@ -105,7 +105,7 @@
</div> </div>
</xpath> </xpath>
<xpath expr="//div[2][@class='o_wevent_sidebar_block']" position="replace"> <xpath expr="//div[2][@class='o_wevent_sidebar_block']" position="replace">
<div t-if="event.address_id" class="o_wevent_sidebar_block_kala">
<div t-if="event.address_id and not event.online_only" class="o_wevent_sidebar_block_kala">
<span class="o_wevent_sidebar_title kala_evt1">Location</span> <span class="o_wevent_sidebar_title kala_evt1">Location</span>
<span t-field="event.address_id" class="kala_evt1" t-options='{ <span t-field="event.address_id" class="kala_evt1" t-options='{
"widget": "contact", "widget": "contact",


Loading…
Cancel
Save