mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] sequence reservations folios and checkins
This commit is contained in:
@@ -4,22 +4,25 @@
|
|||||||
<record model="ir.sequence" id="seq_pms_folio">
|
<record model="ir.sequence" id="seq_pms_folio">
|
||||||
<field name="name">PMS Folio</field>
|
<field name="name">PMS Folio</field>
|
||||||
<field name="code">pms.folio</field>
|
<field name="code">pms.folio</field>
|
||||||
<field name="prefix">F/</field>
|
<field name="prefix">F/%(y)s</field>
|
||||||
<field name="padding">5</field>
|
<field name="suffix">%(sec)s</field>
|
||||||
|
<field name="padding">4</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.sequence" id="seq_pms_reservation">
|
<record model="ir.sequence" id="seq_pms_reservation">
|
||||||
<field name="name">PMS Reservation</field>
|
<field name="name">PMS Reservation</field>
|
||||||
<field name="code">pms.reservation</field>
|
<field name="code">pms.reservation</field>
|
||||||
<field name="prefix">R/</field>
|
<field name="prefix">R/%(y)s</field>
|
||||||
<field name="padding">5</field>
|
<field name="suffix">%(sec)s</field>
|
||||||
|
<field name="padding">4</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record model="ir.sequence" id="seq_pms_checkin">
|
<record model="ir.sequence" id="seq_pms_checkin">
|
||||||
<field name="name">PMS Checkin</field>
|
<field name="name">PMS Checkin</field>
|
||||||
<field name="code">pms.checkin.partner</field>
|
<field name="code">pms.checkin.partner</field>
|
||||||
<field name="prefix">C/</field>
|
<field name="prefix">C/%(y)s</field>
|
||||||
<field name="padding">5</field>
|
<field name="suffix">%(sec)s</field>
|
||||||
|
<field name="padding">4</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import time
|
|||||||
|
|
||||||
from odoo import _, api, fields, models
|
from odoo import _, api, fields, models
|
||||||
from odoo.exceptions import UserError, ValidationError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, float_compare, float_is_zero
|
from odoo.tools import float_compare, float_is_zero
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -58,10 +58,8 @@ class PmsReservation(models.Model):
|
|||||||
# Fields declaration
|
# Fields declaration
|
||||||
name = fields.Text(
|
name = fields.Text(
|
||||||
"Reservation Description",
|
"Reservation Description",
|
||||||
compute="_compute_name",
|
|
||||||
store=True,
|
|
||||||
readonly=False,
|
readonly=False,
|
||||||
# required=True,
|
required=True,
|
||||||
)
|
)
|
||||||
priority = fields.Integer(compute="_compute_priority", store="True", index=True)
|
priority = fields.Integer(compute="_compute_priority", store="True", index=True)
|
||||||
|
|
||||||
@@ -485,26 +483,6 @@ class PmsReservation(models.Model):
|
|||||||
for record in self:
|
for record in self:
|
||||||
record.date_order = datetime.datetime.today()
|
record.date_order = datetime.datetime.today()
|
||||||
|
|
||||||
@api.depends("checkin", "checkout", "room_type_id")
|
|
||||||
def _compute_name(self):
|
|
||||||
for reservation in self:
|
|
||||||
if (
|
|
||||||
reservation.room_type_id
|
|
||||||
and reservation.checkin
|
|
||||||
and reservation.checkout
|
|
||||||
):
|
|
||||||
checkin_str = reservation.checkin.strftime(DEFAULT_SERVER_DATE_FORMAT)
|
|
||||||
checkout_str = reservation.checkout.strftime(DEFAULT_SERVER_DATE_FORMAT)
|
|
||||||
reservation.name = (
|
|
||||||
reservation.room_type_id.name
|
|
||||||
+ ": "
|
|
||||||
+ checkin_str
|
|
||||||
+ " - "
|
|
||||||
+ checkout_str
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
reservation.name = "/"
|
|
||||||
|
|
||||||
@api.depends("checkin")
|
@api.depends("checkin")
|
||||||
def _compute_priority(self):
|
def _compute_priority(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
|
|||||||
Reference in New Issue
Block a user