14 changed files with 234 additions and 224 deletions
@ -1 +1,24 @@ |
|||
import models |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Avinash Nk(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import models |
|||
import controllers |
|||
|
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Avinash Nk(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import main |
@ -0,0 +1,89 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2015-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Avinash Nk(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import json |
|||
from datetime import datetime, date |
|||
from openerp.addons.web import http |
|||
from openerp import SUPERUSER_ID |
|||
from openerp.addons.web.http import request |
|||
|
|||
|
|||
class SalonBookingWeb(http.Controller): |
|||
|
|||
@http.route('/page/salon_details', csrf=False, type="http", methods=['POST', 'GET'], auth="public", website=True) |
|||
def salon_details(self, **kwargs): |
|||
|
|||
name = kwargs['name'] |
|||
date = kwargs['date'] |
|||
time = kwargs['time'] |
|||
phone = kwargs['phone'] |
|||
email = kwargs['email'] |
|||
chair = kwargs['chair'] |
|||
j = 0 |
|||
service_list = [] |
|||
while(j < (int(kwargs['number']))): |
|||
item = "list_service["+str(j)+"][i]" |
|||
service_list.append(int(kwargs[item])) |
|||
j += 1 |
|||
salon_service_obj = request.env['salon.service'].search([('id', 'in', service_list)]) |
|||
dates_time = date+" "+time+":00" |
|||
date_and_time = datetime.strptime(dates_time, '%m/%d/%Y %H:%M:%S') |
|||
salon_booking = request.registry['salon.booking'] |
|||
booking_data = { |
|||
'name': name, |
|||
'phone': phone, |
|||
'time': date_and_time, |
|||
'email': email, |
|||
'chair_id': chair, |
|||
'services': [(6, 0, [x.id for x in salon_service_obj])], |
|||
} |
|||
salon_booking.create(request.cr, SUPERUSER_ID, booking_data, context=request.context) |
|||
return json.dumps({'result': True}) |
|||
|
|||
@http.route('/page/salon_check_date', type='json', auth="public", website=True) |
|||
def salon_check(self, **kwargs): |
|||
date_info = kwargs.get('check_date') |
|||
return date_info |
|||
|
|||
@http.route('/page/salon_management.salon_booking_thank_you', type='http', auth="public", website=True) |
|||
def thank_you(self, **post): |
|||
return request.website.render('salon_management.salon_booking_thank_you', {}) |
|||
|
|||
@http.route('/page/salon_management.salon_booking_form', type='http', auth="public", website=True) |
|||
def chair_info(self, **post): |
|||
|
|||
salon_service_obj = request.env['salon.service'].search([]) |
|||
salon_working_hours_obj = request.env['salon.working.hours'].search([]) |
|||
salon_holiday_obj = request.env['salon.holiday'].search([('holiday', '=', True)]) |
|||
date_check = date.today() |
|||
if 'x' in post.keys(): |
|||
date_check = post['x'] |
|||
chair_obj = request.env['salon.chair'].search([('active_booking_chairs', '=', True)]) |
|||
order_obj = request.env['salon.order'].search([('chair_id.active_booking_chairs', '=', True), |
|||
('stage_id', 'in', [1, 2, 3])]) |
|||
date_check = str(date_check) |
|||
order_obj = order_obj.search([('start_date_only', '=', date_check)]) |
|||
return request.website.render('salon_management.salon_booking_form', |
|||
{'chair_details': chair_obj, 'order_details': order_obj, |
|||
'salon_services': salon_service_obj, 'date_search': date_check, |
|||
'holiday': salon_holiday_obj, |
|||
'working_time': salon_working_hours_obj}) |
|
@ -1,35 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<openerp> |
|||
<data noupdate="0"> |
|||
<record model="ir.module.category" id="module_category_salon_management"> |
|||
<field name="name">Salon Management</field> |
|||
<field name="description">Manager and User Level Access For Beauty Spa Management</field> |
|||
<field name="sequence">12</field> |
|||
</record> |
|||
<record id="group_salon_user" model="res.groups"> |
|||
<field name="name">User</field> |
|||
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/> |
|||
<field name="category_id" ref="module_category_salon_management"/> |
|||
</record> |
|||
<record id="group_salon_manager" model="res.groups"> |
|||
<field name="name">Manager</field> |
|||
<field name="implied_ids" eval="[(4, ref('group_salon_user'))]"/> |
|||
<field name="category_id" ref="module_category_salon_management"/> |
|||
</record> |
|||
</data> |
|||
|
|||
<data noupdate="1"> |
|||
<record id="salon_order_comp_rule" model="ir.rule"> |
|||
<field name="name">Salon Orders</field> |
|||
<field name="model_id" ref="model_salon_order"/> |
|||
<field name="global" eval="True"/> |
|||
<field name="domain_force">[('salon_order_created_user','=',user.id)]</field> |
|||
</record> |
|||
<record id="salon_chair_comp_rule" model="ir.rule"> |
|||
<field name="name">Salon chairs</field> |
|||
<field name="model_id" ref="model_salon_chair"/> |
|||
<field name="global" eval="True"/> |
|||
<field name="domain_force">[('chair_created_user','=',user.id)]</field> |
|||
</record> |
|||
</data> |
|||
</openerp> |
Loading…
Reference in new issue