Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
3272 Переглядів

In a new reservation model I have defined two dates: start_date and end_date.

When creating a new reservation, I want a field "available" thats says if dates are ok as compared to other reservations already registered and if there is no conflicting reservations I want to update the field called "available" as ok, or not_ok.

With odoo studio, I have been trying to put code in advanced properties with some @api.onchange code found on blogs but with no luck I get run time errors with bad opcode or lambda errors. It is unclear if I should go to pycharm for this.

Is there a way to solve this with odoo studio? thanks!

Аватар
Відмінити
Найкраща відповідь

Try


from datetime import date, timedelta
import pandas as pd

sdate = date(2021, 1, 1) # start date
edate = date(2021, 2, 9) # end date
sdate2 = date(2021, 2, 5)
edate2 = date(2021, 2, 28)


list_a = pd.date_range(sdate, edate - timedelta(days=1), freq='d')
list_b = pd.date_range(sdate2, edate2 - timedelta(days=1), freq='d')
for x in list_a:
if x in list_b:
print(x)
Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
2
черв. 24
1526
1
груд. 21
5113
1
лип. 21
3689
1
бер. 15
8052
2
черв. 24
4399