Changes to support refactor in frappe pg-poc branch (#15287)

* Remove quotes from sql to make it compatible with postgres as well

* Fix queries
- Replace mysql specifc queries with standard ones

* Make repo URL chages to test pg-poc

* Add root passowrd to test site config

* Fix quotes issue

* Remove debug flag from a pricing rule query

* Remove python 3.6 version from travis.yml

* Fix improper query issue

* Fix incorrect query

* Fix a query

- This fix need to be changed when we will  start supporting postgres
since date_format is not supported by postgres

* Get price list map as dict

* Convert price_list_currency_map to dict
This commit is contained in:
Suraj Shetty
2018-09-21 10:20:52 +05:30
committed by Rushabh Mehta
parent f9b3511880
commit bfc195dd8b
53 changed files with 189 additions and 182 deletions

View File

@@ -59,15 +59,15 @@ class HotelRoomReservation(Document):
if not d.item:
continue
day_rate = frappe.db.sql("""
select
item.rate
from
select
item.rate
from
`tabHotel Room Pricing Item` item,
`tabHotel Room Pricing` pricing
where
item.parent = pricing.name
and item.item = %s
and %s between pricing.from_date
and %s between pricing.from_date
and pricing.to_date""", (d.item, day))
if day_rate:
@@ -90,7 +90,7 @@ def get_room_rate(hotel_room_reservation):
def get_rooms_booked(room_type, day, exclude_reservation=None):
exclude_condition = ''
if exclude_reservation:
exclude_condition = 'and reservation.name != "{0}"'.format(frappe.db.escape(exclude_reservation))
exclude_condition = 'and reservation.name != {0}'.format(frappe.db.escape(exclude_reservation))
return frappe.db.sql("""
select sum(item.qty)
@@ -105,5 +105,5 @@ def get_rooms_booked(room_type, day, exclude_reservation=None):
and reservation.docstatus = 1
{exclude_condition}
and %s between reservation.from_date
and reservation.to_date""".format(exclude_condition=exclude_condition),
and reservation.to_date""".format(exclude_condition=exclude_condition),
(room_type, day))[0][0] or 0