mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] compute localizator
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
import time
|
||||
from datetime import timedelta
|
||||
import readline
|
||||
import re
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import (
|
||||
float_is_zero,
|
||||
@@ -159,14 +159,14 @@ class HotelReservation(models.Model):
|
||||
@api.depends('folio_id', 'checkin', 'checkout')
|
||||
def _compute_localizator(self):
|
||||
for record in self:
|
||||
localizator = str(record.folio_id.name)
|
||||
checkout = int(re.sub("\D", "", record.checkout))
|
||||
checkin = int(re.sub("\D", "", record.checkin))
|
||||
localizator += '-' + (checkin + checkout) % 777
|
||||
localizator = re.sub("[^0-9]", "", record.folio_id.name)
|
||||
checkout = int(re.sub("[^0-9]", "", record.checkout))
|
||||
checkin = int(re.sub("[^0-9]", "", record.checkin))
|
||||
localizator += str((checkin + checkout) % 99)
|
||||
record.localizator = localizator
|
||||
|
||||
localizator = fields.Char('Localizator', compute='_compute_localizator',
|
||||
strore=True)
|
||||
store=True)
|
||||
name = fields.Text('Reservation Description', required=True)
|
||||
sequence = fields.Integer(string='Sequence', default=10)
|
||||
|
||||
|
||||
@@ -143,7 +143,6 @@
|
||||
<span class="label label-danger" attrs="{'invisible': [('state', 'not in', ('cancelled'))]}">Cancelled Reservation!</span>
|
||||
<span class="label label-warning" attrs="{'invisible': [('overbooking', '=', False)]}">OverBooking!</span>
|
||||
<h1>
|
||||
<field name="localizator" />
|
||||
<field name="room_id" select="1"
|
||||
nolabel="1" options="{'no_create': True,'no_open': True}" placeholder="Room"
|
||||
style="margin-right: 30px;" required='1'/>
|
||||
@@ -349,6 +348,7 @@
|
||||
</page>
|
||||
<page name="others" string="Others">
|
||||
<group>
|
||||
<field name="localizator" />
|
||||
<field name="overbooking" />
|
||||
</group>
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user