Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMP] pms_property_opening: property opening data and pms_tourist_room: calculation of the total tourist room in the property information card #278

Open
wants to merge 12 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pms/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"views/res_partner_id_category_views.xml",
"views/res_partner_id_number_views.xml",
"views/res_country_views.xml",
"views/pms_information_view.xml",
],
"demo": [
"demo/pms_master_data_no_update.xml",
Expand Down
32 changes: 32 additions & 0 deletions pms/views/pms_information_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="pms_property_information_view" model="ir.ui.view">
<field name="name">pms.property.information.view</field>
<field name="model">pms.property</field>
<field name="inherit_id" ref="pms.pms_property_views_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='phone']" position="after">
<sheet>
<field name="email" readonly="1" />
</sheet>
</xpath>
<xpath expr="//page[@name='property_general']" position="inside">
<sheet>
<div class="container">
<div class="o_horizontal_separator">Property Information</div>
<div class="o_row">
<div class="o_col-8">
<h4 style="color:#7C7BAD;">Bank Information</h4>
<group>
<field name="vat" readonly="1" />
<field name="bank_ids" readonly="1">
</field>
</group>
</div>
</div>
</div>
</sheet>
</xpath>
</field>
</record>
</odoo>
1 change: 1 addition & 0 deletions pms_l10n_es/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"views/res_partner_id_number_view.xml",
"views/pms_checkin_partner_views.xml",
"views/pms_reservation_views.xml",
"views/pms_tourist_room.xml",
"wizards/traveller_report.xml",
"wizards/wizard_ine.xml",
"reports/invoice.xml",
Expand Down
1 change: 1 addition & 0 deletions pms_l10n_es/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
from . import res_partner_id_number
from . import pms_ses_communication
from . import pms_reservation
from . import pms_tourist_room
37 changes: 37 additions & 0 deletions pms_l10n_es/models/pms_tourist_room.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright 2024 OsoTranquilo - José Luis Algara
# Copyright 2024 Irlui Ramírez
# From Consultores Hoteleros Integrales (ALDA Hotels) - 2024
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import _, api, fields, models
from odoo.exceptions import ValidationError


class PmsProperty(models.Model):
_inherit = "pms.property"

total_tourist_rooms = fields.Integer(
string="Tourist Rooms",
help="Number of tourist rooms in the hotel.",
compute="_compute_total_rooms",
store=True,
default=lambda self: self._get_default_total_rooms(),
)

@api.depends("room_ids")
def _compute_total_rooms(self):
for record in self:
record.total_tourist_rooms = len(record.room_ids)

@api.constrains("total_tourist_rooms")
def _check_total_tourism_rooms(self):
for record in self:
if record.total_tourist_rooms > len(record.room_ids):
raise ValidationError(

Check warning on line 29 in pms_l10n_es/models/pms_tourist_room.py

View check run for this annotation

Codecov / codecov/patch

pms_l10n_es/models/pms_tourist_room.py#L29

Added line #L29 was not covered by tests
_(
"The number of tourist rooms cannot exceed the total number of rooms."
)
)

@api.model
def _get_default_total_rooms(self):
return len(self.room_ids)
18 changes: 18 additions & 0 deletions pms_l10n_es/views/pms_tourist_room.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="pms_property_tourist_room_form" model="ir.ui.view">
<field name="name">pms.property_tourist_room.form</field>
<field name="model">pms.property</field>
<field name="inherit_id" ref="pms.pms_property_views_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='email']" position="after">
<sheet>
<group>
<h4 style="color:#7C7BAD;">History Information</h4>
<field name="total_tourist_rooms" readonly="0" />
</group>
</sheet>
</xpath>
</field>
</record>
</odoo>
82 changes: 82 additions & 0 deletions pms_property_opening/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
====================
PMS Property Opening
====================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:d59c09cb506df45a9ab24e3239637a74462a6790285ec0c182c5f3b957d4150f
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |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_property_opening
: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-14-0-pms_property_opening
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/pms&target_branch=14.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module is used to manage data and information on the opening of properties

**Table of contents**

.. contents::
:local:

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/pms/issues/new?body=module:%20pms_property_opening%0Aversion:%2014.0%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
~~~~~~~

* Irlui Ramirez
* José Luis Algara

Contributors
~~~~~~~~~~~~

* `Consultores Hoteleros Integrales [ALDA HOTELS] <https://www.aldahotels.es>`:
* `Commit [Sun] <https://www.commitsun.com>`:

* Irlui Ramírez
* José Luis Algara
* Darío Loderios

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.

This module is part of the `OCA/pms <https://github.com/OCA/pms/tree/14.0/pms_property_opening>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions pms_property_opening/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
20 changes: 20 additions & 0 deletions pms_property_opening/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 OsoTranquilo - José Luis Algara
# Copyright 2024 Irlui Ramírez
# From Consultores Hoteleros Integrales (ALDA Hotels) - 2024
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "PMS Property Opening",
"version": "14.0.1.0.0",
"category": "PMS",
"summary": """ Information regarding the opening of property """,
"author": "Irlui Ramirez,José Luis Algara,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/pms",
"depends": ["base", "pms"],
"data": [
"views/pms_property_view.xml",
],
"application": True,
"installable": True,
"auto_install": True,
"license": "AGPL-3",
}
1 change: 1 addition & 0 deletions pms_property_opening/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import pms_property
13 changes: 13 additions & 0 deletions pms_property_opening/models/pms_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2024 OsoTranquilo - José Luis Algara
# Copyright 2024 Irlui Ramírez
# From Consultores Hoteleros Integrales (ALDA Hotels) - 2024
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import fields, models


class PmsProperty(models.Model):
_inherit = "pms.property"

open_date = fields.Datetime(
string="Open date", default=fields.Datetime.now, help="Property opening date."
)
6 changes: 6 additions & 0 deletions pms_property_opening/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
* `Consultores Hoteleros Integrales [ALDA HOTELS] <https://www.aldahotels.es>`:
* `Commit [Sun] <https://www.commitsun.com>`:

* Irlui Ramírez
* José Luis Algara
* Darío Loderios
1 change: 1 addition & 0 deletions pms_property_opening/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This module is used to manage data and information on the opening of properties
Loading
Loading