@ -0,0 +1,48 @@ | 
				
			|||||
 | 
					.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg | 
				
			||||
 | 
					   :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html | 
				
			||||
 | 
					   :alt: License: AGPL-3 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Website pre booking | 
				
			||||
 | 
					=================== | 
				
			||||
 | 
					This module will help you to managing prebooking management in website. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Configuration | 
				
			||||
 | 
					============= | 
				
			||||
 | 
					* No additional configurations needed | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Company | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					License | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					Affero General Public License v3.0 (AGPL v3) | 
				
			||||
 | 
					(https://www.odoo.com/documentation/16.0/legal/licenses.html) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Credits | 
				
			||||
 | 
					------- | 
				
			||||
 | 
					Developer: (V17) Vishnu KP | 
				
			||||
 | 
					           (V18) Gayathri V | 
				
			||||
 | 
					Contact : odoo@cybrosys.com | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Contacts | 
				
			||||
 | 
					-------- | 
				
			||||
 | 
					* Mail Contact : odoo@cybrosys.com | 
				
			||||
 | 
					* Website : https://cybrosys.com | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Bug Tracker | 
				
			||||
 | 
					----------- | 
				
			||||
 | 
					Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Maintainer | 
				
			||||
 | 
					========== | 
				
			||||
 | 
					.. image:: https://cybrosys.com/images/logo.png | 
				
			||||
 | 
					   :target: https://cybrosys.com | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					This module is maintained by Cybrosys Technologies. | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					For support and more information, please visit `Our Website <https://cybrosys.com/>`__ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Further information | 
				
			||||
 | 
					=================== | 
				
			||||
 | 
					HTML Description: `<static/description/index.html>`__ | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Gayathri V(<https://www.cybrosys.com>) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from . import controllers | 
				
			||||
 | 
					from . import models | 
				
			||||
@ -0,0 +1,55 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Gayathri V(<https://www.cybrosys.com>) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					{ | 
				
			||||
 | 
					    'name': 'Website Pre Booking', | 
				
			||||
 | 
					    'version': '18.0.1.0.0', | 
				
			||||
 | 
					    'category': 'Website', | 
				
			||||
 | 
					    'summary': 'Allows pre booking option for website', | 
				
			||||
 | 
					    'description': """This module will help you to managing prebooking of | 
				
			||||
 | 
					     product management in website""", | 
				
			||||
 | 
					    'author': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'company': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'maintainer': 'Cybrosys Techno Solutions', | 
				
			||||
 | 
					    'website': "https://www.cybrosys.com", | 
				
			||||
 | 
					    'depends': ['portal', 'website_sale'], | 
				
			||||
 | 
					    'data': [ | 
				
			||||
 | 
					        'security/ir.model.access.csv', | 
				
			||||
 | 
					        'data/ir_sequence_data.xml', | 
				
			||||
 | 
					        'views/portal_views.xml', | 
				
			||||
 | 
					        'views/website_prebook_views.xml', | 
				
			||||
 | 
					        'views/website_sale_inherit.xml', | 
				
			||||
 | 
					        'views/prebook_details_template.xml', | 
				
			||||
 | 
					        'views/pre_booking_template.xml', | 
				
			||||
 | 
					        'views/product_template_views.xml', | 
				
			||||
 | 
					    ], | 
				
			||||
 | 
					    'assets': { | 
				
			||||
 | 
					        'web.assets_frontend': [ | 
				
			||||
 | 
					            '/website_pre_booking/static/src/css/prebooking.css', | 
				
			||||
 | 
					            '/website_pre_booking/static/src/js/pre_booking.js' | 
				
			||||
 | 
					        ], | 
				
			||||
 | 
					    }, | 
				
			||||
 | 
					    'images': ['static/description/banner.png'], | 
				
			||||
 | 
					    'license': 'AGPL-3', | 
				
			||||
 | 
					    'installable': True, | 
				
			||||
 | 
					    'auto_install': False, | 
				
			||||
 | 
					    'application': False, | 
				
			||||
 | 
					} | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Gayathri V(<https://www.cybrosys.com>) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from . import pre_booking_portal | 
				
			||||
 | 
					from . import website_pre_booking | 
				
			||||
@ -0,0 +1,47 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Gayathri V(<https://www.cybrosys.com>) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import http, _ | 
				
			||||
 | 
					from odoo.http import request | 
				
			||||
 | 
					from odoo.addons.portal.controllers import portal | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class CustomerPortal(portal.CustomerPortal): | 
				
			||||
 | 
					    """Used to manage a customer portal""" | 
				
			||||
 | 
					    def _prepare_home_portal_values(self, counters): | 
				
			||||
 | 
					        """Super the function to add new button in the home portal""" | 
				
			||||
 | 
					        values = super()._prepare_home_portal_values(counters) | 
				
			||||
 | 
					        if 'pre_bookings_count' in counters: | 
				
			||||
 | 
					            current_user = request.env['res.users'].sudo().browse( | 
				
			||||
 | 
					                request.env.uid) | 
				
			||||
 | 
					            pre_bookings_count = request.env['website.prebook'].search_count([('partner_id', '=', current_user.partner_id.id)]) | 
				
			||||
 | 
					            values['pre_bookings_count'] = pre_bookings_count | 
				
			||||
 | 
					        return values | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @http.route(['/my/pre_bookings'], type='http', auth="user", website=True) | 
				
			||||
 | 
					    def portal_my_pre_bookings(self, **kwargs): | 
				
			||||
 | 
					        """Function to view the logined user pre bookings in the account.""" | 
				
			||||
 | 
					        current_user = request.env['res.users'].sudo().browse(request.env.uid) | 
				
			||||
 | 
					        pre_booking = request.env['website.prebook'].sudo().search( | 
				
			||||
 | 
					            [('partner_id', '=', current_user.partner_id.id)]) | 
				
			||||
 | 
					        return request.render("website_pre_booking.portal_my_pre_bookings", | 
				
			||||
 | 
					                              {'pre_bookings': pre_booking, | 
				
			||||
 | 
					                               'page_name': 'pre_booking'}) | 
				
			||||
@ -0,0 +1,124 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Gayathri V(<https://www.cybrosys.com>) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import fields, http, _ | 
				
			||||
 | 
					from odoo.http import request | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class CustomerPortal(http.Controller): | 
				
			||||
 | 
					    """Used to manage a customer portal""" | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @http.route(['/my/prebook_request/<model("product.template"):product>'], | 
				
			||||
 | 
					                type='http', auth="public", website=True) | 
				
			||||
 | 
					    def portal_my_employee_request(self, product, **kwargs): | 
				
			||||
 | 
					        """Pre-book button to pre-book the product""" | 
				
			||||
 | 
					        if kwargs.get('prod_qty'): | 
				
			||||
 | 
					            vals = { | 
				
			||||
 | 
					                'product': product.id, | 
				
			||||
 | 
					                'quantity': int(kwargs.get('prod_qty')) | 
				
			||||
 | 
					            } | 
				
			||||
 | 
					        current_user = request.env['res.users'].sudo().browse( | 
				
			||||
 | 
					            request.session.uid) | 
				
			||||
 | 
					        partner = current_user.partner_id | 
				
			||||
 | 
					        if kwargs.get('category'): | 
				
			||||
 | 
					            product_qty = int(kwargs['category'].split('=')[1]) | 
				
			||||
 | 
					        else: | 
				
			||||
 | 
					            product_qty = int(kwargs.get('prod_qty')) | 
				
			||||
 | 
					        if request.session.uid: | 
				
			||||
 | 
					            pre_booking = request.env['website.prebook'].sudo().create({ | 
				
			||||
 | 
					                'partner_id': partner.id, | 
				
			||||
 | 
					                'booking_date': fields.datetime.today(), | 
				
			||||
 | 
					                'product_id': product.id, | 
				
			||||
 | 
					                'quantity': product_qty, | 
				
			||||
 | 
					                'website_id': request.website.id, | 
				
			||||
 | 
					            }) | 
				
			||||
 | 
					            if pre_booking: | 
				
			||||
 | 
					                max_quantity = product.pre_max_quantity | 
				
			||||
 | 
					                product.sudo().write({'pre_max_quantity': int(max_quantity - product_qty)}) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					            return request.render("website_pre_booking.pre_booking_done", | 
				
			||||
 | 
					                                  {'ref': pre_booking.reference}) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					        else: | 
				
			||||
 | 
					            return request.render("website_pre_booking.prebook_address", vals) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @http.route(['/prebook/address'], type='http', methods=['GET', 'POST'], | 
				
			||||
 | 
					                auth="public", website=True, sitemap=False) | 
				
			||||
 | 
					    def pre_address(self, **kw): | 
				
			||||
 | 
					        """If not login, create a new user""" | 
				
			||||
 | 
					        product = request.env['product.template'].sudo().browse( | 
				
			||||
 | 
					            int(kw.get('product'))) | 
				
			||||
 | 
					        partner = request.env['res.partner'].sudo().create({ | 
				
			||||
 | 
					            'name': kw.get('name'), | 
				
			||||
 | 
					            'email': kw.get('email'), | 
				
			||||
 | 
					            'phone': kw.get('phone'), | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					        pre_booking = request.env['website.prebook'].sudo().create({ | 
				
			||||
 | 
					            'partner_id': partner.id, | 
				
			||||
 | 
					            'booking_date': fields.datetime.today(), | 
				
			||||
 | 
					            'product_id': product.id, | 
				
			||||
 | 
					            'quantity': int(kw.get('quantity')) | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					        if pre_booking: | 
				
			||||
 | 
					            max_quantity = product.pre_max_quantity | 
				
			||||
 | 
					            product.pre_max_quantity = max_quantity - 1 | 
				
			||||
 | 
					        return request.render("website_pre_booking.pre_booking_done", | 
				
			||||
 | 
					                              {'ref': pre_booking.reference}) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @http.route('/track/prebooking', website=True, auth='user', csrf=False) | 
				
			||||
 | 
					    def submit_booking(self, **kwargs): | 
				
			||||
 | 
					        """For tracking the specific pre-orders using refernce code""" | 
				
			||||
 | 
					        bookings = request.env['website.prebook'].sudo().search( | 
				
			||||
 | 
					            [('reference', '=', kwargs.get('reference'))]) | 
				
			||||
 | 
					        if bookings and bookings.sale_id: | 
				
			||||
 | 
					            if bookings.sale_id.state == 'draft': | 
				
			||||
 | 
					                state = 'Quotation' | 
				
			||||
 | 
					            elif bookings.sale_id.state == 'sent': | 
				
			||||
 | 
					                state = 'Quotation Sent' | 
				
			||||
 | 
					            elif bookings.sale_id.state == 'sale': | 
				
			||||
 | 
					                state = 'Sales Order' | 
				
			||||
 | 
					            elif bookings.sale_id.state == 'done': | 
				
			||||
 | 
					                state = 'Locked' | 
				
			||||
 | 
					            elif bookings.sale_id.state == 'cancel': | 
				
			||||
 | 
					                state = 'Cancelled' | 
				
			||||
 | 
					            else: | 
				
			||||
 | 
					                state = 'Draft' | 
				
			||||
 | 
					        vals = { | 
				
			||||
 | 
					            'reference': bookings.reference, | 
				
			||||
 | 
					            'product': bookings.product_id.name, | 
				
			||||
 | 
					            'status': state if bookings.sale_id else bookings.state, | 
				
			||||
 | 
					            'date': bookings.booking_date, | 
				
			||||
 | 
					        } | 
				
			||||
 | 
					        return request.render("website_pre_booking.my_booking_template", | 
				
			||||
 | 
					                              vals) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @http.route(['/my/prebookings', '/my/prebookings/page/<int:page>'], | 
				
			||||
 | 
					                type='http', auth="user", website=True) | 
				
			||||
 | 
					    def my_prebookings(self): | 
				
			||||
 | 
					        """Can track the pre bookings from the website""" | 
				
			||||
 | 
					        value = [] | 
				
			||||
 | 
					        values = {'value': value} | 
				
			||||
 | 
					        return request.render("website_pre_booking.my_booking_template", values) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @http.route(['/sale/fail'], type='http', auth="user", website=True) | 
				
			||||
 | 
					    def my_prebookings_fail(self): | 
				
			||||
 | 
					        """Can track the pre bookings from the website""" | 
				
			||||
 | 
					        return request.render("website_pre_booking.pre_booking_failed") | 
				
			||||
@ -0,0 +1,13 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="utf-8"?> | 
				
			||||
 | 
					<odoo> | 
				
			||||
 | 
					    <data> | 
				
			||||
 | 
					        <!-- Sequences for prebooking --> | 
				
			||||
 | 
					        <record id="seq_booking" model="ir.sequence"> | 
				
			||||
 | 
					            <field name="name">Pre Booking</field> | 
				
			||||
 | 
					            <field name="code">prebook.sequence</field> | 
				
			||||
 | 
					            <field name="prefix">PB</field> | 
				
			||||
 | 
					            <field name="padding">4</field> | 
				
			||||
 | 
					            <field name="company_id" eval="False"/> | 
				
			||||
 | 
					        </record> | 
				
			||||
 | 
					    </data> | 
				
			||||
 | 
					</odoo> | 
				
			||||
@ -0,0 +1,6 @@ | 
				
			|||||
 | 
					## Module <website_pre_booking> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					#### 30.10.2024 | 
				
			||||
 | 
					#### Version 18.0.1.0.0 | 
				
			||||
 | 
					##### ADD | 
				
			||||
 | 
					- Initial commit for Website Pre Booking | 
				
			||||
@ -0,0 +1,23 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Gayathri V(<https://www.cybrosys.com>) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from . import product_template | 
				
			||||
 | 
					from . import website_prebook | 
				
			||||
@ -0,0 +1,35 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Gayathri V(<https://www.cybrosys.com>) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import fields, models | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class ProductTemplate(models.Model): | 
				
			||||
 | 
					    """ Class for inheriting product.template model to adding new fields""" | 
				
			||||
 | 
					    _inherit = 'product.template' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    pre_book = fields.Boolean(string='Pre Booking Available', | 
				
			||||
 | 
					                              help='Enabling this field to identify the prebook') | 
				
			||||
 | 
					    from_date = fields.Date(string='From Date', | 
				
			||||
 | 
					                            help='Prebook available from date') | 
				
			||||
 | 
					    to_date = fields.Date(string='To Date',help='Prebook available to date') | 
				
			||||
 | 
					    pre_max_quantity = fields.Integer(string="Pre Book Maximum Quantity", | 
				
			||||
 | 
					                                      help='Maximum quantity to pre book') | 
				
			||||
@ -0,0 +1,86 @@ | 
				
			|||||
 | 
					# -*- coding: utf-8 -*- | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Cybrosys Technologies Pvt. Ltd. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | 
				
			||||
 | 
					#    Author: Gayathri V(<https://www.cybrosys.com>) | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You can modify it under the terms of the GNU AFFERO | 
				
			||||
 | 
					#    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					#    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | 
				
			||||
 | 
					#    (AGPL v3) along with this program. | 
				
			||||
 | 
					#    If not, see <http://www.gnu.org/licenses/>. | 
				
			||||
 | 
					# | 
				
			||||
 | 
					############################################################################# | 
				
			||||
 | 
					from odoo import api, fields, models, _ | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class WebsitePrebook(models.Model): | 
				
			||||
 | 
					    """ Class for defining website. Prebook model""" | 
				
			||||
 | 
					    _name = 'website.prebook' | 
				
			||||
 | 
					    _rec_name = 'reference' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    partner_id = fields.Many2one('res.partner', string="Customer", | 
				
			||||
 | 
					                                 help="Add the customer name") | 
				
			||||
 | 
					    booking_date = fields.Date('Booking Date', help="Pre booking date") | 
				
			||||
 | 
					    product_id = fields.Many2one('product.template', string="Product", | 
				
			||||
 | 
					                                 help="Add the product") | 
				
			||||
 | 
					    state = fields.Selection([ | 
				
			||||
 | 
					        ('draft', 'Draft'), | 
				
			||||
 | 
					        ('confirm', 'Confirmed'), | 
				
			||||
 | 
					    ], string='Status', default='draft', help="state of pre-booking" | 
				
			||||
 | 
					    ) | 
				
			||||
 | 
					    website_id = fields.Many2one( | 
				
			||||
 | 
					        "website", | 
				
			||||
 | 
					        string="Website", | 
				
			||||
 | 
					        ondelete="restrict", | 
				
			||||
 | 
					        index=True, | 
				
			||||
 | 
					        readonly=True, help="name of the website" | 
				
			||||
 | 
					    ) | 
				
			||||
 | 
					    reference = fields.Char(string='Reference', required=True, copy=False, | 
				
			||||
 | 
					                            readonly=True, | 
				
			||||
 | 
					                            default=lambda self: _('New')) | 
				
			||||
 | 
					    sale_id = fields.Many2one('sale.order', string='Sale order', | 
				
			||||
 | 
					                              help="sale order") | 
				
			||||
 | 
					    quantity = fields.Integer(string='Quantity') | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    @api.model | 
				
			||||
 | 
					    def create(self, vals): | 
				
			||||
 | 
					        """Supering create function for creating sequence""" | 
				
			||||
 | 
					        if vals.get('reference', _('New')) == _('New'): | 
				
			||||
 | 
					            vals['reference'] = self.env['ir.sequence'].next_by_code('prebook.sequence') or _('New') | 
				
			||||
 | 
					        return super(WebsitePrebook, self).create(vals) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_confirm(self): | 
				
			||||
 | 
					        """Sale order creation while confirming the button""" | 
				
			||||
 | 
					        sale_order = self.env['sale.order'].create({ | 
				
			||||
 | 
					            'partner_id': self.partner_id.id, | 
				
			||||
 | 
					            'website_id': self.website_id.id, | 
				
			||||
 | 
					            'order_line': [(0, 0, { | 
				
			||||
 | 
					                'product_template_id': self.product_id.id, | 
				
			||||
 | 
					                'product_id': self.product_id.product_variant_id.id, | 
				
			||||
 | 
					                'name': self.product_id.product_variant_id.name, | 
				
			||||
 | 
					                'product_uom_qty': self.quantity, | 
				
			||||
 | 
					            })], | 
				
			||||
 | 
					        }) | 
				
			||||
 | 
					        self.sale_id = sale_order.id | 
				
			||||
 | 
					        self.state = 'confirm' | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					    def action_view_sale_order(self): | 
				
			||||
 | 
					        """Smart button view function""" | 
				
			||||
 | 
					        return { | 
				
			||||
 | 
					            'name': 'Sale Order', | 
				
			||||
 | 
					            'view_mode': 'form', | 
				
			||||
 | 
					            'view_type': 'form', | 
				
			||||
 | 
					            'view_id': self.env.ref('sale.view_order_form').id, | 
				
			||||
 | 
					            'res_id': self.sale_id.id, | 
				
			||||
 | 
					            'res_model': 'sale.order', | 
				
			||||
 | 
					            'type': 'ir.actions.act_window', | 
				
			||||
 | 
					        } | 
				
			||||
		
		
			
  | 
| 
		 After Width: | Height: | Size: 2.2 KiB  | 
| 
		 After Width: | Height: | Size: 28 KiB  | 
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
		 After Width: | Height: | Size: 210 KiB  | 
| 
		 After Width: | Height: | Size: 209 KiB  | 
| 
		 After Width: | Height: | Size: 109 KiB  | 
| 
		 After Width: | Height: | Size: 495 B  | 
| 
		 After Width: | Height: | Size: 1.0 KiB  | 
| 
		 After Width: | Height: | Size: 624 B  | 
| 
		 After Width: | Height: | Size: 136 KiB  | 
| 
		 After Width: | Height: | Size: 214 KiB  | 
| 
		 After Width: | Height: | Size: 36 KiB  | 
| 
		 After Width: | Height: | Size: 36 KiB  | 
| 
		 After Width: | Height: | Size: 3.6 KiB  | 
| 
		 After Width: | Height: | Size: 310 B  | 
| 
		 After Width: | Height: | Size: 929 B  | 
| 
		 After Width: | Height: | Size: 1.3 KiB  | 
| 
		 After Width: | Height: | Size: 3.3 KiB  | 
| 
		 After Width: | Height: | Size: 1.4 KiB  | 
| 
		 After Width: | Height: | Size: 17 KiB  | 
| 
		 After Width: | Height: | Size: 542 B  | 
| 
		 After Width: | Height: | Size: 576 B  | 
| 
		 After Width: | Height: | Size: 733 B  | 
| 
		 After Width: | Height: | Size: 4.3 KiB  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 4.0 KiB  | 
| 
		 After Width: | Height: | Size: 1.7 KiB  | 
| 
		 After Width: | Height: | Size: 182 KiB  | 
| 
		 After Width: | Height: | Size: 2.2 KiB  | 
| 
		 After Width: | Height: | Size: 911 B  | 
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 600 B  | 
| 
		 After Width: | Height: | Size: 673 B  | 
| 
		 After Width: | Height: | Size: 2.0 KiB  | 
| 
		 After Width: | Height: | Size: 462 B  | 
| 
		 After Width: | Height: | Size: 2.1 KiB  | 
| 
		 After Width: | Height: | Size: 926 B  | 
| 
		 After Width: | Height: | Size: 9.0 KiB  | 
| 
		 After Width: | Height: | Size: 23 KiB  | 
| 
		 After Width: | Height: | Size: 7.0 KiB  | 
| 
		 After Width: | Height: | Size: 11 KiB  | 
| 
		 After Width: | Height: | Size: 878 B  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 653 B  | 
| 
		 After Width: | Height: | Size: 800 B  | 
| 
		 After Width: | Height: | Size: 905 B  | 
| 
		 After Width: | Height: | Size: 189 KiB  | 
| 
		 After Width: | Height: | Size: 4.3 KiB  | 
| 
		 After Width: | Height: | Size: 839 B  | 
| 
		 After Width: | Height: | Size: 1.7 KiB  | 
| 
		 After Width: | Height: | Size: 5.9 KiB  | 
| 
		 After Width: | Height: | Size: 1.6 KiB  | 
| 
		 After Width: | Height: | Size: 34 KiB  | 
| 
		 After Width: | Height: | Size: 26 KiB  | 
| 
		 After Width: | Height: | Size: 3.8 KiB  | 
| 
		 After Width: | Height: | Size: 23 KiB  | 
| 
		 After Width: | Height: | Size: 1.9 KiB  | 
| 
		 After Width: | Height: | Size: 2.3 KiB  | 
| 
		 After Width: | Height: | Size: 427 B  | 
| 
		 After Width: | Height: | Size: 627 B  | 
| 
		 After Width: | Height: | Size: 1.1 KiB  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 988 B  | 
| 
		 After Width: | Height: | Size: 3.7 KiB  | 
| 
		 After Width: | Height: | Size: 5.0 KiB  | 
| 
		 After Width: | Height: | Size: 875 B  | 
| 
		 After Width: | Height: | Size: 1.2 KiB  | 
| 
		 After Width: | Height: | Size: 80 KiB  | 
| 
		 After Width: | Height: | Size: 3.2 KiB  | 
| 
		 After Width: | Height: | Size: 565 B  | 
| 
		 After Width: | Height: | Size: 26 KiB  | 
| 
		 After Width: | Height: | Size: 43 KiB  | 
| 
		 After Width: | Height: | Size: 1.4 KiB  | 
| 
		 After Width: | Height: | Size: 4.0 KiB  | 
| 
		 After Width: | Height: | Size: 38 KiB  | 
| 
		 After Width: | Height: | Size: 4.3 KiB  | 
| 
		 After Width: | Height: | Size: 912 KiB  | 
| 
		 After Width: | Height: | Size: 87 KiB  | 
| 
		 After Width: | Height: | Size: 1.3 MiB  | 
| 
		 After Width: | Height: | Size: 80 KiB  | 
| 
		 After Width: | Height: | Size: 95 KiB  | 
| 
		 After Width: | Height: | Size: 46 KiB  | 
| 
		 After Width: | Height: | Size: 78 KiB  | 
| 
		 After Width: | Height: | Size: 44 KiB  | 
| 
		 After Width: | Height: | Size: 164 KiB  |