mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
Merge branch 'pr_workflow_sales' into 11.0
This commit is contained in:
486
hotel/i18n/es.po
486
hotel/i18n/es.po
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,8 @@
|
||||
import datetime
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tools import (
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
|
||||
class HotelCheckinPartner(models.Model):
|
||||
@@ -56,6 +58,15 @@ class HotelCheckinPartner(models.Model):
|
||||
return reservation.partner_id
|
||||
return False
|
||||
|
||||
def _default_to_enter(self):
|
||||
tz_hotel = self.env['ir.default'].sudo().get(
|
||||
'res.config.settings', 'tz_hotel')
|
||||
today = fields.Date.context_today(self.with_context(tz=tz_hotel))
|
||||
today_str = fields.Date.from_string(today).strftime(
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
if self._default_enter_date() == today_str:
|
||||
return True
|
||||
return False
|
||||
|
||||
partner_id = fields.Many2one('res.partner', default=_default_partner_id,
|
||||
required=True)
|
||||
@@ -64,9 +75,11 @@ class HotelCheckinPartner(models.Model):
|
||||
reservation_id = fields.Many2one(
|
||||
'hotel.reservation', default=_default_reservation_id)
|
||||
folio_id = fields.Many2one('hotel.folio',
|
||||
default=_default_folio_id, readonly=True, required=True)
|
||||
default=_default_folio_id,
|
||||
readonly=True, required=True)
|
||||
enter_date = fields.Date(default=_default_enter_date, required=True)
|
||||
exit_date = fields.Date(default=_default_exit_date, required=True)
|
||||
auto_booking = fields.Boolean('Get in Now', default=_default_to_enter)
|
||||
state = fields.Selection([('draft', 'Pending Entry'),
|
||||
('booking', 'On Board'),
|
||||
('done', 'Out'),
|
||||
@@ -74,11 +87,17 @@ class HotelCheckinPartner(models.Model):
|
||||
'State', readonly=True,
|
||||
default=lambda *a: 'draft',
|
||||
track_visibility='onchange')
|
||||
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
record = super(HotelCheckinPartner, self).create(vals)
|
||||
if vals.get('auto_booking', False):
|
||||
record.action_on_board()
|
||||
return record
|
||||
|
||||
# Validation for Departure date is after arrival date.
|
||||
@api.multi
|
||||
@api.constrains('exit_date','enter_date')
|
||||
@api.constrains('exit_date', 'enter_date')
|
||||
def _check_exit_date(self):
|
||||
for record in self:
|
||||
date_in = fields.Date.from_string(record.enter_date)
|
||||
@@ -104,8 +123,8 @@ class HotelCheckinPartner(models.Model):
|
||||
def _check_partner_id(self):
|
||||
for record in self:
|
||||
checkins = self.env['hotel.checkin.partner'].search([
|
||||
('id','!=', record.id),
|
||||
('reservation_id','=', record.reservation_id.id)
|
||||
('id', '!=', record.id),
|
||||
('reservation_id', '=', record.reservation_id.id)
|
||||
])
|
||||
if record.partner_id.id in checkins.mapped('partner_id.id'):
|
||||
raise models.ValidationError(
|
||||
@@ -116,8 +135,8 @@ class HotelCheckinPartner(models.Model):
|
||||
def _check_partner_id(self):
|
||||
for record in self:
|
||||
checkins = self.env['hotel.checkin.partner'].search([
|
||||
('id','!=', record.id),
|
||||
('reservation_id','=', record.reservation_id.id)
|
||||
('id', '!=', record.id),
|
||||
('reservation_id', '=', record.reservation_id.id)
|
||||
])
|
||||
if record.partner_id.id in checkins.mapped('partner_id.id'):
|
||||
raise models.ValidationError(
|
||||
|
||||
@@ -176,6 +176,7 @@ class HotelFolio(models.Model):
|
||||
return_ids = fields.One2many('payment.return', 'folio_id',
|
||||
readonly=True)
|
||||
payment_term_id = fields.Many2one('account.payment.term', string='Payment Terms', oldname='payment_term')
|
||||
credit_card_details = fields.Text('Credit Card Details')
|
||||
|
||||
#Amount Fields------------------------------------------------------
|
||||
pending_amount = fields.Monetary(compute='compute_amount',
|
||||
|
||||
@@ -369,9 +369,8 @@ class HotelReservation(models.Model):
|
||||
vals['real_checkin'] = vals['checkin']
|
||||
vals['real_checkout'] = vals['checkout']
|
||||
record = super(HotelReservation, self).create(vals)
|
||||
#~ if (record.state == 'draft' and record.folio_id.state == 'sale') or \
|
||||
#~ record.preconfirm:
|
||||
#~ record.confirm()
|
||||
if record.preconfirm:
|
||||
record.confirm()
|
||||
return record
|
||||
|
||||
@api.multi
|
||||
@@ -688,11 +687,16 @@ class HotelReservation(models.Model):
|
||||
(fields.Date.from_string(self.checkout) - timedelta(days=1)).
|
||||
strftime(DEFAULT_SERVER_DATE_FORMAT))
|
||||
rooms_occupied = occupied.mapped('room_id.id')
|
||||
if self.room_id and self.room_id.id in rooms_occupied:
|
||||
warning_msg = _('You tried to change \
|
||||
if self.room_id:
|
||||
occupied = occupied.filtered(
|
||||
lambda r: r.room_id.id == self.room_id.id
|
||||
and r.id != self._origin.id)
|
||||
if occupied:
|
||||
occupied_name = ', '.join(str(x.folio_id.name) for x in occupied)
|
||||
warning_msg = _('You tried to change/confirm \
|
||||
reservation with room those already reserved in this \
|
||||
reservation period')
|
||||
raise ValidationError(warning_msg)
|
||||
reservation period: %s ') % occupied_name
|
||||
raise ValidationError(warning_msg)
|
||||
domain_rooms = [
|
||||
('id', 'not in', rooms_occupied)
|
||||
]
|
||||
@@ -700,7 +704,7 @@ class HotelReservation(models.Model):
|
||||
|
||||
@api.onchange('partner_diff_invoicing')
|
||||
def onchange_partner_diff_invoicing(self):
|
||||
if self.partner_diff_invoicing == False:
|
||||
if self.partner_diff_invoicing is False:
|
||||
self.update({'partner_invoice_id': self.partner_id.id})
|
||||
elif self.partner_id == self.partner_invoice_id:
|
||||
self.update({'partner_invoice_id': self.partner_id.address_get(['invoice'])['invoice'] or None})
|
||||
@@ -873,12 +877,15 @@ class HotelReservation(models.Model):
|
||||
@api.model
|
||||
def prepare_reservation_lines(self, dfrom, days, pricelist_id, vals=False, update_old_prices=False):
|
||||
total_price = 0.0
|
||||
discount = 0
|
||||
cmds = [(5, 0, 0)]
|
||||
if not vals:
|
||||
vals = {}
|
||||
room_type_id = vals.get('room_type_id') or self.room_type_id.id
|
||||
product = self.env['hotel.room.type'].browse(room_type_id).product_id
|
||||
partner = self.env['res.partner'].browse(vals.get('partner_id') or self.partner_id.id)
|
||||
if 'discount' in vals and vals.get('discount') > 0:
|
||||
discount = vals.get('discount')
|
||||
for i in range(0, days):
|
||||
idate = (fields.Date.from_string(dfrom) + timedelta(days=i)).strftime(
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
@@ -891,16 +898,18 @@ class HotelReservation(models.Model):
|
||||
date=idate,
|
||||
pricelist=pricelist_id,
|
||||
uom=product.uom_id.id)
|
||||
line_price = self.env['account.tax']._fix_tax_included_price_company(
|
||||
product.price, product.taxes_id, self.tax_ids, self.company_id)
|
||||
# REVIEW this forces to have configured the taxes included in the price
|
||||
line_price = product.price
|
||||
if old_line and old_line.id:
|
||||
cmds.append((1, old_line.id, {
|
||||
'price': line_price
|
||||
'price': line_price,
|
||||
'discount': discount
|
||||
}))
|
||||
else:
|
||||
cmds.append((0, False, {
|
||||
'date': idate,
|
||||
'price': line_price
|
||||
'price': line_price,
|
||||
'discount': discount
|
||||
}))
|
||||
else:
|
||||
line_price = old_line.price
|
||||
@@ -1008,7 +1017,7 @@ class HotelReservation(models.Model):
|
||||
occupied = occupied.filtered(
|
||||
lambda r: r.room_id.id == self.room_id.id
|
||||
and r.id != self.id)
|
||||
occupied_name = ','.join(str(x.room_id.name) for x in occupied)
|
||||
occupied_name = ', '.join(str(x.folio_id.name) for x in occupied)
|
||||
if occupied:
|
||||
warning_msg = _('You tried to change/confirm \
|
||||
reservation with room those already reserved in this \
|
||||
|
||||
@@ -21,4 +21,3 @@ class AccountInvoiceLine(models.Model):
|
||||
'reservation_line_invoice_rel',
|
||||
'invoice_line_id', 'reservation_line_id',
|
||||
string='Reservation Lines', readonly=True, copy=False)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
name="Action checkin"
|
||||
res_model="hotel.checkin.partner"
|
||||
view_mode="tree,form" />
|
||||
|
||||
|
||||
<menuitem
|
||||
id="menu_hotel_checkin_partner"
|
||||
name="Checkins"
|
||||
@@ -47,9 +47,12 @@
|
||||
<button type="object" class="oe_stat_button"
|
||||
icon="fa fa-2x fa-check-circle"
|
||||
name="action_on_board"
|
||||
attrs="{'invisible':[('state','not in', ['draft'])]}"
|
||||
help="Get in"
|
||||
attrs="{'invisible':['|',
|
||||
('state','not in', ['draft']),
|
||||
('id','=',False)]}"
|
||||
help="Get in"
|
||||
/>
|
||||
<field name="auto_booking" attrs="{'invisible':[('id','!=',False)]}" />
|
||||
<field name="partner_id" required="True"/>
|
||||
<field name="mobile"/>
|
||||
<field name="email"/>
|
||||
@@ -75,7 +78,7 @@
|
||||
icon="fa fa-2x fa-check-circle"
|
||||
name="action_on_board"
|
||||
attrs="{'invisible':[('state','not in', ['draft'])]}"
|
||||
help="Get in"
|
||||
help="Get in"
|
||||
/>
|
||||
<field name="partner_id" required="True"/>
|
||||
<field name="mobile"/>
|
||||
@@ -108,7 +111,7 @@
|
||||
<filter string="Checkins Tomorrow" name="enter_tomorrow"
|
||||
domain="[('enter_date', '=', (context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d')),
|
||||
('state', '=', 'confirm')]"
|
||||
help="Show all checkins for enter tomorrow"/>
|
||||
help="Show all checkins for enter tomorrow"/>
|
||||
<filter string="Checkins to 7 days" name="next_res_week"
|
||||
domain="[('enter_date', '<', (context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d')),
|
||||
('state', '=', 'confirm')]"
|
||||
|
||||
@@ -93,6 +93,7 @@
|
||||
</group>
|
||||
<group>
|
||||
<field name="internal_comment"/>
|
||||
<field name="credit_card_details" attrs="{'invisible':[('pending_amount','<=',0)]}"/>
|
||||
</group>
|
||||
<group colspan="2" class="oe_subtotal_footer oe_right">
|
||||
<field name="amount_untaxed" sum="Untaxed amount" widget='monetary' />
|
||||
|
||||
@@ -60,13 +60,6 @@
|
||||
icon="fa-compress"
|
||||
attrs="{'invisible':[('splitted', '=', False)]}"
|
||||
/>
|
||||
<label for="preconfirm"
|
||||
string="Autoconfirm"
|
||||
attrs="{'invisible':[('folio_id', '!=', False)]}"
|
||||
/>
|
||||
<span name="preconfirm" attrs="{'invisible':[('folio_id', '!=', False)]}">
|
||||
<field name="preconfirm" />
|
||||
</span>
|
||||
<button name="open_master" string="Open Master" type="object" class="oe_highlight" icon="fa-file" attrs="{'invisible':['|',['parent_reservation', '=', False]]}" />
|
||||
<field name="state" widget="statusbar"/>
|
||||
|
||||
@@ -148,10 +141,13 @@
|
||||
<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="edit_room" nolabel="1" class="fa fa-bed" /> -->
|
||||
<!-- <field name="room_id" select="1" domain="[('isroom','=',True)]"
|
||||
nolabel="1" options="{'no_create': True,'no_open': True}" placeholder="Room"
|
||||
style="margin-right: 30px;"/> -->
|
||||
<label for="preconfirm"
|
||||
string="Autoconfirm"
|
||||
attrs="{'invisible':[('folio_id', '!=', False)]}"
|
||||
/>
|
||||
<span name="preconfirm" attrs="{'invisible':[('folio_id', '!=', False)]}">
|
||||
<field name="preconfirm" />
|
||||
</span>
|
||||
<field name="room_id" select="1"
|
||||
nolabel="1" options="{'no_create': True,'no_open': True}" placeholder="Room"
|
||||
style="margin-right: 30px;" required='1'/>
|
||||
@@ -187,7 +183,10 @@
|
||||
<field name="mobile" placeholder="mobile" widget="phone"
|
||||
attrs="{'invisible': [('reservation_type','in',('out'))]}"/>
|
||||
<field name="phone" placeholder="phone" widget="phone"
|
||||
attrs="{'invisible': [('reservation_type','in',('out'))]}"/>
|
||||
attrs="{'invisible': [('reservation_type','in',('out'))],
|
||||
'required': [('channel_type','in',('door','mail','phone')),
|
||||
('mobile','=','')]}"
|
||||
/>
|
||||
<field name="pricelist_id"
|
||||
attrs="{'invisible': [('reservation_type','in',('out'))]}"/>
|
||||
<field name="partner_internal_comment" string="Partner Note"
|
||||
@@ -445,7 +444,7 @@
|
||||
/>
|
||||
<field name="folio_id"/>
|
||||
<button type="object" class="oe_stat_button"
|
||||
icon="fa fa-1x fa-user-plus"
|
||||
icon="fa fa-2x fa-user-plus"
|
||||
name="action_checks"
|
||||
context="{'partner_id': partner_id,'enter_date': checkin,
|
||||
'exit_date': checkout,'reservation_id': id, 'hidden_checkin_partner': True, 'edit_checkin_partner': True }"
|
||||
@@ -497,6 +496,12 @@
|
||||
<attribute name="delete">false</attribute>
|
||||
<attribute name="string">Rooms</attribute>
|
||||
</tree>
|
||||
<xpath expr="//field[@name='state']" position="before">
|
||||
<button type="object" class="oe_stat_button"
|
||||
icon="fa fa-2x fa-suitcase"
|
||||
name="open_reservation_form"
|
||||
help="Open Reservation Room Detail"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='folio_id']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
@@ -506,9 +511,6 @@
|
||||
<xpath expr="//button[@name='open_folio'][2]" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='open_folio'][2]" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='%(open_hotel_reservation_form_tree_all)d']" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
@@ -521,6 +523,12 @@
|
||||
<xpath expr="//field[@name='create_uid']" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='create_date']" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='last_updated_res']" position="attributes">
|
||||
<attribute name="invisible">True</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<xpath expr="//field[@name='communication']" position="after">
|
||||
<field name="folio_id"/>
|
||||
<field name="save_amount" invisible="1"/>
|
||||
<field name="save_journal" invisible="1"/>
|
||||
<field name="save_journal_id" invisible="1"/>
|
||||
<field name="save_date" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -49,11 +49,26 @@ class FolioWizard(models.TransientModel):
|
||||
if user.has_group('hotel.group_hotel_call'):
|
||||
return 'phone'
|
||||
|
||||
partner_id = fields.Many2one('res.partner',string="Customer")
|
||||
@api.model
|
||||
def _get_default_pricelist(self):
|
||||
return self.env['ir.default'].sudo().get(
|
||||
'res.config.settings', 'default_pricelist_id')
|
||||
|
||||
partner_id = fields.Many2one('res.partner', required=True, string="Customer")
|
||||
email = fields.Char('E-mail')
|
||||
mobile = fields.Char('Mobile')
|
||||
|
||||
pricelist_id = fields.Many2one('product.pricelist',
|
||||
string='Pricelist',
|
||||
required=True,
|
||||
default=_get_default_pricelist,
|
||||
help="Pricelist for current folio.")
|
||||
checkin = fields.Date('Check In', required=True,
|
||||
default=_get_default_checkin)
|
||||
checkout = fields.Date('Check Out', required=True,
|
||||
default=_get_default_checkout)
|
||||
credit_card_details = fields.Text('Credit Card Details')
|
||||
internal_comment = fields.Text(string='Internal Folio Notes')
|
||||
reservation_wizard_ids = fields.One2many('hotel.reservation.wizard',
|
||||
'folio_wizard_id',
|
||||
string="Resevations")
|
||||
@@ -68,13 +83,28 @@ class FolioWizard(models.TransientModel):
|
||||
('mail', 'Mail'),
|
||||
('phone', 'Phone')
|
||||
], string='Sales Channel', default=_get_default_channel_type)
|
||||
room_type_wizard_ids = fields.Many2many('hotel.room.type.wizard',
|
||||
string="Room Types")
|
||||
room_type_wizard_ids = fields.One2many('hotel.room.type.wizard',
|
||||
'folio_wizard_id',
|
||||
string="Room Types")
|
||||
call_center = fields.Boolean(default=_get_default_center_user)
|
||||
|
||||
def assign_rooms(self):
|
||||
self.assign = True
|
||||
|
||||
@api.onchange('pricelist_id')
|
||||
def onchange_pricelist_id(self):
|
||||
if self.pricelist_id:
|
||||
self.onchange_checks()
|
||||
|
||||
@api.onchange('partner_id')
|
||||
def onchange_partner_id(self):
|
||||
if self.partner_id:
|
||||
pricelist = self.partner_id.property_product_pricelist and \
|
||||
self.partner_id.property_product_pricelist.id or \
|
||||
self.env['ir.default'].sudo().get(
|
||||
'res.config.settings', 'default_pricelist_id')
|
||||
self.pricelist_id = pricelist
|
||||
|
||||
@api.onchange('autoassign')
|
||||
def create_reservations(self):
|
||||
self.ensure_one()
|
||||
@@ -103,10 +133,7 @@ class FolioWizard(models.TransientModel):
|
||||
checkout_dt = fields.Date.from_string(line.checkout)
|
||||
nights = abs((checkout_dt - checkin_dt).days)
|
||||
for room in room_list:
|
||||
pricelist_id = self.env['ir.default'].sudo().get(
|
||||
'res.config.settings', 'default_pricelist_id')
|
||||
if pricelist_id:
|
||||
pricelist_id = int(pricelist_id)
|
||||
pricelist_id = self.pricelist_id.id
|
||||
res_price = 0
|
||||
for i in range(0, nights):
|
||||
ndate = checkin_dt + timedelta(days=i)
|
||||
@@ -224,6 +251,10 @@ class FolioWizard(models.TransientModel):
|
||||
'channel_type': self.channel_type,
|
||||
'room_lines': reservations,
|
||||
'service_lines': services,
|
||||
'internal_comment': self.internal_comment,
|
||||
'credit_card_details': self.credit_card_details,
|
||||
'email': self.email,
|
||||
'mobile': self.mobile,
|
||||
}
|
||||
newfol = self.env['hotel.folio'].create(vals)
|
||||
if self.confirm:
|
||||
@@ -263,6 +294,22 @@ class HotelRoomTypeWizards(models.TransientModel):
|
||||
checkout = fields.Date('Check Out', required=True,
|
||||
default=_get_default_checkout)
|
||||
can_confirm = fields.Boolean(compute="_can_confirm")
|
||||
board_service_room_id = fields.Many2one('hotel.board.service.room.type',
|
||||
string="Board Service")
|
||||
|
||||
@api.multi
|
||||
@api.onchange('rooms_num')
|
||||
def domain_board_service(self):
|
||||
for line in self:
|
||||
board_service_room_ids = []
|
||||
if line.room_type_id:
|
||||
pricelist_id = self.folio_wizard_id.pricelist_id.id
|
||||
board_services_room_type = self.env['hotel.board.service.room.type'].\
|
||||
search([('hotel_room_type_id', '=', self.room_type_id.id),
|
||||
('pricelist_id', 'in', (pricelist_id, False))])
|
||||
board_service_room_ids = board_services_room_type.ids
|
||||
domain_boardservice = [('id', 'in', board_service_room_ids)]
|
||||
return {'domain': {'board_service_room_id': domain_boardservice}}
|
||||
|
||||
@api.multi
|
||||
def _can_confirm(self):
|
||||
@@ -281,9 +328,6 @@ class HotelRoomTypeWizards(models.TransientModel):
|
||||
minstay_restrictions = self.env['hotel.room.type.restriction.item'].search([
|
||||
('room_type_id', '=', res.room_type_id.id),
|
||||
])
|
||||
avail_restrictions = self.env['hotel.room.type.availability'].search([
|
||||
('room_type_id', '=', res.room_type_id.id)
|
||||
])
|
||||
real_max = len(res.room_type_id.check_availability_room_type(
|
||||
res.checkin,
|
||||
res.checkout,
|
||||
@@ -297,20 +341,12 @@ class HotelRoomTypeWizards(models.TransientModel):
|
||||
dates.append(ndate_str)
|
||||
if minstay_restrictions:
|
||||
date_min_days = minstay_restrictions.filtered(
|
||||
lambda r: r.date_start <= ndate_str and \
|
||||
r.date_end >= ndate_str).min_stay
|
||||
lambda r: r.date == ndate_str).min_stay
|
||||
if date_min_days > min_stay:
|
||||
min_stay = date_min_days
|
||||
if user.has_group('hotel.group_hotel_call'):
|
||||
if avail_restrictions:
|
||||
max_avail = avail_restrictions.filtered(
|
||||
lambda r: r.date == ndate_str).wmax_avail
|
||||
if max_avail < avail:
|
||||
avail = min(max_avail, real_max)
|
||||
else:
|
||||
avail = real_max
|
||||
|
||||
|
||||
if 100000 > avail > 0:
|
||||
res.max_rooms = avail
|
||||
else:
|
||||
@@ -330,12 +366,7 @@ class HotelRoomTypeWizards(models.TransientModel):
|
||||
if chkin_utc_dt >= chkout_utc_dt:
|
||||
chkout_utc_dt = chkin_utc_dt + timedelta(days=1)
|
||||
nights = abs((chkout_utc_dt - chkin_utc_dt).days)
|
||||
|
||||
pricelist_id = self.env['ir.default'].sudo().get(
|
||||
'res.config.settings', 'default_pricelist_id')
|
||||
if pricelist_id:
|
||||
pricelist_id = int(pricelist_id)
|
||||
|
||||
pricelist_id = self.folio_wizard_id.pricelist_id.id
|
||||
res_price = 0
|
||||
for i in range(0, nights):
|
||||
ndate = chkin_utc_dt + timedelta(days=i)
|
||||
@@ -347,8 +378,7 @@ class HotelRoomTypeWizards(models.TransientModel):
|
||||
date=ndate_str,
|
||||
pricelist=pricelist_id,
|
||||
uom=record.room_type_id.product_id.uom_id.id)
|
||||
res_price += self.env['account.tax']._fix_tax_included_price_company(
|
||||
product.price, product.taxes_id, product.taxes_id, self.env.user.company_id)
|
||||
res_price += product.price
|
||||
|
||||
price = res_price - ((res_price * record.discount) * 0.01)
|
||||
total_price = record.rooms_num * price
|
||||
@@ -427,10 +457,7 @@ class ReservationWizard(models.TransientModel):
|
||||
end_date_utc_dt = fields.Date.from_string(line.checkout)
|
||||
|
||||
if line.room_type_id:
|
||||
pricelist_id = self.env['ir.default'].sudo().get(
|
||||
'res.config.settings', 'default_pricelist_id')
|
||||
if pricelist_id:
|
||||
pricelist_id = int(pricelist_id)
|
||||
pricelist_id = self.folio_wizard_id.pricelist_id.id
|
||||
nights = abs((end_date_utc_dt - start_date_utc_dt).days)
|
||||
res_price = 0
|
||||
for i in range(0, nights):
|
||||
@@ -443,8 +470,7 @@ class ReservationWizard(models.TransientModel):
|
||||
date=ndate_str,
|
||||
pricelist=pricelist_id,
|
||||
uom=line.room_type_id.product_id.uom_id.id)
|
||||
res_price += self.env['account.tax']._fix_tax_included_price_company(
|
||||
product.price, product.taxes_id, product.taxes_id, self.env.user.company_id)
|
||||
res_price += product.price
|
||||
res_price = res_price - (res_price * self.discount) * 0.01
|
||||
line.amount_reservation = res_price
|
||||
line.price = res_price
|
||||
@@ -469,79 +495,24 @@ class ServiceWizard(models.TransientModel):
|
||||
default=0.0)
|
||||
price_total = fields.Float(compute='_compute_amount', string='Subtotal',
|
||||
readonly=True, store=True)
|
||||
reservation_wizard_ids = fields.Many2many('hotel.reservation.wizard', 'Rooms')
|
||||
product_uom_qty = fields.Float(string='Quantity',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
required=True,
|
||||
default=1.0)
|
||||
|
||||
@api.onchange('product_id', 'reservation_wizard_ids')
|
||||
@api.onchange('product_id')
|
||||
def onchange_product_id(self):
|
||||
if self.product_id:
|
||||
vals = {}
|
||||
qty = 0
|
||||
vals['product_uom_qty'] = 1.0
|
||||
service_obj = self.env['hotel.service']
|
||||
if self.product_id.per_day:
|
||||
product = self.product_id
|
||||
for room in self.reservation_wizard_ids:
|
||||
lines = {}
|
||||
lines.update(service_obj.prepare_service_lines(
|
||||
dfrom=room.checkin,
|
||||
days=room.nights,
|
||||
per_person=product.per_person,
|
||||
persons=room.adults))
|
||||
qty += lines.get('service_line_ids')[1][2]['day_qty']
|
||||
if self.product_id.daily_limit > 0:
|
||||
limit = self.product_id.daily_limit
|
||||
for day in self.service_line_ids:
|
||||
out_qty = sum(self.env['hotel.service.line'].search([
|
||||
('product_id', '=', self.product_id.id),
|
||||
('date', '=', self.date),
|
||||
('service_id', '!=', self.product_id.id)
|
||||
]).mapped('day_qty'))
|
||||
if limit < out_qty + self.day_qty:
|
||||
raise ValidationError(
|
||||
_("%s limit exceeded for %s")% (self.service_id.product_id.name,
|
||||
self.date))
|
||||
vals['product_uom_qty'] = qty
|
||||
"""
|
||||
Description and warnings
|
||||
"""
|
||||
product = self.product_id.with_context(
|
||||
lang=self.folio_wizard_id.partner_id.lang,
|
||||
partner=self.folio_wizard_id.partner_id.id
|
||||
)
|
||||
title = False
|
||||
message = False
|
||||
warning = {}
|
||||
if product.sale_line_warn != 'no-message':
|
||||
title = _("Warning for %s") % product.name
|
||||
message = product.sale_line_warn_msg
|
||||
warning['title'] = title
|
||||
warning['message'] = message
|
||||
result = {'warning': warning}
|
||||
if product.sale_line_warn == 'block':
|
||||
self.product_id = False
|
||||
return result
|
||||
"""
|
||||
Compute tax and price unit
|
||||
"""
|
||||
#REVIEW: self._compute_tax_ids()
|
||||
# TODO change pricelist for partner
|
||||
pricelist_id = self.env['ir.default'].sudo().get(
|
||||
'res.config.settings', 'default_pricelist_id')
|
||||
product = self.product_id.with_context(
|
||||
lang=self.folio_wizard_id.partner_id.lang,
|
||||
partner=self.folio_wizard_id.partner_id.id,
|
||||
quantity=1,
|
||||
date=fields.Datetime.now(),
|
||||
pricelist=pricelist_id,
|
||||
uom=product.uom_id.id)
|
||||
vals['price_unit'] = self.env['account.tax']._fix_tax_included_price_company(
|
||||
product.price, product.taxes_id, product.taxes_id, self.env.user.company_id)
|
||||
import wdb; wdb.set_trace()
|
||||
self.update(vals)
|
||||
pricelist_id = self.folio_wizard_id.pricelist_id.id
|
||||
prod = self.product_id.with_context(
|
||||
lang=self.folio_wizard_id.partner_id.lang,
|
||||
partner=self.folio_wizard_id.partner_id.id,
|
||||
quantity=1,
|
||||
date=fields.Datetime.now(),
|
||||
pricelist=pricelist_id,
|
||||
uom=self.product_id.uom_id.id)
|
||||
self.price_unit = prod.price
|
||||
|
||||
@api.depends('price_unit', 'product_uom_qty', 'discount')
|
||||
def _compute_amount(self):
|
||||
|
||||
@@ -11,11 +11,16 @@
|
||||
<group>
|
||||
<field name="checkin" required="1" />
|
||||
<field name="checkout" required="1" />
|
||||
<field name="partner_id"/>
|
||||
<field name="mobile" required="1"/>
|
||||
<field name="email" required="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="call_center" invisible="1" />
|
||||
<field name="channel_type" required="1" attrs="{'readonly':[('call_center','=',True)]}"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="channel_type" required="1" force_save="1" attrs="{'readonly':[('call_center','=',True)]}"/>
|
||||
<field name="pricelist_id"/>
|
||||
<field name="internal_comment"/>
|
||||
<field name="credit_card_details" />
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
@@ -27,13 +32,17 @@
|
||||
decoration-success="max_rooms >= rooms_num and rooms_num > 0">
|
||||
<field name="min_stay" />
|
||||
<field name="max_rooms" />
|
||||
<field name="room_type_id" string="Room Type" readonly="1"/>
|
||||
<field name="rooms_num" attrs="{'readonly': [('can_confirm','=',False)]}" />
|
||||
<field name="folio_wizard_id" />
|
||||
<field name="room_type_id" string="Room Type" force_save="1" readonly="1"/>
|
||||
<field name="rooms_num" force_save="1" attrs="{'readonly': [('can_confirm', '=', False)]}" />
|
||||
<field name="board_service_room_id"
|
||||
attrs="{'readonly': [('rooms_num', '=', 0)]}"
|
||||
options="{'no_create': True,'no_open': True}" />
|
||||
<field name="checkin" widget="date" />
|
||||
<field name="checkout" widget="date" />
|
||||
<field name="discount" attrs="{'readonly': [('can_confirm','=',False)]}"/>
|
||||
<field name="price" attrs="{'readonly': [('can_confirm','=',False)]}"/>
|
||||
<field name="amount_reservation" readonly="1" />
|
||||
<field name="discount" force_save="1" attrs="{'readonly': [('can_confirm','=',False)]}"/>
|
||||
<field name="price" force_save="1" attrs="{'readonly': [('can_confirm','=',False)]}"/>
|
||||
<field name="amount_reservation" force_save="1" readonly="1" />
|
||||
<field name="total_price" invisible="1" />
|
||||
<field name="can_confirm" invisible="1" />
|
||||
</tree>
|
||||
@@ -56,7 +65,7 @@
|
||||
<field name="nights" />
|
||||
<field name="adults" />
|
||||
<field name="children" />
|
||||
<field name="discount" />
|
||||
<field name="discount" />
|
||||
<field name="amount_reservation" />
|
||||
<field name="price" invisible = "1"/>
|
||||
<field name="partner_id" invisible = "1" />
|
||||
@@ -71,13 +80,13 @@
|
||||
nolabel="1" >
|
||||
<tree string="Services" editable="buttom">
|
||||
<field name="product_id" string="Service" options="{'no_create': True}"
|
||||
domain="[('sale_ok', '=', True)]"/>
|
||||
domain="[('sale_ok', '=', True),
|
||||
('per_day', '=', False),
|
||||
('per_person', '=', False)]"/>
|
||||
<field name="folio_wizard_id" invisible = "1" />
|
||||
<field name="product_uom_qty" />
|
||||
<field name="price_unit" />
|
||||
<field name="discount" />
|
||||
<field name="reservation_wizard_ids" widget="many2many_tags"
|
||||
domain="[('folio_wizard_id', '=', folio_wizard_id)]"/>
|
||||
<field name="price_total" />
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -1,111 +1,88 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * hotel_calendar_wubook
|
||||
# * hotel_calendar_channel_connector
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Project-Id-Version: Odoo Server 11.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-05-22 06:41+0000\n"
|
||||
"PO-Revision-Date: 2018-05-22 06:41+0000\n"
|
||||
"POT-Creation-Date: 2019-03-13 21:59+0000\n"
|
||||
"PO-Revision-Date: 2019-03-13 23:01+0100\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
"Language: es\n"
|
||||
"X-Generator: Poedit 1.8.7.1\n"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#: model:ir.actions.act_window,name:hotel_calendar_channel_connector.calendar_channel_connector_issues_action
|
||||
msgid "Channel Connector Issues"
|
||||
msgstr "Aviso de Conexión"
|
||||
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#. openerp-web
|
||||
#: code:addons/hotel_calendar_wubook/static/src/xml/hotel_calendar_templates.xml:10
|
||||
#: code:addons/hotel_calendar_wubook/static/src/xml/hotel_calendar_view.xml:24
|
||||
#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml:30
|
||||
#, python-format
|
||||
msgid "Channel:"
|
||||
msgstr "Canal:"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.view_hotel_toassign_reservation_tree
|
||||
msgid "Final Price"
|
||||
msgstr "Precio Final"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.view_hotel_toassign_reservation_tree
|
||||
msgid "Folio Pending Amount"
|
||||
msgstr "Pendiente en Ficha"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.view_hotel_toassign_reservation_tree
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#: model:ir.model,name:hotel_calendar_channel_connector.model_hotel_reservation
|
||||
msgid "Hotel Reservation"
|
||||
msgstr "Reserva"
|
||||
msgstr "Reserva del hotel"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#. openerp-web
|
||||
#: code:addons/hotel_calendar_wubook/static/src/xml/hotel_calendar_view.xml:15
|
||||
#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml:11
|
||||
#, python-format
|
||||
msgid "ISSUES"
|
||||
msgstr "AVISOS"
|
||||
msgid "Issues"
|
||||
msgstr "Avisos"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.hotel_reservation_view_form
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.view_hotel_toassign_reservation_tree
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_channel_connector.hotel_reservation_view_form
|
||||
msgid "Mark as Read"
|
||||
msgstr "Marcar como leídp"
|
||||
msgstr "Marcar como leído"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: code:addons/hotel_calendar_wubook/models/inherited_wubook_issue.py:33
|
||||
#, python-format
|
||||
msgid "Oops! Issue Reported!!"
|
||||
msgstr "Oops! ¡Aviso generado!"
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#: model:ir.actions.act_window,name:hotel_calendar_channel_connector.hotel_reservation_action_manager_request
|
||||
msgid "Reservations to Assign from Channel"
|
||||
msgstr "Reservas por asignar"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.view_hotel_toassign_reservation_tree
|
||||
msgid "Persons"
|
||||
msgstr "Personas"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.view_hotel_toassign_reservation_tree
|
||||
msgid "Reservation Price"
|
||||
msgstr "Precio de Reserva"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.actions.act_window,name:hotel_calendar_wubook.hotel_reservation_action_manager_request
|
||||
msgid "Reservations to Assign from WuBook"
|
||||
msgstr "Reservas por Asignar desde WuBook"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.view_hotel_toassign_reservation_tree
|
||||
msgid "Reserved Room Type"
|
||||
msgstr "Tipo Habitación Reservada"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.ui.view,arch_db:hotel_calendar_wubook.view_hotel_toassign_reservation_tree
|
||||
msgid "Room"
|
||||
msgstr "Habitación"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#. openerp-web
|
||||
#: code:addons/hotel_calendar_wubook/static/src/xml/hotel_calendar_templates.xml:4
|
||||
#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_templates.xml:4
|
||||
#, python-format
|
||||
msgid "Section:"
|
||||
msgstr "Sección"
|
||||
msgstr "Sección:"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.actions.act_window,name:hotel_calendar_wubook.calendar_wubook_issues_action
|
||||
msgid "WuBook Issues"
|
||||
msgstr "Problemas de WuBook"
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#. openerp-web
|
||||
#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_view.xml:20
|
||||
#, python-format
|
||||
msgid "To Assign"
|
||||
msgstr "Por Asignar"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.model,name:hotel_calendar_wubook.model_bus_hotel_calendar
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#. openerp-web
|
||||
#: code:addons/hotel_calendar_channel_connector/static/src/xml/hotel_calendar_templates.xml:11
|
||||
#, python-format
|
||||
msgid "WuBook:"
|
||||
msgstr "WuBook:"
|
||||
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#: model:ir.model,name:hotel_calendar_channel_connector.model_bus_hotel_calendar
|
||||
msgid "bus.hotel.calendar"
|
||||
msgstr "bus.hotel.calendar"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.model,name:hotel_calendar_wubook.model_hotel_reservation
|
||||
msgid "hotel reservation"
|
||||
msgstr "Reserva"
|
||||
|
||||
#. module: hotel_calendar_wubook
|
||||
#: model:ir.model,name:hotel_calendar_wubook.model_wubook_issue
|
||||
msgid "wubook.issue"
|
||||
msgstr "wubook.issue"
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#: model:ir.model,name:hotel_calendar_channel_connector.model_hotel_calendar_management
|
||||
msgid "hotel.calendar.management"
|
||||
msgstr "hotel.calendar.management"
|
||||
|
||||
#. module: hotel_calendar_channel_connector
|
||||
#: model:ir.model,name:hotel_calendar_channel_connector.model_hotel_room_type_availability
|
||||
msgid "hotel.room.type.availability"
|
||||
msgstr "hotel.room.type.availability"
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -60,8 +60,24 @@ class HotelReservation(models.Model):
|
||||
if user.has_group('hotel.group_hotel_call'):
|
||||
self.write({'to_assign': True})
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< 2076e6f9957b19690791d7ef40bbd5b5c59c96dd
|
||||
return super(HotelReservation, self).action_cancel()
|
||||
|
||||
=======
|
||||
res = super(HotelReservation, self).action_cancel()
|
||||
for record in self:
|
||||
# Only can cancel reservations created directly in wubook
|
||||
for binding in record.channel_bind_ids:
|
||||
if binding.external_id and not binding.ota_id and \
|
||||
int(binding.channel_status) in WUBOOK_STATUS_GOOD:
|
||||
self.sudo().env['channel.hotel.reservation']._event('on_record_cancel').notify(binding)
|
||||
return res
|
||||
>>>>>>> [WIP] Payments Notifications
|
||||
=======
|
||||
return super(HotelReservation, self).action_cancel()
|
||||
|
||||
>>>>>>> 11.0
|
||||
|
||||
@api.multi
|
||||
def confirm(self):
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user