Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
118 changes: 118 additions & 0 deletions pms_downpayment_autoinvoice/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
==============================
PMS Downpayment Auto-Invoicing
==============================

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

.. |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/16.0/pms_downpayment_autoinvoice
:alt: OCA/pms
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/pms-16-0/pms-16-0-pms_downpayment_autoinvoice
: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=16.0
:alt: Try me on Runboat

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

# PMS Downpayment Auto-Invoicing

Automates **downpayment (advance) invoicing** for PMS payments, **per company** configuration.

## What it does

- Adds a **“Downpayment Automation”** tab on the *Company* form.
- Lets you enable automatic downpayment invoicing and choose a **schedule**:
- **Daily** (every day)
- **Weekly** (on a chosen weekday)
- **Monthly** (on first/last/penultimate or a fixed day 1..28)
- **Quarterly** (on the **last day of each quarter**: Mar 31, Jun 30, Sep 30, Dec 31)
- A single **cron job with no parameters** runs daily and, for each company enabled:

- Decides if it **should run today** based on that company’s schedule.
- Computes a **time window** `(last theoretical run, today]`.
- Selects **payments** with posted moves in that window, linked to folios with `last_checkout > today`,
and **not already invoiced** as downpayments.

## Business logic recap

- A payment is considered a *downpayment candidate* if:
- Its accounting move is **posted** within the computed window.
- The journal is **not** marked *avoid_auto_invoice_downpayment*.
- It is linked to at least one folio and **at least one** linked folio has `last_checkout > today`.
- It has **no reconciled downpayment invoice yet**.

> This module does **not** change your existing downpayment definition. It only automates the invoicing workflow based on timing rules.

## Configuration

Open **Settings → Companies → Your Company → Downpayment Automation**:
- **Enable Auto Downpayment Invoicing**
- **Schedule Mode**: daily, weekly, monthly, quarterly
- **Weekly Day** (if weekly)
- **Monthly Marker & Day** (if monthly)
- **Batch Size** (performance control)

## Notes

- The cron runs daily at a fixed time, but **the method decides** whether it should act for each company based on its schedule.
- Multi-company aware: the process runs **per company** and uses each company’s configuration.

**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_downpayment_autoinvoice%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
~~~~~~~

* Roomdoo

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

