|
@ -11,7 +11,7 @@ from werkzeug import utils |
|
|
import os.path |
|
|
import os.path |
|
|
from google.oauth2 import service_account |
|
|
from google.oauth2 import service_account |
|
|
from googleapiclient.discovery import build |
|
|
from googleapiclient.discovery import build |
|
|
from datetime import datetime, timedelta |
|
|
|
|
|
|
|
|
from datetime import date,datetime, timedelta |
|
|
import json |
|
|
import json |
|
|
import babel |
|
|
import babel |
|
|
import babel.dates |
|
|
import babel.dates |
|
@ -207,8 +207,16 @@ class KalachakraEvent(models.Model): |
|
|
|
|
|
|
|
|
def _compute_duration(self): |
|
|
def _compute_duration(self): |
|
|
for rec in 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) |
|
|
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)]) |
|
|
prd=self.env['product.product'].sudo().search([('id','=',id_prd)]) |
|
|
vals={} |
|
|
vals={} |
|
|
#calcul du prix en fonction du sejour,nuité, ou jour |
|
|
#calcul du prix en fonction du sejour,nuité, ou jour |
|
|
|
|
|
|
|
|
price=option.list_price |
|
|
price=option.list_price |
|
|
if prd.price_per=='day': |
|
|
if prd.price_per=='day': |
|
|
price=option.list_price*self.duration |
|
|
price=option.list_price*self.duration |
|
|