Browse Source

corrections duration

dev-rcn
root 3 years ago
parent
commit
1b2c092073
1 changed files with 12 additions and 3 deletions
  1. +12
    -3
      models/event.py

+ 12
- 3
models/event.py View File

@ -11,7 +11,7 @@ from werkzeug import utils
import os.path
from google.oauth2 import service_account
from googleapiclient.discovery import build
from datetime import datetime, timedelta
from datetime import date,datetime, timedelta
import json
import babel
import babel.dates
@ -207,8 +207,16 @@ class KalachakraEvent(models.Model):
def _compute_duration(self):
for rec in self:
duration = rec.date_end-rec.date_begin
rec.duration = duration.days
if rec.date_end and rec.date_begin:
b_date = date(rec.date_begin.year, rec.date_begin.month, rec.date_begin.day)
e_date = date(rec.date_end.year, rec.date_end.month, rec.date_end.day)
duration = e_date-b_date
rec.duration = duration.days+1
else:
rec.duration=0
booking_event = fields.Boolean(string="Booking event", tracking=True)
@ -241,6 +249,7 @@ class KalachakraEvent(models.Model):
prd=self.env['product.product'].sudo().search([('id','=',id_prd)])
vals={}
#calcul du prix en fonction du sejour,nuité, ou jour
price=option.list_price
if prd.price_per=='day':
price=option.list_price*self.duration


Loading…
Cancel
Save