* Dario Lodeiros (dario@roomdoo.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.

This module is part of the `OCA/pms <https://github.com/OCA/pms/tree/16.0/pms_downpayment_autoinvoice>`_ 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_downpayment_autoinvoice/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions pms_downpayment_autoinvoice/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "PMS Downpayment Auto-Invoicing",
"summary": (
"Automated downpayment invoicing for PMS by company schedule "
"(daily/weekly/monthly/quarterly)."
),
"version": "16.0.1.0.0",
"category": "Accounting/Hotel PMS",
"license": "AGPL-3",
"author": ("Odoo Community Association (OCA), " "Roomdoo"),
"website": "https://github.com/OCA/pms",
"depends": [
"account",
"pms",
],
"data": [
"views/res_company_views.xml",
"data/ir_cron.xml",
],
"installable": True,
"application": False,
}
24 changes: 24 additions & 0 deletions pms_downpayment_autoinvoice/data/ir_cron.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Single parameterless cron; logic decides per company -->
<record id="cron_pms_downpayment_autoinvoice" model="ir.cron">
<field name="name">PMS Auto Downpayment Invoicing</field>
<field name="model_id" ref="account.model_account_payment" />
<field name="state">code</field>
<field name="code">
# Runs daily. For each company with automation enabled, it evaluates and runs if scheduled today.
model.pms_run_downpayment_autoinvoice_cron()
</field>
<field name="interval_type">days</field>
<field name="interval_number">1</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="active" eval="True" />
<!-- Next run at 04:30 server time -->
<field
name="nextcall"
eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 04:30:00')"
/>
<field name="user_id" ref="base.user_root" />
</record>
</odoo>
154 changes: 154 additions & 0 deletions pms_downpayment_autoinvoice/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Translation of PMS Downpayment Auto-Invoicing to Spanish
# Copyright (C) 2025 Roomdoo
# This file is distributed under the same license as the module.
#
msgid ""
msgstr ""
"Project-Id-Version: pms_downpayment_autoinvoice 16.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-10-02 12:00+0000\n"
"PO-Revision-Date: 2025-10-02 12:00+0000\n"
"Last-Translator: Roomdoo Tech <dev@roomdoo.com>\n"
"Language-Team: Spanish\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,field_description:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_enabled
msgid "Enable Auto Downpayment Invoicing"
msgstr "Activar facturación automática de anticipos"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,help:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_enabled
msgid "If enabled, the daily cron will evaluate and run downpayment invoicing for this company according to the schedule below."
msgstr "Si está activado, el cron diario evaluará y ejecutará la facturación de anticipos para esta compañía según la configuración indicada."

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,field_description:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_mode
msgid "Schedule Mode"
msgstr "Modo de programación"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,help:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_mode
msgid "Select how often the automation should run."
msgstr "Selecciona cada cuánto tiempo debe ejecutarse la automatización."

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_mode__daily
msgid "Daily"
msgstr "Diario"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_mode__weekly
msgid "Weekly"
msgstr "Semanal"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_mode__monthly
msgid "Monthly"
msgstr "Mensual"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_mode__quarterly
msgid "Quarterly (last day of each quarter)"
msgstr "Trimestral (último día de cada trimestre)"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,field_description:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_weekday
msgid "Weekly Day"
msgstr "Día de la semana"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,field_description:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_monthly_marker
msgid "Monthly Marker"
msgstr "Marcador mensual"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,field_description:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_monthly_day
msgid "Monthly Day"
msgstr "Día del mes"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,field_description:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_batch_size
msgid "Batch Size"
msgstr "Tamaño de lote"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields,field_description:pms_downpayment_autoinvoice.field_res_company__downpayment_auto_dry_run
msgid "Dry Run"
msgstr "Simulación (Dry Run)"

#. module: pms_downpayment_autoinvoice
#: model_terms:ir.ui.view,arch_db:pms_downpayment_autoinvoice.view_company_form_inherit_downpayment_auto
msgid "Downpayment Automation"
msgstr "Automatización de anticipos"

#. module: pms_downpayment_autoinvoice
#: model_terms:ir.ui.view,arch_db:pms_downpayment_autoinvoice.view_company_form_inherit_downpayment_auto
msgid "Quarterly will run on the last day of each quarter (Mar 31, Jun 30, Sep 30, Dec 31)."
msgstr "La ejecución trimestral se realizará el último día de cada trimestre (31 marzo, 30 junio, 30 septiembre, 31 diciembre)."

#. module: pms_downpayment_autoinvoice
#: model:ir.cron,name:pms_downpayment_autoinvoice.cron_pms_downpayment_autoinvoice
msgid "PMS Auto Downpayment Invoicing"
msgstr "PMS - Facturación automática de anticipos"

# ---- Weekly day ----
#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_weekday__mon
msgid "Monday"
msgstr "Lunes"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_weekday__tue
msgid "Tuesday"
msgstr "Martes"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_weekday__wed
msgid "Wednesday"
msgstr "Miércoles"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_weekday__thu
msgid "Thursday"
msgstr "Jueves"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_weekday__fri
msgid "Friday"
msgstr "Viernes"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_weekday__sat
msgid "Saturday"
msgstr "Sábado"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_weekday__sun
msgid "Sunday"
msgstr "Domingo"

# ---- Monthly marker ----
#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_monthly_marker__first
msgid "First"
msgstr "Primero"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_monthly_marker__last
msgid "Last"
msgstr "Último"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_monthly_marker__penultimate
msgid "Penultimate"
msgstr "Penúltimo"

#. module: pms_downpayment_autoinvoice
#: model:ir.model.fields.selection,name:pms_downpayment_autoinvoice.selection__res_company__downpayment_auto_monthly_marker__fixed
msgid "Fixed Day (1..28)"
msgstr "Día fijo (1..28)"
2 changes: 2 additions & 0 deletions pms_downpayment_autoinvoice/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import res_company
from . import account_payment
Loading