Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c6f945c
[ADD] Add module stay_api (depend on fastapi)
alexis-via Apr 28, 2025
d7619d5
[BOT] post-merge updates
OCA-git-bot Apr 30, 2025
f0a50ab
[IMP] stay and stay_api: add /read, /update and /cancel in API
alexis-via May 7, 2025
71b6272
[IMP] stay_api: add phone in controllers and wizards (in addition to …
alexis-via May 8, 2025
b103981
[IMP] stay_api: add notification for update and cancel APIs
alexis-via May 9, 2025
6011b1d
[IMP] stay_api: generate update URL
alexis-via May 9, 2025
bf2b5cb
[IMP] stay_api: display UUID only for base.group_system
alexis-via May 9, 2025
5b3c532
[IMP] stay_api: title switched from char to M2O
May 19, 2025
cc811bb
[BOT] post-merge updates
OCA-git-bot May 9, 2025
aa39615
[IMP] stay_api: move update url to stay type
alexis-via May 22, 2025
9b4df9b
[IMP] stay_api: improve string and pep8 fixes
alexis-via May 22, 2025
9ac82ff
[BOT] post-merge updates
OCA-git-bot May 23, 2025
ebe7786
[FIX] stay_api: restore code removed by mistake in my previous commit
alexis-via May 23, 2025
860d6ff
[BOT] post-merge updates
OCA-git-bot May 24, 2025
62907ba
[IMP] stay_api: tune domain for max stay per 24h rate limit
alexis-via May 27, 2025
1042013
[IMP] stay_api: allow to match partner on mobile phone
alexis-via May 27, 2025
6a2297e
[IMP] stay_api: also reformat phone field
alexis-via May 27, 2025
700323c
[BOT] post-merge updates
OCA-git-bot Jun 6, 2025
f65780c
[IMP] stay_api: convert log from debug to info
alexis-via Jun 19, 2025
ae79546
[IMP] stay_api: return data on /update
alexis-via Jun 19, 2025
32c2ec1
[IMP] stay: update_url invisible when type_id is not set
alexis-via Jun 19, 2025
1ed0fb7
[IMP] stay: stay_code on res.partner.title are now restricted to base…
alexis-via Jun 19, 2025
2b8d6b3
[IMP] stay_api: add default email on stay_api_user to avoid errors wh…
alexis-via Jun 19, 2025
e02b692
[IMP] stay_api: convert controller_notes from text to HTML
alexis-via Jun 20, 2025
ef346b6
[IMP] stay_api: Remove group_id from stay update request
alexis-via Jun 20, 2025
9815996
[BOT] post-merge updates
OCA-git-bot Aug 19, 2025
96b8383
[IMP] pre-commit auto updates
alexis-via Nov 30, 2025
d5e4abc
[MIG] stay_api: migrate 14 -> 16
alexis-via Jan 12, 2026
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 requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# generated from manifests external_dependencies
fastapi
xlsxwriter
1 change: 1 addition & 0 deletions setup/stay_api/odoo/addons/stay_api
6 changes: 6 additions & 0 deletions setup/stay_api/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
92 changes: 92 additions & 0 deletions stay_api/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
========
Stay API
========

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

.. |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%2Fvertical--abbey-lightgray.png?logo=github
:target: https://github.com/OCA/vertical-abbey/tree/16.0/stay_api
:alt: OCA/vertical-abbey
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/vertical-abbey-16-0/vertical-abbey-16-0-stay_api
: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/vertical-abbey&target_branch=16.0
:alt: Try me on Runboat

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

This module provides a REST API to create new stays. Useful if you have
a web form on your website and you want it to create a new draft stay
upon validation.

**Table of contents**

.. contents::
:local:

Installation
============

This module depends on the OCA module **fastapi** from
`rest-framework <https://github.com/OCA/rest-framework>`__.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/vertical-abbey/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/vertical-abbey/issues/new?body=module:%20stay_api%0Aversion:%2016.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
-------

* Akretion

Contributors
------------

- Alexis de Lattre <alexis.delattre@akretion.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-alexis-via| image:: https://github.com/alexis-via.png?size=40px
:target: https://github.com/alexis-via
:alt: alexis-via

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-alexis-via|

This module is part of the `OCA/vertical-abbey <https://github.com/OCA/vertical-abbey/tree/16.0/stay_api>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions stay_api/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import models
from . import schemas
from . import routers
from . import wizards
from .post_install import stay_api_postinstall
26 changes: 26 additions & 0 deletions stay_api/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2025 Akretion France (https://www.akretion.com)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Stay API",
"version": "16.0.1.0.0",
"category": "Lodging",
"license": "AGPL-3",
"summary": "REST API for stay module",
"author": "Akretion, Odoo Community Association (OCA)",
"maintainers": ["alexis-via"],
"website": "https://github.com/OCA/vertical-abbey",
"depends": ["stay", "fastapi", "partner_match_or_create"],
"external_dependencies": {"python": ["fastapi"]},
"data": [
"data/res_users.xml",
"security/ir.model.access.csv",
"wizards/res_config_settings_view.xml",
"views/stay_stay.xml",
"views/stay_type.xml",
"data/mail_template.xml",
],
"post_init_hook": "stay_api_postinstall",
"installable": True,
}
86 changes: 86 additions & 0 deletions stay_api/data/mail_template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2025 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="0">


<record id="stay_controller_notify" model="mail.template">
<field name="name">Stay: Notify stay creation/update/cancel from web form</field>
<field name="model_id" ref="stay.model_stay_stay" />
<field name="email_from">{{object.company_id.email_formatted}}</field>
<field
name="partner_to"
>{{object.group_id and object.group_id.notify_user_ids and str(object.group_id.notify_user_ids.partner_id.ids)[1:-1] or (object.company_id.stay_notify_user_ids and str(object.company_id.stay_notify_user_ids.partner_id.ids)[1:-1])}}</field>
<field name="reply_to">{{object.controller_email}}</field>
<field name="auto_delete" eval="False" />
<field
name="subject"
>Stay {{ctx.get('action_description')}}: {{object.partner_name}} {{format_date(object.arrival_date)}} → {{format_date(object.departure_date)}} x {{object.guest_qty}}</field>
<field name="lang">{{object.company_id.partner_id.lang}}</field>
<field name="body_html" type="html">
<div style="margin: 0px; padding: 0px;">
<p style="margin: 0px; padding: 0px; font-size: 13px;">Stay <t
t-out="object.name"
/> has been <t
t-out="ctx.get('action_description')"
/> via the web form:</p>
<ul>
<li>Guest: <t t-out="object.partner_name">Alexis de Lattre</t></li>
<li>Guest Qty: <t t-out="object.guest_qty">1</t></li>
<li>Arrival: <t t-out="format_date(object.arrival_date)">2026-02-15</t> <t
t-out="dict(object.fields_get('arrival_time', 'selection')['arrival_time']['selection'])[object.arrival_time]"
>Afternoon</t></li>
<t t-if="object.arrival_note">
<li>Arrival Note: <t t-out="object.arrival_note">TER 15h</t></li>
</t>
<li>Departure: <t
t-out="format_date(object.departure_date)"
>2026-02-19</t> <t
t-out="dict(object.fields_get('departure_time', 'selection')['departure_time']['selection'])[object.departure_time]"
>Evening</t></li>
<t t-if="object.departure_note">
<li>Departure Note: <t t-out="object.departure_note">TER 20h30</t></li>
</t>
<t t-if="object.group_id">
<li>Group: <t
t-out="object.group_id.display_name"
>Hôtellerie du village</t></li>
</t>
<t t-if="object.controller_email">
<li>E-mail: <t
t-out="object.controller_email"
>alexis@example.fr</t></li>
</t>
<t t-if="object.controller_phone">
<li>Phone: <t t-out="object.controller_phone">+33 4 78 55 66 77</t></li>
</t>
<t t-if="object.controller_mobile">
<li>Mobile: <t
t-out="object.controller_mobile"
>+33 6 11 22 33 44</t></li>
</t>
<t t-if="object.controller_message">
<li>Guest message: <t
t-out="object.controller_message"
>My motivation for this stay.</t></li>
</t>
<t t-if="object.controller_notes">
<li>Other information: <t
t-out="object.controller_notes"
>Specific questions.</t></li>
</t>
<t t-if="object.controller_country_id">
<li>Country: <t
t-out="object.controller_country_id.name"
>France</t></li>
</t>
</ul>
</div>
</field>
</record>


</odoo>
19 changes: 19 additions & 0 deletions stay_api/data/res_users.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8" ?>
<!--
Copyright 2025 Akretion France (https://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo noupdate="1">

<record id="stay_api_user" model="res.users" context="{'no_reset_password': True}">
<field name="name">Stay API User</field>
<field name="login">stay_api_user</field>
<field name="email">stay_api_user@example.org</field>
<field
name="groups_id"
eval="[(6, 0, [ref('base.group_user'), ref('stay.group_stay_user'), ref('fastapi.group_fastapi_endpoint_runner')])]"
/>
</record>

</odoo>
Loading
Loading