[ADD] pms_website_sale (#93)

This commit is contained in:
Ammar Officewala
2022-04-19 18:50:32 +05:30
committed by GitHub
parent ee8fae7667
commit 729d789a97
23 changed files with 1549 additions and 0 deletions

112
pms_website_sale/README.rst Normal file
View File

@@ -0,0 +1,112 @@
==================
PMS - Website Sale
==================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
:target: https://odoo-community.org/page/development-status
:alt: Alpha
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fpms-lightgray.png?logo=github
:target: https://github.com/OCA/pms/tree/14.0-pms_base/pms_website_sale
:alt: OCA/pms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pms-14-0-pms_base/pms-14-0-pms_base-pms_website_sale
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/293/14.0-pms_base
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
This module is the base module for the property management system (PMS) modules.
It provides the "Properties" apps with menu, settings, groups and data.
.. IMPORTANT::
This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
`More details on development status <https://odoo-community.org/page/development-status>`_
**Table of contents**
.. contents::
:local:
Configuration
=============
* Go to Properties > Configuration > Settings.
Usage
=====
To use this module, please read the complete user guide at `<roomdoo.com>`_.
Bug Tracker
===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/pms/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/pms/issues/new?body=module:%20pms_website_sale%0Aversion:%2014.0-pms_base%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Open Source Integrators
Contributors
~~~~~~~~~~~~
* Alexandre Díaz
* Pablo Quesada
* Jose Luis Algara
* `Commit [Sun] <https://www.commitsun.com>`:
* Dario Lodeiros
* Eric Antones
* Sara Lago
* Brais Abeijon
* Miguel Padin
* `Open Source Integrators <https://www.opensourceintegrators.com>`:
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Ammar Officewala <aofficewala@opensourceintegrators.com>
Maintainers
~~~~~~~~~~~
This module is maintained by the OCA.
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
.. |maintainer-max3903| image:: https://github.com/max3903.png?size=40px
:target: https://github.com/max3903
:alt: max3903
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-max3903|
This module is part of the `OCA/pms <https://github.com/OCA/pms/tree/14.0-pms_base/pms_website_sale>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@@ -0,0 +1,3 @@
# Copyright (c) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import controllers

View File

@@ -0,0 +1,21 @@
# Copyright (c) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "PMS - Website Sale",
"summary": "Allow online booking of your properties",
"version": "14.0.1.0.0",
"development_status": "Alpha",
"category": "Generic Modules/Property Management System",
"website": "https://github.com/OCA/pms",
"author": "Open Source Integrators, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["pms_website", "pms_sale", "website_sale"],
"data": [
"data/website_menu.xml",
"security/ir.model.access.csv",
"security/pms_website_sale.xml",
"views/templates.xml",
"views/assets.xml",
],
"maintainers": ["max3903"],
}

View File

@@ -0,0 +1,3 @@
# Copyright (c) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import website

View File

@@ -0,0 +1,227 @@
# Copyright (c) 2021 Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from datetime import datetime
from odoo import http
from odoo.http import request
from odoo.addons.http_routing.models.ir_http import slug
from odoo.addons.website.controllers.main import QueryURL
from odoo.addons.website_sale.controllers.main import WebsiteSale
class PropertyTableCompute(object):
def __init__(self):
self.table = {}
def _check_place(self, posx, posy, sizex, sizey, ppr):
res = True
for y in range(sizey):
for x in range(sizex):
if posx + x >= ppr:
res = False
break
row = self.table.setdefault(posy + y, {})
if row.setdefault(posx + x) is not None:
res = False
break
for x in range(ppr):
self.table[posy + y].setdefault(x, None)
return res
def process(self, products, ppg=20, ppr=4):
# Compute products positions on the grid
minpos = 0
index = 0
maxy = 0
x = 0
for p in products:
x = min(1, ppr)
y = min(1, ppr)
if index >= ppg:
x = y = 1
pos = minpos
while not self._check_place(pos % ppr, pos // ppr, x, y, ppr):
pos += 1
# if 21st products (index 20) and the last line is full (ppr products in it), break
# (pos + 1.0) / ppr is the line where the product would be inserted
# maxy is the number of existing lines
# + 1.0 is because pos begins at 0, thus pos 20 is actually the 21st block
# and to force python to not round the division operation
if index >= ppg and ((pos + 1.0) // ppr) > maxy:
break
if x == 1 and y == 1: # simple heuristic for CPU optimization
minpos = pos // ppr
for y2 in range(y):
for x2 in range(x):
self.table[(pos // ppr) + y2][(pos % ppr) + x2] = False
self.table[pos // ppr][pos % ppr] = {"product": p, "x": x, "y": y}
if index <= ppg:
maxy = max(maxy, y + (pos // ppr))
index += 1
# Format table according to HTML needs
rows = sorted(self.table.items())
rows = [r[1] for r in rows]
for col in range(len(rows)):
cols = sorted(rows[col].items())
x += len(cols)
rows[col] = [r[1] for r in cols if r[1]]
return rows
class WebsiteSale(WebsiteSale):
def _get_property_search_domain(self, search, category, guest, args):
domain = []
if search:
domain += [("city", "ilike", search)]
if guest:
domain += [("no_of_guests", ">=", int(guest))]
if category:
domain += [("property_category_ids", "child_of", category.id)]
if args.get("date_range"):
date_range = args.get("date_range").split("-")
start = date_range[0].strip() + " 00:00:00"
end = date_range[1].strip() + " 23:59:59"
start = datetime.strptime(start, "%m/%d/%Y %H:%M:%S")
end = datetime.strptime(end, "%m/%d/%Y %H:%M:%S")
reservation_ids = (
request.env["pms.reservation"]
.sudo()
.search(
[
("stop", "<=", end),
"|",
"|",
("start", ">=", start),
("start", ">=", end),
("stop", ">=", start),
]
)
)
property_ids = reservation_ids.mapped("property_id")
domain += [("id", "not in", property_ids.ids)]
domain += [("property_child_ids", "=", False)]
return domain
def _get_pricelist_context(self):
pricelist_context = dict(request.env.context)
pricelist = False
if not pricelist_context.get("pricelist"):
pricelist = request.website.get_current_pricelist()
pricelist_context["pricelist"] = pricelist.id
else:
pricelist = request.env["product.pricelist"].browse(
pricelist_context["pricelist"]
)
return pricelist_context, pricelist
def _update_property_values(self, Property, post):
values = {
"city": list(
{
property_rec.city
for property_rec in Property.search([])
if property_rec.city
}
)
}
return values
@http.route(
[
"""/property""",
"""/property/page/<int:page>""",
"""/property/category/<model("pms.website.category"):category>""",
],
type="http",
auth="public",
website=True,
)
def property(
self, page=0, ppg=False, category=None, search="", guest_select="", **post
):
Category = request.env["pms.website.category"]
if category:
category = Category.search([("id", "=", int(category))], limit=1)
else:
category = Category
if ppg:
try:
ppg = int(ppg)
post["ppg"] = ppg
except ValueError:
ppg = False
if not ppg:
ppg = request.env["website"].get_current_website().shop_ppg or 20
ppr = request.env["website"].get_current_website().shop_ppr or 4
domain = self._get_property_search_domain(
search=search, category=category, guest=guest_select, args=post
)
keep = QueryURL("/property", category=category and int(category))
pricelist_context, pricelist = self._get_pricelist_context()
request.context = dict(
request.context, pricelist=pricelist.id, partner=request.env.user.partner_id
)
Property = request.env["pms.property"].with_context(bin_size=True)
search_property = Property.search(domain, order="name asc")
url = "/property"
categs_domain = [("parent_id", "=", False)]
if search:
search_categories = Category.search(
[("property_ids", "in", search_property.ids)]
).parents_and_self
categs_domain.append(("id", "in", search_categories.ids))
else:
search_categories = Category
categs = Category.search(categs_domain)
if category:
url = "/shop/category/%s" % slug(category)
product_count = len(search_property)
pager = request.website.pager(
url=url, total=product_count, page=page, step=ppg, scope=7, url_args=post
)
offset = pager["offset"]
properties = search_property[offset : offset + ppg]
layout_mode = "grid"
values = self._update_property_values(Property=Property, post=post)
# properties
values.update(
{
"category": category,
"search_city": search,
"search_guest": guest_select,
"search_raneg": post.get("date_range"),
"pager": pager,
"pricelist": pricelist,
"properties": properties,
"search_count": product_count, # common for all searchbox
"bins": PropertyTableCompute().process(properties, ppg, ppr),
"ppg": ppg,
"ppr": ppr,
"keep": keep,
"layout_mode": layout_mode,
"categories": categs,
"search_categories_ids": search_categories.ids,
}
)
return request.render("pms_website_sale.properties", values)

View File

@@ -0,0 +1,8 @@
<odoo>
<record id="menu_property" model="website.menu">
<field name="name">Properties</field>
<field name="url">/property</field>
<field name="parent_id" ref="website.main_menu" />
<field name="sequence" type="int">20</field>
</record>
</odoo>

View File

@@ -0,0 +1,99 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pms_website_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e-20211202\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-23 19:43+0000\n"
"PO-Revision-Date: 2021-12-23 19:43+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.pms_search_box
msgid "Add one"
msgstr "Agregar una"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.property_categories
msgid "All Properties"
msgstr "Todas las propiedades"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.pms_search_box
msgid "City..."
msgstr "Ciudad..."
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid ""
"Click <i>'New'</i> in the top-right corner to create your first property."
msgstr ""
"Dale clic <i>'Nueva'</i> en la esquina derecha arriba para crear tu primera propiedad."
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.pms_search_box
msgid "Guest..."
msgstr "Huesped..."
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "No Property defined"
msgstr "No se ha definido ninguna propiedad"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "No property defined in category \""
msgstr "No hay propiedad definida en la categoría \""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "No results"
msgstr "Sin resultados"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "No results for \""
msgstr "Sin resultados para \""
#. module: pms_website_sale
#: model:website.menu,name:pms_website_sale.menu_property
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "Properties"
msgstr "Propiedades"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.sale_order_portal_content
msgid "Property"
msgstr "Propiedad"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.pms_search_box
msgid "Remove one"
msgstr "Quitar una"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.property_categories
msgid "Show categories"
msgstr "Mostrar categorías"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.property_item
msgid "This product is unpublished."
msgstr "Este producto no esta publicado."
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.property_item
msgid "Unpublished"
msgstr "Despublicada"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "in category \""
msgstr "en categoría \""

View File

@@ -0,0 +1,98 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * pms_website_sale
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e-20211202\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-12-23 19:43+0000\n"
"PO-Revision-Date: 2021-12-23 19:43+0000\n"
"Last-Translator: \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.pms_search_box
msgid "Add one"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.property_categories
msgid "All Properties"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.pms_search_box
msgid "City..."
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid ""
"Click <i>'New'</i> in the top-right corner to create your first property."
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.pms_search_box
msgid "Guest..."
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "No Property defined"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "No property defined in category \""
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "No results"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "No results for \""
msgstr ""
#. module: pms_website_sale
#: model:website.menu,name:pms_website_sale.menu_property
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "Properties"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.sale_order_portal_content
msgid "Property"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.pms_search_box
msgid "Remove one"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.property_categories
msgid "Show categories"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.property_item
msgid "This product is unpublished."
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.property_item
msgid "Unpublished"
msgstr ""
#. module: pms_website_sale
#: model_terms:ir.ui.view,arch_db:pms_website_sale.properties
msgid "in category \""
msgstr ""

View File

@@ -0,0 +1 @@
* Go to Properties > Configuration > Settings.

View File

@@ -0,0 +1,15 @@
* Alexandre Díaz
* Pablo Quesada
* Jose Luis Algara
* `Commit [Sun] <https://www.commitsun.com>`:
* Dario Lodeiros
* Eric Antones
* Sara Lago
* Brais Abeijon
* Miguel Padin
* `Open Source Integrators <https://www.opensourceintegrators.com>`:
* Maxime Chambreuil <mchambreuil@opensourceintegrators.com>
* Ammar Officewala <aofficewala@opensourceintegrators.com>

View File

@@ -0,0 +1,3 @@
This module is the base module for the property management system (PMS) modules.
It provides the "Properties" apps with menu, settings, groups and data.

View File

@@ -0,0 +1 @@
To use this module, please read the complete user guide at `<roomdoo.com>`_.

View File

@@ -0,0 +1,2 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_pm_property_reservation_public,access_pm_property_reservation,pms_sale.model_pms_property_reservation,,1,0,0,0
1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink
2 access_pm_property_reservation_public access_pm_property_reservation pms_sale.model_pms_property_reservation 1 0 0 0

View File

@@ -0,0 +1,24 @@
<odoo noupdate="0">
<record id="property_public" model="ir.rule">
<field name="name">Property</field>
<field name="model_id" ref="pms_base.model_pms_property" />
<field name="domain_force">[('website_published', '=', True)]</field>
<field
name="groups"
eval="[(4, ref('base.group_public')), (4, ref('base.group_portal'))]"
/>
<field name="perm_read" eval="True" />
<field name="perm_write" eval="False" />
<field name="perm_create" eval="False" />
<field name="perm_unlink" eval="False" />
</record>
<record id="pms_base.group_pms_manager" model="res.groups">
<field
name="implied_ids"
eval="[(4, ref('website.group_website_publisher'))]"
/>
</record>
</odoo>

View File

@@ -0,0 +1,455 @@
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>PMS - Website Sale</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="pms-website-sale">
<h1 class="title">PMS - Website Sale</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/pms/tree/14.0-pms_base/pms_website_sale"><img alt="OCA/pms" src="https://img.shields.io/badge/github-OCA%2Fpms-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/pms-14-0-pms_base/pms-14-0-pms_base-pms_website_sale"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/293/14.0-pms_base"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This module is the base module for the property management system (PMS) modules.</p>
<p>It provides the “Properties” apps with menu, settings, groups and data.</p>
<div class="admonition important">
<p class="first admonition-title">Important</p>
<p class="last">This is an alpha version, the data model and design can change at any time without warning.
Only for development or testing purpose, do not use in production.
<a class="reference external" href="https://odoo-community.org/page/development-status">More details on development status</a></p>
</div>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="id1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="id2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<ul class="simple">
<li>Go to Properties &gt; Configuration &gt; Settings.</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id2">Usage</a></h1>
<p>To use this module, please read the complete user guide at <a class="reference external" href="roomdoo.com">roomdoo.com</a>.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/pms/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/pms/issues/new?body=module:%20pms_website_sale%0Aversion:%2014.0-pms_base%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
<ul class="simple">
<li>Open Source Integrators</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
<ul class="simple">
<li>Alexandre Díaz</li>
<li>Pablo Quesada</li>
<li>Jose Luis Algara</li>
<li><cite>Commit [Sun] &lt;https://www.commitsun.com&gt;</cite>:<ul>
<li>Dario Lodeiros</li>
<li>Eric Antones</li>
<li>Sara Lago</li>
<li>Brais Abeijon</li>
<li>Miguel Padin</li>
</ul>
</li>
<li><cite>Open Source Integrators &lt;https://www.opensourceintegrators.com&gt;</cite>:<ul>
<li>Maxime Chambreuil &lt;<a class="reference external" href="mailto:mchambreuil&#64;opensourceintegrators.com">mchambreuil&#64;opensourceintegrators.com</a>&gt;</li>
<li>Ammar Officewala &lt;<a class="reference external" href="mailto:aofficewala&#64;opensourceintegrators.com">aofficewala&#64;opensourceintegrators.com</a>&gt;</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/max3903"><img alt="max3903" src="https://github.com/max3903.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/pms/tree/14.0-pms_base/pms_website_sale">OCA/pms</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,23 @@
odoo.define("pms_website_sale.pms_property", function (require) {
"use strict";
const publicWidget = require("web.public.widget");
publicWidget.registry.pmsProperty = publicWidget.Widget.extend({
selector: ".oe_property_filtter",
jsLibs: [
"/web/static/lib/daterangepicker/daterangepicker.js",
"/web/static/src/js/libs/daterangepicker.js",
],
cssLibs: ["/web/static/lib/daterangepicker/daterangepicker.css"],
start: function () {
var def = this._super.apply(this, arguments);
$(".field_date_range_filtter").daterangepicker({
autoApply: true,
mindate: new moment(),
});
return def;
},
});
});

View File

@@ -0,0 +1,33 @@
odoo.define("pms_website_sale.pms_website_sale_tour", function (require) {
"use strict";
var tour = require("web_tour.tour");
// This tour relies on data created on the Python test.
tour.register(
"property_load_homepage",
{
test: true,
url: "/property",
},
[
{
content: "Check Property",
trigger: ".oe_website_sale",
},
]
);
tour.register(
"property_search_homepage",
{
test: true,
url: "/property?date_range=04/18/2022-04/18/2022&guest_select=2",
},
[
{
content: "Check Property",
trigger: ".oe_website_sale",
},
]
);
});

View File

@@ -0,0 +1,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import test_pms_sale_property

View File

@@ -0,0 +1,44 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests import tagged
from odoo.addons.base.tests.common import HttpCaseWithUserPortal
@tagged("post_install", "-at_install")
class TestWebsiteSaleCartRecovery(HttpCaseWithUserPortal):
def test_01_property_page(self):
self.start_tour("/", "property_load_homepage", login="portal")
self.env["pms.property"].create(
{
"name": "Property 1",
"website_published": True,
"owner_id": self.env.ref("base.res_partner_12").id,
"no_of_guests": 2,
}
)
self.env["pms.property"].create(
{
"name": "Property 2",
"website_published": True,
"owner_id": self.env.ref("base.res_partner_12").id,
"no_of_guests": 2,
}
)
self.env["pms.property"].create(
{
"name": "Property 3",
"website_published": True,
"owner_id": self.env.ref("base.res_partner_12").id,
"no_of_guests": 2,
}
)
self.env["pms.property"].create(
{
"name": "Property 4",
"website_published": True,
"owner_id": self.env.ref("base.res_partner_12").id,
"no_of_guests": 2,
}
)
self.start_tour("/", "property_search_homepage")

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template
id="assets_frontend"
inherit_id="website.assets_frontend"
name="Event Meet Assets"
>
<xpath expr="." position="inside">
<script
src="/pms_website_sale/static/src/js/pms_property.js"
type="text/javascript"
/>
</xpath>
</template>
<template
id="assets_tests"
name="Website Sale Assets Tests"
inherit_id="web.assets_tests"
>
<xpath expr="." position="inside">
<script
type="text/javascript"
src="/pms_website_sale/static/tests/tours/pms_website_sale_tour.js"
/>
</xpath>
</template>
</odoo>

View File

@@ -0,0 +1,336 @@
<odoo>
<template
id="sale_order_portal_content"
inherit_id="sale.sale_order_portal_content"
name="Sales Order Portal Content"
>
<xpath expr="//tbody[hasclass('sale_tbody')]//tr/t[1]/td[1]" position="inside">
<td>
<t t-if="line.property_id">
<t t-esc="line.property_id.name" />
</t>
</td>
</xpath>
<xpath
expr="//table[@id='sales_order_table']//thead/tr/th[1]"
position="inside"
>
<th>Property</th>
</xpath>
</template>
<template id="property_categories_data" name="Category list">
<li class="nav-item">
<a
t-att-href="keep('/property/category/' + slug(c), category=0)"
t-attf-class="nav-link #{'active' if c.id == category.id else ''}"
>
<span t-esc="c.name" />
</a>
<ul t-if="c.child_ids" class="nav nav-pills flex-column nav-hierarchy">
<t t-foreach="c.child_ids" t-as="c">
<t t-if="not search or c.id in search_categories_ids">
<t t-call="pms_website_sale.property_categories_data" />
</t>
</t>
</ul>
</li>
</template>
<template
id="pms_website_sale_search_box"
inherit_id="website.website_search_box"
primary="True"
>
<xpath expr="//div[@role='search']" position="attributes">
<attribute name="t-attf-class" remove="#{_classes}" separator=" " />
</xpath>
<xpath expr="//div[@role='search']" position="replace">
<form
t-attf-class="o_wsale_products_searchbar_form o_wait_lazy_js #{_classes}"
t-att-action="action if action else '/property'"
method="get"
t-att-data-snippet="_snippet"
>
<t>$0</t>
<!-- <input name="order" class="o_wsale_search_order_by" value=""/> -->
<t t-raw="0" />
</form>
</xpath>
</template>
<template
id="pms_search_box"
inherit_id="pms_website_sale.pms_website_sale_search_box"
>
<xpath expr="//input[@name='search']" position="replace">
<select class="form-control mr-3" id="city" name="search">
<option value="">City...</option>
<t t-foreach="city" t-as="c">
<option t-att-value="c" t-att-selected="c == search_city">
<t t-esc="c" />
</option>
</t>
</select>
<input
class="field_date_range_filtter form-control mr-3"
name="date_range"
type="text"
t-att-value="search_raneg"
/>
<div class="css_quantity input-group mr-3" contenteditable="false">
<div class="input-group-prepend">
<a
t-attf-href="#"
class="btn btn-secondary js_add_cart_json"
aria-label="Remove one"
title="Remove one"
style="color:none;background-color:none;"
>
<i class="fa fa-minus" />
</a>
</div>
<input
type="text"
class="form-control text-center"
style="max-width:60px;"
data-min="1"
name="guest_select"
placeholder="Guest..."
t-att-value="search_guest or ''"
/>
<div class="input-group-append">
<a
t-attf-href="#"
class="btn btn-secondary float_left js_add_cart_json"
aria-label="Add one"
title="Add one"
>
<i class="fa fa-plus" />
</a>
</div>
</div>
</xpath>
</template>
<template id="search" name="Search Box">
<t t-call="pms_website_sale.pms_website_sale_search_box">
<t t-set="action" t-value="'/property'" />
</t>
</template>
<!-- make grid view of template -->
<template id="property_item" name="Property">
<t
t-set="product_href"
t-value="keep(product.website_url, page=(pager['page']['num'] if pager['page']['num']&gt;1 else None))"
/>
<form
action="/shop/cart/update"
method="post"
class="card oe_product_cart oe_property_cart"
t-att-data-publish="product.website_published and 'on' or 'off'"
itemscope="itemscope"
itemtype="http://schema.org/Product"
>
<div class="card-body p-1 oe_product_image">
<input
type="hidden"
name="csrf_token"
t-att-value="request.csrf_token()"
/>
<a t-att-href="product_href" class="d-block h-100" itemprop="url">
<t t-set="image_holder" t-value="product" />
<span
t-field="image_holder.image_1920"
t-options="{'widget': 'image', 'preview_image': 'image_1024' if product_image_big else 'image_256', 'itemprop': 'image'}"
class="d-flex h-100 justify-content-center align-items-center"
/>
</a>
</div>
<div class="card-body p-0 text-center o_wsale_product_information">
<div class="p-2 o_wsale_product_information_text">
<h6 class="o_wsale_products_item_title">
<a
itemprop="name"
t-att-href="product_href"
t-att-content="product.name"
t-field="product.name"
/>
<a
role="button"
t-if="not product.website_published"
t-att-href="product_href"
class="btn btn-sm btn-danger"
title="This product is unpublished."
>Unpublished</a>
</h6>
<!-- <div class="product_price" itemprop="offers" itemscope="itemscope" itemtype="http://schema.org/Offer">
<del t-attf-class="text-danger mr-2 {{'' if combination_info['has_discounted_price'] else 'd-none'}}" style="white-space: nowrap;" t-esc="combination_info['list_price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}" />
<span t-if="combination_info['price']" t-esc="combination_info['price']" t-options="{'widget': 'monetary', 'display_currency': website.currency_id}"/>
<span itemprop="price" style="display:none;" t-esc="combination_info['price']" />
<span itemprop="priceCurrency" style="display:none;" t-esc="website.currency_id.name" />
</div> -->
</div>
<div class="o_wsale_product_btn" />
</div>
<!-- <t t-set="bg_color" t-value="td_product['ribbon']['bg_color'] or ''"/> -->
<!-- <t t-set="text_color" t-value="td_product['ribbon']['text_color']"/> -->
<!-- <t t-set="bg_class" t-value="td_product['ribbon']['html_class']"/> -->
<!-- <span t-attf-class="o_ribbon #{bg_class}" t-attf-style="#{text_color and ('color: %s; ' % text_color)}#{bg_color and 'background-color:' + bg_color}" t-raw="td_product['ribbon']['html'] or ''"/> -->
</form>
</template>
<!-- /property listing -->
<template id="properties" name="Properties">
<t t-call="website.layout">
<t t-set="additional_title">Properties</t>
<div id="wrap" class="js_sale">
<div
class="oe_structure oe_empty"
id="oe_structure_website_sale_products_1"
/>
<div class="container oe_website_sale">
<div
class="products_pager oe_property_filtter form-inline flex-md-nowrap justify-content-between justify-content-md-center"
>
<t t-call="pms_website_sale.search">
<t t-set="_classes" t-valuef="w-100 w-md-auto mt-2" />
</t>
<t t-call="website.pager">
<t t-set="_classes" t-valuef="mt-2 ml-md-2" />
</t>
</div>
<div class="row o_wsale_products_main_row">
<div
t-if="enable_left_column"
id="products_grid_before"
class="col-lg-3"
/>
<div
id="products_grid"
t-attf-class="col #{'o_wsale_layout_list' if layout_mode == 'list' else ''}"
>
<div
t-if="bins"
class="o_wsale_products_grid_table_wrapper"
>
<table
class="table table-borderless m-0"
t-att-data-ppg="ppg"
t-att-data-ppr="ppr"
>
<colgroup t-ignore="true">
<col t-foreach="ppr" t-as="p" />
</colgroup>
<tbody>
<tr t-foreach="bins" t-as="tr_product">
<t t-foreach="tr_product" t-as="td_product">
<t
t-set="product"
t-value="td_product['product']"
/>
<td
t-attf-class="oe_product"
t-att-colspan="td_product['x'] != 1 and td_product['x']"
t-att-rowspan="td_product['y'] != 1 and td_product['y']"
>
<div
t-attf-class="o_wsale_product_grid_wrapper o_wsale_product_grid_wrapper_1_1"
>
<t
t-call="pms_website_sale.property_item"
>
<t
t-set="product_image_big"
t-value="1 + 1 &gt; 2"
/>
</t>
</div>
</td>
</t>
</tr>
</tbody>
</table>
</div>
<t t-else="">
<div class="text-center text-muted">
<t t-if="not search">
<h3 class="mt8">No Property defined</h3>
<p
t-if="category"
>No property defined in category "<strong
t-esc="category.display_name"
/>".</p>
</t>
<t t-else="">
<h3 class="mt8">No results</h3>
<p>No results for "<strong t-esc='search' />"<t
t-if="category"
> in category "<strong
t-esc="category.display_name"
/>"</t>.</p>
</t>
<p
t-ignore="true"
groups="sales_team.group_sale_manager"
>Click <i
>'New'</i> in the top-right corner to create your first property.</p>
</div>
</t>
</div>
</div>
<div class="products_pager form-inline justify-content-center py-3">
<t t-call="website.pager" />
</div>
</div>
<div
class="oe_structure oe_empty"
id="oe_structure_website_sale_products_2"
/>
</div>
</t>
</template>
<template
id="property_categories"
inherit_id="pms_website_sale.properties"
active="True"
customize_show="True"
name="Property Categories"
>
<xpath expr="//div[@id='products_grid_before']" position="before">
<t t-set="enable_left_column" t-value="True" />
</xpath>
<xpath expr="//div[@id='products_grid_before']" position="inside">
<button
type="button"
class="btn btn-link d-lg-none"
data-target="#wsale_products_categories_collapse"
data-toggle="collapse"
>
Show categories
</button>
<div class="collapse d-lg-block" id="wsale_products_categories_collapse">
<ul class="nav nav-pills flex-column mb-2">
<li class="nav-item">
<a
t-att-href="keep('/property',category=0)"
t-attf-class="nav-link #{'' if category else 'active'} o_not_editable"
>All Properties</a>
</li>
<t t-foreach="categories" t-as="c">
<t t-call="pms_website_sale.property_categories_data" />
</t>
</ul>
</div>
</xpath>
</template>
</odoo>

View File

@@ -0,0 +1 @@
../../../../pms_website_sale

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)