mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[MIG] V13 conventions
This commit is contained in:
@@ -174,7 +174,7 @@ class GlassofExporterWizard(models.TransientModel):
|
||||
else:
|
||||
firstname = inv.partner_id.firstname or ''
|
||||
lastname = inv.partner_id.lastname or ''
|
||||
|
||||
|
||||
worksheet.write(nrow, 0, inv.number)
|
||||
worksheet.write(nrow, 1, inv.date_invoice, xls_cell_format_date)
|
||||
worksheet.write(nrow, 2, '')
|
||||
@@ -209,7 +209,7 @@ class GlassofExporterWizard(models.TransientModel):
|
||||
worksheet.write(nrow, 21, 'S')
|
||||
worksheet.write(nrow, 22, '')
|
||||
if inv.type == 'out_refund':
|
||||
worksheet.write(nrow, 23, inv.origin)
|
||||
worksheet.write(nrow, 23, inv.invoice_origin)
|
||||
else:
|
||||
worksheet.write(nrow, 23, '')
|
||||
worksheet.write(nrow, 24, '')
|
||||
@@ -242,7 +242,7 @@ class GlassofExporterWizard(models.TransientModel):
|
||||
'xls_invoices_binary': base64.encodestring(file_data.read()),
|
||||
}
|
||||
|
||||
|
||||
|
||||
def export(self):
|
||||
towrite = {}
|
||||
if self.export_journals:
|
||||
|
||||
@@ -6,8 +6,6 @@ from odoo.exceptions import UserError
|
||||
from odoo.addons.queue_job.job import job
|
||||
from odoo.addons.component.core import Component
|
||||
from odoo.addons.component_event import skip_if
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class ChannelHotelReservation(models.Model):
|
||||
_name = 'channel.hotel.reservation'
|
||||
@@ -34,7 +32,7 @@ class ChannelHotelReservation(models.Model):
|
||||
default=False)
|
||||
|
||||
channel_total_amount = fields.Monetary(string='Channel Total Amount',
|
||||
readonly=True, digits=dp.get_precision('Product Price'))
|
||||
readonly=True, digits=('Product Price'))
|
||||
|
||||
# Inherit binding constrain becouse two reservations can have
|
||||
# the same external_id
|
||||
@@ -72,20 +70,20 @@ class ChannelHotelReservation(models.Model):
|
||||
return importer.fetch_bookings(dfrom, dto)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
|
||||
|
||||
def cancel_reservation(self):
|
||||
with self.backend_id.work_on(self._name) as work:
|
||||
exporter = work.component(usage='hotel.reservation.exporter')
|
||||
return exporter.cancel_reservation(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
|
||||
|
||||
def mark_booking(self):
|
||||
with self.backend_id.work_on(self._name) as work:
|
||||
exporter = work.component(usage='hotel.reservation.exporter')
|
||||
return exporter.mark_booking(self)
|
||||
|
||||
|
||||
|
||||
def unlink(self):
|
||||
vals = []
|
||||
for record in self:
|
||||
@@ -116,7 +114,7 @@ class ChannelHotelReservation(models.Model):
|
||||
class HotelReservation(models.Model):
|
||||
_inherit = 'hotel.reservation'
|
||||
|
||||
|
||||
|
||||
def _set_access_for_channel_fields(self):
|
||||
for record in self:
|
||||
user = self.env['res.users'].browse(self.env.uid)
|
||||
@@ -215,7 +213,7 @@ class HotelReservation(models.Model):
|
||||
|
||||
return reservation_id
|
||||
|
||||
|
||||
|
||||
def write(self, vals):
|
||||
if self._context.get('connector_no_export', True) and \
|
||||
(vals.get('checkin') or vals.get('checkout') or
|
||||
@@ -267,7 +265,7 @@ class HotelReservation(models.Model):
|
||||
res = super().write(vals)
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def generate_copy_values(self, checkin=False, checkout=False):
|
||||
self.ensure_one()
|
||||
res = super().generate_copy_values(checkin=checkin, checkout=checkout)
|
||||
@@ -282,7 +280,7 @@ class HotelReservation(models.Model):
|
||||
})
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def action_reservation_checkout(self):
|
||||
for record in self:
|
||||
if record.state != 'cancelled':
|
||||
@@ -299,7 +297,7 @@ class HotelReservation(models.Model):
|
||||
|
||||
return (json_reservs, json_tooltips)
|
||||
|
||||
|
||||
|
||||
def mark_as_readed(self):
|
||||
self.write({'to_assign': False})
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
from odoo import api, models, fields, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.addons.queue_job.job import job
|
||||
from odoo.addons.component.core import Component
|
||||
from odoo.addons.component_event import skip_if
|
||||
@@ -45,9 +44,9 @@ class ChannelHotelRoomType(models.Model):
|
||||
"the maximum simultaneous availability and "
|
||||
"the total room count for the given room type.")
|
||||
|
||||
min_price = fields.Float('Min. Price', default=5.0, digits=dp.get_precision('Product Price'),
|
||||
min_price = fields.Float('Min. Price', default=5.0, digits=('Product Price'),
|
||||
help="Setup the min price to prevent incidents while editing your prices.")
|
||||
max_price = fields.Float('Max. Price', default=200.0, digits=dp.get_precision('Product Price'),
|
||||
max_price = fields.Float('Max. Price', default=200.0, digits=('Product Price'),
|
||||
help="Setup the max price to prevent incidents while editing your prices.")
|
||||
|
||||
@api.constrains('default_quota', 'default_max_avail', 'total_rooms_count')
|
||||
@@ -87,7 +86,7 @@ class ChannelHotelRoomType(models.Model):
|
||||
raise ValidationError(_("OTA's capacity can't be greater than room type capacity"))
|
||||
|
||||
|
||||
|
||||
|
||||
@api.constrains('channel_short_code')
|
||||
def _check_channel_short_code(self):
|
||||
for record in self:
|
||||
@@ -95,7 +94,7 @@ class ChannelHotelRoomType(models.Model):
|
||||
raise ValidationError(_("Chanel short code can't be longer than 4 characters"))
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
|
||||
|
||||
def create_room(self):
|
||||
self.ensure_one()
|
||||
if not self.external_id:
|
||||
@@ -104,7 +103,7 @@ class ChannelHotelRoomType(models.Model):
|
||||
exporter.create_room(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
|
||||
|
||||
def modify_room(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -113,7 +112,7 @@ class ChannelHotelRoomType(models.Model):
|
||||
exporter.modify_room(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
|
||||
|
||||
def delete_room(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -145,7 +144,7 @@ class HotelRoomType(models.Model):
|
||||
_("You can not archive a room type with active rooms.") + " " +
|
||||
_("Please, change the %s room(s) to other room type.") % str(record.total_rooms_count))
|
||||
|
||||
|
||||
|
||||
def get_restrictions(self, date, restriction_plan_id):
|
||||
self.ensure_one()
|
||||
restriction = self.env['hotel.room.type.restriction.item'].search([
|
||||
@@ -155,7 +154,7 @@ class HotelRoomType(models.Model):
|
||||
], limit=1)
|
||||
return restriction
|
||||
|
||||
|
||||
|
||||
def open_channel_bind_ids(self):
|
||||
channel_bind_ids = self.mapped('channel_bind_ids')
|
||||
action = self.env.ref('hotel_channel_connector.channel_hotel_room_type_action').read()[0]
|
||||
@@ -176,12 +175,12 @@ class HotelRoomType(models.Model):
|
||||
'default_total_rooms_count': self.total_rooms_count}
|
||||
return action
|
||||
|
||||
|
||||
|
||||
def disconnect_channel_bind_ids(self):
|
||||
# TODO: multichannel rooms is not implemented
|
||||
self.channel_bind_ids.with_context({'connector_no_export': True}).unlink()
|
||||
|
||||
|
||||
|
||||
def write(self, vals):
|
||||
if 'active' in vals and vals.get('active') is False:
|
||||
self.channel_bind_ids.unlink()
|
||||
|
||||
@@ -20,7 +20,9 @@
|
||||
'mail',
|
||||
'account_payment_return',
|
||||
'partner_firstname',
|
||||
'email_template_qweb'
|
||||
'email_template_qweb',
|
||||
'sales_team',
|
||||
'sale'
|
||||
],
|
||||
'data': [
|
||||
'security/pms_security.xml',
|
||||
@@ -75,4 +77,4 @@
|
||||
'qweb': [
|
||||
'static/src/xml/pms_base_templates.xml',
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,17 +3,6 @@
|
||||
|
||||
<data noupdate="0">
|
||||
|
||||
<!-- Scheduler For To Inform Guest About Reservation Before 24 Hours -->
|
||||
<record model="ir.cron" id="Guest_reservation_reminder_24hrs">
|
||||
<field name="name">Inform Guest About Reservation Before 24 Hours</field>
|
||||
<field name="interval_number">1</field>
|
||||
<field name="interval_type">days</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall" eval="False" />
|
||||
<field name="model_id" ref="model_pms_reservation" />
|
||||
<field name="code">model.reservation_reminder_24hrs()</field>
|
||||
</record>
|
||||
|
||||
<!-- Scheduler For To Inform Guest About Reservation Before 24 Hours -->
|
||||
<record model="ir.cron" id="autocheckout_reservations">
|
||||
<field name="name">Automatic Checkout on past reservations</field>
|
||||
@@ -26,7 +15,7 @@
|
||||
<field name="model_id" ref="model_pms_reservation" />
|
||||
<field name="nextcall" eval="(DateTime.now() + timedelta(days=1)).strftime('%Y-%m-%d 05:00:00')"/>
|
||||
<field name="code">model.autocheckout()</field>
|
||||
|
||||
|
||||
</record>
|
||||
|
||||
</data>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<menuitem id="pms_management_menu" name="pms Management"
|
||||
<menuitem id="pms_management_menu" name="PMS Management"
|
||||
sequence="8" web_icon="pms,static/description/icon.png"
|
||||
groups="pms.group_pms_user,pms.group_pms_call"/>
|
||||
|
||||
|
||||
@@ -430,7 +430,7 @@
|
||||
<!-- pms.room.type -->
|
||||
|
||||
<record id="demo_pms_room_type_0" model="pms.room.type">
|
||||
<field name="pms_id" ref="pms.demo_pms_property"/>
|
||||
<field name="pms_property_id" ref="pms.demo_pms_property"/>
|
||||
<field name="name">Economic</field>
|
||||
<field name="code_type">ECO</field>
|
||||
<field name="list_price">21.00</field>
|
||||
@@ -440,7 +440,7 @@
|
||||
|
||||
</record>
|
||||
<record id="demo_pms_room_type_1" model="pms.room.type">
|
||||
<field name="pms_id" ref="pms.demo_pms_property"/>
|
||||
<field name="pms_property_id" ref="pms.demo_pms_property"/>
|
||||
<field name="name">Single</field>
|
||||
<field name="code_type">SNG</field>
|
||||
<field name="list_price">20.00</field>
|
||||
|
||||
@@ -28,6 +28,7 @@ class IrHttp(models.AbstractModel):
|
||||
user.company_id = user.pms_property_id.company_id
|
||||
res['company_id'] = user.pms_property_id.company_id.id
|
||||
else:
|
||||
return res #TODO Review method
|
||||
raise MissingError(
|
||||
_("Wrong property and company access settings for this user. "
|
||||
"Please review property and company for user %s") % user.name)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Copyright 2017 Dario Lodeiros
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import api, models, fields
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class PmsBoardService(models.Model):
|
||||
@@ -9,40 +8,31 @@ class PmsBoardService(models.Model):
|
||||
_description = "Board Services"
|
||||
|
||||
# Fields declaration
|
||||
name = fields.Char(
|
||||
'Board Name',
|
||||
translate=True,
|
||||
size=64,
|
||||
required=True,
|
||||
index=True)
|
||||
name = fields.Char("Board Name", translate=True, size=64, required=True, index=True)
|
||||
board_service_line_ids = fields.One2many(
|
||||
'pms.board.service.line',
|
||||
'pms_board_service_id')
|
||||
"pms.board.service.line", "pms_board_service_id"
|
||||
)
|
||||
pms_property_ids = fields.Many2many(
|
||||
'pms.property',
|
||||
string='Properties',
|
||||
required=False,
|
||||
ondelete='restrict')
|
||||
"pms.property", string="Properties", required=False, ondelete="restrict"
|
||||
)
|
||||
pms_board_service_room_type_ids = fields.One2many(
|
||||
'pms.board.service.room.type',
|
||||
'pms_board_service_id')
|
||||
price_type = fields.Selection([
|
||||
('fixed', 'Fixed'),
|
||||
('percent', 'Percent')],
|
||||
string='Type',
|
||||
default='fixed',
|
||||
required=True)
|
||||
"pms.board.service.room.type", "pms_board_service_id"
|
||||
)
|
||||
price_type = fields.Selection(
|
||||
[("fixed", "Fixed"), ("percent", "Percent")],
|
||||
string="Type",
|
||||
default="fixed",
|
||||
required=True,
|
||||
)
|
||||
amount = fields.Float(
|
||||
'Amount',
|
||||
digits=dp.get_precision('Product Price'),
|
||||
compute='_compute_board_amount',
|
||||
store=True)
|
||||
"Amount", digits=("Product Price"), compute="_compute_board_amount", store=True
|
||||
)
|
||||
|
||||
# Compute and Search methods
|
||||
@api.depends('board_service_line_ids.amount')
|
||||
@api.depends("board_service_line_ids.amount")
|
||||
def _compute_board_amount(self):
|
||||
for record in self:
|
||||
total = 0
|
||||
for service in record.board_service_line_ids:
|
||||
total += service.amount
|
||||
record.update({'amount': total})
|
||||
record.update({"amount": total})
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
# Copyright 2017 Dario Lodeiros
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import api, fields, models
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class PmsBoardServiceLine(models.Model):
|
||||
_name = 'pms.board.service.line'
|
||||
_description = 'Services on Board Service included'
|
||||
_name = "pms.board.service.line"
|
||||
_description = "Services on Board Service included"
|
||||
|
||||
# Default methods
|
||||
def _get_default_price(self):
|
||||
@@ -15,24 +14,18 @@ class PmsBoardServiceLine(models.Model):
|
||||
|
||||
# Fields declaration
|
||||
pms_board_service_id = fields.Many2one(
|
||||
'pms.board.service',
|
||||
'Board Service',
|
||||
ondelete='cascade',
|
||||
required=True)
|
||||
product_id = fields.Many2one(
|
||||
'product.product',
|
||||
string='Product',
|
||||
required=True)
|
||||
"pms.board.service", "Board Service", ondelete="cascade", required=True
|
||||
)
|
||||
product_id = fields.Many2one("product.product", string="Product", required=True)
|
||||
pms_property_ids = fields.Many2many(
|
||||
'pms.property',
|
||||
related='pms_board_service_id.pms_property_ids')
|
||||
"pms.property", related="pms_board_service_id.pms_property_ids"
|
||||
)
|
||||
amount = fields.Float(
|
||||
'Amount',
|
||||
digits=dp.get_precision('Product Price'),
|
||||
default=_get_default_price)
|
||||
"Amount", digits=("Product Price"), default=_get_default_price
|
||||
)
|
||||
|
||||
# Constraints and onchanges
|
||||
@api.onchange('product_id')
|
||||
@api.onchange("product_id")
|
||||
def onchange_product_id(self):
|
||||
if self.product_id:
|
||||
self.update({'amount': self.product_id.list_price})
|
||||
self.update({"amount": self.product_id.list_price})
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Copyright 2017 Dario
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import api, fields, models, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
@@ -13,7 +12,7 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
_description = 'Board Service included in Room'
|
||||
|
||||
# Default Methods ang Gets
|
||||
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for res in self:
|
||||
@@ -58,7 +57,7 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
required=True)
|
||||
amount = fields.Float(
|
||||
'Amount',
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits=('Product Price'),
|
||||
compute='_compute_board_amount',
|
||||
store=True)
|
||||
|
||||
@@ -100,7 +99,7 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
can't repeat without pricelist"))
|
||||
|
||||
# Action methods
|
||||
|
||||
|
||||
def open_board_lines_form(self):
|
||||
action = self.env.ref(
|
||||
'pms.action_pms_board_service_room_type_view').read()[0]
|
||||
@@ -130,7 +129,7 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
)
|
||||
return super(PmsBoardServiceRoomType, self).create(vals)
|
||||
|
||||
|
||||
|
||||
def write(self, vals):
|
||||
if 'pms_board_service_id' in vals:
|
||||
vals.update(
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# Copyright 2017 Dario Lodeiros
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import fields, models
|
||||
from odoo.addons import decimal_precision as dp
|
||||
|
||||
|
||||
class PmsBoardServiceRoomTypeLine(models.Model):
|
||||
_name = 'pms.board.service.room.type.line'
|
||||
@@ -20,5 +18,4 @@ class PmsBoardServiceRoomTypeLine(models.Model):
|
||||
required=True,
|
||||
readonly=True)
|
||||
# TODO def default_amount "amount of service"
|
||||
amount = fields.Float('Amount', digits=dp.get_precision(
|
||||
'Product Price'), default=0.0)
|
||||
amount = fields.Float('Amount', digits=('Product Price'), default=0.0)
|
||||
|
||||
@@ -11,6 +11,7 @@ from odoo.tools import (
|
||||
|
||||
class PmsCheckinPartner(models.Model):
|
||||
_name = 'pms.checkin.partner'
|
||||
_description = 'Partner Checkins'
|
||||
|
||||
# Default Methods ang Gets
|
||||
def _default_reservation_id(self):
|
||||
@@ -111,7 +112,7 @@ class PmsCheckinPartner(models.Model):
|
||||
track_visibility='onchange')
|
||||
|
||||
# Constraints and onchanges
|
||||
|
||||
|
||||
@api.constrains('exit_date', 'enter_date')
|
||||
def _check_exit_date(self):
|
||||
for record in self:
|
||||
@@ -133,7 +134,7 @@ class PmsCheckinPartner(models.Model):
|
||||
_('Departure date, is prior to arrival. Check it now. %s') %
|
||||
date_out)
|
||||
|
||||
|
||||
|
||||
@api.onchange('partner_id')
|
||||
def _check_partner_id(self):
|
||||
for record in self:
|
||||
@@ -152,7 +153,7 @@ class PmsCheckinPartner(models.Model):
|
||||
_('This guest is already registered in the room'))
|
||||
|
||||
# Action methods
|
||||
|
||||
|
||||
def action_on_board(self):
|
||||
for record in self:
|
||||
if record.reservation_id.checkin > fields.Date.today():
|
||||
@@ -185,7 +186,7 @@ class PmsCheckinPartner(models.Model):
|
||||
"type": "ir.actions.do_nothing",
|
||||
}
|
||||
|
||||
|
||||
|
||||
def action_done(self):
|
||||
for record in self:
|
||||
if record.state == 'booking':
|
||||
|
||||
@@ -282,7 +282,7 @@ class PmsFolio(models.Model):
|
||||
move_ids = folio.reservation_ids.mapped('move_line_ids').\
|
||||
mapped('move_id').filtered(lambda r: r.type in [
|
||||
'out_invoice', 'out_refund'])
|
||||
invoice_ids |= folio.service_ids.mapped('move_line_ids').mapped(
|
||||
invoice_ids = folio.service_ids.mapped('move_line_ids').mapped(
|
||||
'move_id').filtered(lambda r: r.type in [
|
||||
'out_invoice', 'out_refund'])
|
||||
# TODO: Search for invoices which have been 'cancelled'
|
||||
@@ -290,7 +290,7 @@ class PmsFolio(models.Model):
|
||||
# use like as origin may contains multiple references
|
||||
# (e.g. 'SO01, SO02')
|
||||
refunds = invoice_ids.search([
|
||||
('origin', 'like', folio.name),
|
||||
('invoice_origin', 'like', folio.name),
|
||||
('company_id', '=', folio.company_id.id)]).filtered(
|
||||
lambda r: r.type in ['out_invoice', 'out_refund'])
|
||||
invoice_ids |= refunds.filtered(
|
||||
@@ -301,8 +301,8 @@ class PmsFolio(models.Model):
|
||||
for inv in invoice_ids:
|
||||
refund_ids += refund_ids.search([
|
||||
('type', '=', 'out_refund'),
|
||||
('origin', '=', inv.number),
|
||||
('origin', '!=', False),
|
||||
('invoice_origin', '=', inv.number),
|
||||
('invoice_origin', '!=', False),
|
||||
('journal_id', '=', inv.journal_id.id)])
|
||||
# Ignore the status of the deposit product
|
||||
deposit_product_id = self.env['sale.advance.payment.inv'].\
|
||||
@@ -331,7 +331,7 @@ class PmsFolio(models.Model):
|
||||
|
||||
folio.update({
|
||||
'invoice_count': len(set(move_ids.ids + refund_ids.ids)),
|
||||
'invoice_ids': move_ids.ids + refund_ids.ids,
|
||||
'move_ids': move_ids.ids + refund_ids.ids,
|
||||
'invoice_status': invoice_status
|
||||
})
|
||||
|
||||
@@ -357,7 +357,7 @@ class PmsFolio(models.Model):
|
||||
|
||||
@api.depends('amount_total', 'payment_ids', 'return_ids',
|
||||
'reservation_type', 'state')
|
||||
|
||||
|
||||
def compute_amount(self):
|
||||
acc_pay_obj = self.env['account.payment']
|
||||
for record in self:
|
||||
@@ -466,7 +466,7 @@ class PmsFolio(models.Model):
|
||||
self.has_checkout_to_send = False
|
||||
|
||||
# Constraints and onchanges
|
||||
|
||||
|
||||
@api.onchange('partner_id')
|
||||
def onchange_partner_id(self):
|
||||
"""
|
||||
@@ -484,7 +484,7 @@ class PmsFolio(models.Model):
|
||||
})
|
||||
return
|
||||
|
||||
addr = self.partner_id.address_get(['move'])
|
||||
addr = self.partner_id.address_get(['invoice'])
|
||||
pricelist = self.partner_id.property_product_pricelist and \
|
||||
self.partner_id.property_product_pricelist.id or \
|
||||
self.env.user.pms_property_id.default_pricelist_id.id
|
||||
@@ -506,7 +506,7 @@ class PmsFolio(models.Model):
|
||||
values['team_id'] = self.partner_id.team_id.id
|
||||
self.update(values)
|
||||
|
||||
|
||||
|
||||
@api.onchange('pricelist_id')
|
||||
def onchange_pricelist_id(self):
|
||||
values = {'reservation_type': self.env['pms.folio'].
|
||||
@@ -517,7 +517,7 @@ class PmsFolio(models.Model):
|
||||
self.update(values)
|
||||
|
||||
# Action methods
|
||||
|
||||
|
||||
def action_pay(self):
|
||||
self.ensure_one()
|
||||
partner = self.partner_id.id
|
||||
@@ -541,7 +541,7 @@ class PmsFolio(models.Model):
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
|
||||
|
||||
def open_moves_folio(self):
|
||||
invoices = self.mapped('move_ids')
|
||||
action = self.env.ref('account.action_move_out_invoice_type').read()[0]
|
||||
@@ -555,7 +555,7 @@ class PmsFolio(models.Model):
|
||||
action = {'type': 'ir.actions.act_window_close'}
|
||||
return action
|
||||
|
||||
|
||||
|
||||
def action_return_payments(self):
|
||||
self.ensure_one()
|
||||
return_move_ids = []
|
||||
@@ -582,7 +582,7 @@ class PmsFolio(models.Model):
|
||||
'domain': [('id', 'in', return_move_ids)],
|
||||
}
|
||||
|
||||
|
||||
|
||||
def action_checks(self):
|
||||
self.ensure_one()
|
||||
rooms = self.mapped('reservation_ids.id')
|
||||
@@ -596,7 +596,7 @@ class PmsFolio(models.Model):
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
|
||||
|
||||
def send_reservation_mail(self):
|
||||
'''
|
||||
This function opens a window to compose an email,
|
||||
@@ -642,7 +642,7 @@ class PmsFolio(models.Model):
|
||||
'force_send': True
|
||||
}
|
||||
|
||||
|
||||
|
||||
def send_exit_mail(self):
|
||||
'''
|
||||
This function opens a window to compose an email,
|
||||
@@ -688,7 +688,7 @@ class PmsFolio(models.Model):
|
||||
'force_send': True
|
||||
}
|
||||
|
||||
|
||||
|
||||
def send_cancel_mail(self):
|
||||
'''
|
||||
This function opens a window to compose an email,
|
||||
@@ -773,14 +773,14 @@ class PmsFolio(models.Model):
|
||||
else:
|
||||
return 'normal'
|
||||
|
||||
|
||||
|
||||
def action_done(self):
|
||||
reservation_ids = self.mapped('reservation_ids')
|
||||
for line in reservation_ids:
|
||||
if line.state == "booking":
|
||||
line.action_reservation_checkout()
|
||||
|
||||
|
||||
|
||||
def action_cancel(self):
|
||||
for folio in self:
|
||||
for reservation in folio.reservation_ids.filtered(
|
||||
@@ -791,7 +791,7 @@ class PmsFolio(models.Model):
|
||||
})
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def action_confirm(self):
|
||||
for folio in self.filtered(lambda folio: folio.partner_id not in
|
||||
folio.message_partner_ids):
|
||||
@@ -814,7 +814,7 @@ class PmsFolio(models.Model):
|
||||
CHECKIN/OUT PROCESS
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def _compute_checkin_partner_count(self):
|
||||
for record in self:
|
||||
if record.reservation_type == 'normal' and record.reservation_ids:
|
||||
@@ -830,7 +830,7 @@ class PmsFolio(models.Model):
|
||||
record.checkin_partner_pending_count = sum(
|
||||
mapped_checkin_partner_count)
|
||||
|
||||
|
||||
|
||||
def get_grouped_reservations_json(self, state, import_all=False):
|
||||
self.ensure_one()
|
||||
info_grouped = []
|
||||
@@ -873,7 +873,7 @@ class PmsFolio(models.Model):
|
||||
reverse=True),
|
||||
key=lambda k: k['room_type']['id'])
|
||||
|
||||
|
||||
|
||||
def _get_tax_amount_by_group(self):
|
||||
self.ensure_one()
|
||||
res = {}
|
||||
|
||||
@@ -11,7 +11,6 @@ from odoo.tools import (
|
||||
DEFAULT_SERVER_DATE_FORMAT,
|
||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -301,24 +300,24 @@ class PmsReservation(models.Model):
|
||||
string='To Invoice',
|
||||
store=True,
|
||||
readonly=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits=('Product Unit of Measure'))
|
||||
qty_invoiced = fields.Float(
|
||||
compute='_get_invoice_qty',
|
||||
string='Invoiced',
|
||||
store=True,
|
||||
readonly=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits=('Product Unit of Measure'))
|
||||
price_subtotal = fields.Monetary(
|
||||
string='Subtotal',
|
||||
readonly=True,
|
||||
store=True,
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits=('Product Price'),
|
||||
compute='_compute_amount_reservation')
|
||||
price_total = fields.Monetary(
|
||||
string='Total',
|
||||
readonly=True,
|
||||
store=True,
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits=('Product Price'),
|
||||
compute='_compute_amount_reservation')
|
||||
price_tax = fields.Float(
|
||||
string='Taxes',
|
||||
@@ -329,17 +328,17 @@ class PmsReservation(models.Model):
|
||||
string='Services Total',
|
||||
readonly=True,
|
||||
store=True,
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits=('Product Price'),
|
||||
compute='_compute_amount_room_services')
|
||||
price_room_services_set = fields.Monetary(
|
||||
string='Room Services Total',
|
||||
readonly=True,
|
||||
store=True,
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits=('Product Price'),
|
||||
compute='_compute_amount_set')
|
||||
discount = fields.Float(
|
||||
string='Discount (€)',
|
||||
digits=dp.get_precision('Discount'),
|
||||
digits=('Discount'),
|
||||
compute='_compute_discount',
|
||||
store=True)
|
||||
|
||||
@@ -419,10 +418,11 @@ class PmsReservation(models.Model):
|
||||
def _compute_localizator(self):
|
||||
for record in self:
|
||||
if record.folio_id:
|
||||
#TODO: Review Datetime type no char v13
|
||||
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)
|
||||
# checkout = int(re.sub("[^0-9]", "", record.checkout))
|
||||
# checkin = int(re.sub("[^0-9]", "", record.checkin))
|
||||
# localizator += str((checkin + checkout) % 99)
|
||||
record.localizator = localizator
|
||||
|
||||
@api.depends('service_ids.price_total')
|
||||
@@ -512,7 +512,7 @@ class PmsReservation(models.Model):
|
||||
reservation period: %s ') % occupied_name
|
||||
raise ValidationError(warning_msg)
|
||||
|
||||
|
||||
|
||||
@api.constrains('checkin_partner_ids')
|
||||
def _max_checkin_partner_ids(self):
|
||||
for record in self:
|
||||
@@ -554,7 +554,7 @@ class PmsReservation(models.Model):
|
||||
}
|
||||
self.update(values)
|
||||
|
||||
|
||||
|
||||
@api.onchange('pricelist_id')
|
||||
def onchange_pricelist_id(self):
|
||||
values = {'reservation_type': self.env['pms.folio'].
|
||||
@@ -569,7 +569,7 @@ class PmsReservation(models.Model):
|
||||
self.update({'partner_id':
|
||||
self.env.user.company_id.partner_id.id})
|
||||
|
||||
|
||||
|
||||
@api.onchange('checkin_partner_ids')
|
||||
def onchange_checkin_partner_ids(self):
|
||||
for record in self:
|
||||
@@ -640,7 +640,7 @@ class PmsReservation(models.Model):
|
||||
for service in services:
|
||||
service.onchange_product_id()
|
||||
|
||||
|
||||
|
||||
@api.onchange('checkin', 'checkout', 'room_id')
|
||||
def onchange_room_availabiltiy_domain(self):
|
||||
self.ensure_one()
|
||||
@@ -704,7 +704,7 @@ class PmsReservation(models.Model):
|
||||
service.price_unit = service._compute_price_unit()
|
||||
|
||||
# Action methods
|
||||
|
||||
|
||||
def open_invoices_reservation(self):
|
||||
invoices = self.folio_id.mapped('move_ids')
|
||||
action = self.env.ref('account.action_move_out_invoice_type').read()[0]
|
||||
@@ -721,7 +721,7 @@ class PmsReservation(models.Model):
|
||||
'default_folio_id': self.folio_id.id}
|
||||
return action
|
||||
|
||||
|
||||
|
||||
def create_invoice(self):
|
||||
action = self.env.ref(
|
||||
'pms.action_view_folio_advance_payment_inv').read()[0]
|
||||
@@ -729,7 +729,7 @@ class PmsReservation(models.Model):
|
||||
'default_folio_id': self.folio_id.id}
|
||||
return action
|
||||
|
||||
|
||||
|
||||
def open_folio(self):
|
||||
action = self.env.ref(
|
||||
'pms.open_pms_folio1_form_tree_all').read()[0]
|
||||
@@ -741,7 +741,7 @@ class PmsReservation(models.Model):
|
||||
action = {'type': 'ir.actions.act_window_close'}
|
||||
return action
|
||||
|
||||
|
||||
|
||||
def open_reservation_form(self):
|
||||
action = self.env.ref(
|
||||
'pms.open_pms_reservation_form_tree_all').read()[0]
|
||||
@@ -750,12 +750,12 @@ class PmsReservation(models.Model):
|
||||
action['res_id'] = self.id
|
||||
return action
|
||||
|
||||
|
||||
|
||||
def action_pay_folio(self):
|
||||
self.ensure_one()
|
||||
return self.folio_id.action_pay()
|
||||
|
||||
|
||||
|
||||
def action_pay_reservation(self):
|
||||
self.ensure_one()
|
||||
partner = self.partner_id.id
|
||||
@@ -795,7 +795,7 @@ class PmsReservation(models.Model):
|
||||
return super(PmsReservation, self).name_search(
|
||||
name='', args=args, operator='ilike', limit=limit)
|
||||
|
||||
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for res in self:
|
||||
@@ -853,7 +853,7 @@ class PmsReservation(models.Model):
|
||||
record.confirm()
|
||||
return record
|
||||
|
||||
|
||||
|
||||
def write(self, vals):
|
||||
if self.notify_update(vals):
|
||||
vals.update({
|
||||
@@ -937,7 +937,7 @@ class PmsReservation(models.Model):
|
||||
return record
|
||||
|
||||
# Business methods
|
||||
|
||||
|
||||
def _computed_shared(self):
|
||||
# Has this reservation more charges associates in folio?,
|
||||
# Yes?, then, this is share folio ;)
|
||||
@@ -948,7 +948,7 @@ class PmsReservation(models.Model):
|
||||
or any(record.folio_id.service_ids.filtered(
|
||||
lambda x: x.reservation_id.id != record.id))
|
||||
|
||||
|
||||
|
||||
def compute_board_services(self, vals):
|
||||
"""
|
||||
We must compute service_ids when we have a board_service_id without
|
||||
@@ -963,7 +963,7 @@ class PmsReservation(models.Model):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def compute_qty_service_day(self, vals):
|
||||
"""
|
||||
Compute if it is necesary calc price in write/create
|
||||
@@ -1047,7 +1047,7 @@ class PmsReservation(models.Model):
|
||||
subtype='mt_comment', body=msg)
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def notify_update(self, vals):
|
||||
if 'checkin' in vals or \
|
||||
'checkout' in vals or \
|
||||
@@ -1058,12 +1058,12 @@ class PmsReservation(models.Model):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def overbooking_button(self):
|
||||
self.ensure_one()
|
||||
self.overbooking = not self.overbooking
|
||||
|
||||
|
||||
|
||||
def generate_copy_values(self, checkin=False, checkout=False):
|
||||
self.ensure_one()
|
||||
return {
|
||||
@@ -1091,7 +1091,7 @@ class PmsReservation(models.Model):
|
||||
STATE WORKFLOW -----------------------------------------------------
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def confirm(self):
|
||||
'''
|
||||
@param self: object pointer
|
||||
@@ -1130,7 +1130,7 @@ class PmsReservation(models.Model):
|
||||
splitted_reservs.confirm()
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def button_done(self):
|
||||
'''
|
||||
@param self: object pointer
|
||||
@@ -1139,7 +1139,7 @@ class PmsReservation(models.Model):
|
||||
record.action_reservation_checkout()
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def action_cancel(self):
|
||||
for record in self:
|
||||
cancel_reason = 'intime' if self._context.get(
|
||||
@@ -1166,7 +1166,7 @@ class PmsReservation(models.Model):
|
||||
splitted_reservs.action_cancel()
|
||||
record.folio_id.compute_amount()
|
||||
|
||||
|
||||
|
||||
def compute_cancelation_reason(self):
|
||||
self.ensure_one()
|
||||
pricelist = self.pricelist_id
|
||||
@@ -1184,7 +1184,7 @@ class PmsReservation(models.Model):
|
||||
return 'intime'
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def draft(self):
|
||||
for record in self:
|
||||
record.state = 'draft'
|
||||
@@ -1207,7 +1207,7 @@ class PmsReservation(models.Model):
|
||||
"""
|
||||
PRICE PROCESS ------------------------------------------------------
|
||||
"""
|
||||
|
||||
|
||||
def compute_price_out_vals(self, vals):
|
||||
"""
|
||||
Compute if It is necesary calc price in write/create
|
||||
@@ -1220,7 +1220,7 @@ class PmsReservation(models.Model):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def _compute_cancelled_discount(self):
|
||||
self.ensure_one()
|
||||
pricelist = self.pricelist_id
|
||||
@@ -1378,7 +1378,7 @@ class PmsReservation(models.Model):
|
||||
CHECKIN/OUT PROCESS ------------------------------------------------
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def _compute_checkin_partner_count(self):
|
||||
_logger.info('_compute_checkin_partner_count')
|
||||
for record in self:
|
||||
@@ -1392,14 +1392,14 @@ class PmsReservation(models.Model):
|
||||
record.checkin_partner_pending_count = 0
|
||||
|
||||
# https://www.odoo.com/es_ES/forum/ayuda-1/question/calculated-fields-in-search-filter-possible-118501
|
||||
|
||||
|
||||
def _search_checkin_partner_pending(self, operator, value):
|
||||
self.ensure_one()
|
||||
recs = self.search([]).filtered(
|
||||
lambda x: x.checkin_partner_pending_count > 0)
|
||||
return [('id', 'in', [x.id for x in recs])] if recs else []
|
||||
|
||||
|
||||
|
||||
def action_reservation_checkout(self):
|
||||
for record in self:
|
||||
record.state = 'done'
|
||||
@@ -1421,7 +1421,7 @@ class PmsReservation(models.Model):
|
||||
splitted_reservs.update({'state': 'done'})
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def action_checks(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref(
|
||||
@@ -1437,7 +1437,7 @@ class PmsReservation(models.Model):
|
||||
RESERVATION SPLITTED -----------------------------------------------
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def split(self, nights):
|
||||
for record in self:
|
||||
date_start_dt = fields.Date.from_string(record.checkin)
|
||||
@@ -1490,7 +1490,7 @@ class PmsReservation(models.Model):
|
||||
})
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def unify(self):
|
||||
self.ensure_one()
|
||||
if not self.splitted:
|
||||
@@ -1570,7 +1570,7 @@ class PmsReservation(models.Model):
|
||||
})
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def open_master(self):
|
||||
self.ensure_one()
|
||||
if not self.parent_reservation:
|
||||
@@ -1586,15 +1586,15 @@ class PmsReservation(models.Model):
|
||||
MAILING PROCESS
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def send_reservation_mail(self):
|
||||
return self.folio_id.send_reservation_mail()
|
||||
|
||||
|
||||
|
||||
def send_exit_mail(self):
|
||||
return self.folio_id.send_exit_mail()
|
||||
|
||||
|
||||
|
||||
def send_cancel_mail(self):
|
||||
return self.folio_id.send_cancel_mail()
|
||||
|
||||
@@ -1602,7 +1602,7 @@ class PmsReservation(models.Model):
|
||||
INVOICING PROCESS
|
||||
"""
|
||||
|
||||
|
||||
|
||||
def _compute_tax_ids(self):
|
||||
for record in self:
|
||||
# If company_id is set, always filter taxes by the company
|
||||
@@ -1613,7 +1613,7 @@ class PmsReservation(models.Model):
|
||||
lambda r: not record.company_id or
|
||||
r.company_id == folio.company_id)
|
||||
|
||||
|
||||
|
||||
def set_call_center_user(self):
|
||||
user = self.env['res.users'].browse(self.env.uid)
|
||||
return user.has_group('pms.group_pms_call')
|
||||
|
||||
@@ -2,16 +2,16 @@
|
||||
# Copyright 2017 Dario Lodeiros
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.addons import decimal_precision as dp
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class PmsReservationLine(models.Model):
|
||||
_name = "pms.reservation.line"
|
||||
_description = "Reservations by day"
|
||||
_order = "date"
|
||||
|
||||
# Default Methods ang Gets
|
||||
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for res in self:
|
||||
@@ -44,13 +44,13 @@ class PmsReservationLine(models.Model):
|
||||
state = fields.Selection(related='reservation_id.state')
|
||||
price = fields.Float(
|
||||
string='Price',
|
||||
digits=dp.get_precision('Product Price'))
|
||||
digits=('Product Price'))
|
||||
cancel_discount = fields.Float(
|
||||
string='Cancel Discount (%)',
|
||||
digits=dp.get_precision('Discount'), default=0.0)
|
||||
digits=('Discount'), default=0.0)
|
||||
discount = fields.Float(
|
||||
string='Discount (%)',
|
||||
digits=dp.get_precision('Discount'), default=0.0)
|
||||
digits=('Discount'), default=0.0)
|
||||
|
||||
# Constraints and onchanges
|
||||
@api.constrains('date')
|
||||
|
||||
@@ -7,6 +7,7 @@ class PmsRoomTypeRestriction(models.Model):
|
||||
""" The room type restriction is used as a daily restriction plan for room types
|
||||
and therefore is related only with one property. """
|
||||
_name = 'pms.room.type.restriction'
|
||||
_description = 'Reservation restriction plan'
|
||||
|
||||
# Default methods
|
||||
@api.model
|
||||
|
||||
@@ -6,6 +6,7 @@ from odoo.exceptions import ValidationError
|
||||
|
||||
class PmsRoomTypeRestrictionItem(models.Model):
|
||||
_name = 'pms.room.type.restriction.item'
|
||||
_description = 'Reservation restriction by day'
|
||||
|
||||
# Field Declarations
|
||||
restriction_id = fields.Many2one('pms.room.type.restriction',
|
||||
@@ -29,7 +30,7 @@ class PmsRoomTypeRestrictionItem(models.Model):
|
||||
day for the same room type!')]
|
||||
|
||||
# Constraints and onchanges
|
||||
|
||||
|
||||
@api.constrains('min_stay', 'min_stay_arrival', 'max_stay',
|
||||
'max_stay_arrival')
|
||||
def _check_min_stay(self):
|
||||
|
||||
@@ -7,7 +7,6 @@ from odoo.tools import (
|
||||
float_compare,
|
||||
DEFAULT_SERVER_DATE_FORMAT)
|
||||
from datetime import timedelta
|
||||
from odoo.addons import decimal_precision as dp
|
||||
import logging
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -17,7 +16,7 @@ class PmsService(models.Model):
|
||||
_description = 'Services and its charges'
|
||||
|
||||
# Default methods
|
||||
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for rec in self:
|
||||
@@ -123,22 +122,22 @@ class PmsService(models.Model):
|
||||
price_unit = fields.Float(
|
||||
'Unit Price',
|
||||
required=True,
|
||||
digits=dp.get_precision('Product Price'), default=0.0)
|
||||
digits=('Product Price'), default=0.0)
|
||||
discount = fields.Float(
|
||||
string='Discount (%)',
|
||||
digits=dp.get_precision('Discount'), default=0.0)
|
||||
digits=('Discount'), default=0.0)
|
||||
qty_to_invoice = fields.Float(
|
||||
compute='_get_to_invoice_qty',
|
||||
string='To Invoice',
|
||||
store=True,
|
||||
readonly=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits=('Product Unit of Measure'))
|
||||
qty_invoiced = fields.Float(
|
||||
compute='_get_invoice_qty',
|
||||
string='Invoiced',
|
||||
store=True,
|
||||
readonly=True,
|
||||
digits=dp.get_precision('Product Unit of Measure'))
|
||||
digits=('Product Unit of Measure'))
|
||||
price_subtotal = fields.Monetary(
|
||||
string='Subtotal',
|
||||
readonly=True,
|
||||
@@ -337,7 +336,7 @@ class PmsService(models.Model):
|
||||
record.update(vals)
|
||||
|
||||
# Action methods
|
||||
|
||||
|
||||
def open_service_ids(self):
|
||||
action = self.env.ref('pms.action_pms_services_form').read()[0]
|
||||
action['views'] = [
|
||||
@@ -387,7 +386,7 @@ class PmsService(models.Model):
|
||||
record = super(PmsService, self).create(vals)
|
||||
return record
|
||||
|
||||
|
||||
|
||||
def write(self, vals):
|
||||
# If you write product, We must check if its necesary create or delete
|
||||
# service lines
|
||||
@@ -439,7 +438,7 @@ class PmsService(models.Model):
|
||||
line[field], line)
|
||||
return res
|
||||
|
||||
|
||||
|
||||
def compute_lines_out_vals(self, vals):
|
||||
"""
|
||||
Compute if It is necesary service days in write/create
|
||||
@@ -453,7 +452,7 @@ class PmsService(models.Model):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
def _compute_tax_ids(self):
|
||||
for record in self:
|
||||
# If company_id is set, always filter taxes by the company
|
||||
@@ -466,7 +465,7 @@ class PmsService(models.Model):
|
||||
lambda r: not record.company_id or
|
||||
r.company_id == origin.company_id)
|
||||
|
||||
|
||||
|
||||
def _get_display_price(self, product):
|
||||
folio = self.folio_id or self.env.context.get('default_folio_id')
|
||||
reservation = self.reservation_id or self.env.context.get(
|
||||
@@ -499,7 +498,7 @@ class PmsService(models.Model):
|
||||
# negative discounts (= surcharge) are included in the display price
|
||||
return max(base_price, final_price)
|
||||
|
||||
|
||||
|
||||
def _compute_price_unit(self):
|
||||
self.ensure_one()
|
||||
folio = self.folio_id or self.env.context.get('default_folio_id')
|
||||
|
||||
@@ -7,6 +7,7 @@ from odoo.exceptions import ValidationError
|
||||
|
||||
class PmsServiceLine(models.Model):
|
||||
_name = "pms.service.line"
|
||||
_description = "Service by day"
|
||||
_order = "date"
|
||||
|
||||
# Fields declaration
|
||||
|
||||
@@ -22,6 +22,8 @@ user_access_pms_board_service_line,user_access_pms_board_service_line,model_pms_
|
||||
user_access_account_partial_reconcile,user_access_account_partial_reconcile,account.model_account_partial_reconcile,pms.group_pms_user,1,1,1,1
|
||||
user_access_pms_cancelation_rule,user_access_pms_cancelation_rule,model_pms_cancelation_rule,pms.group_pms_user,1,0,0,0
|
||||
user_access_account_full_reconcile,user_access_account_full_reconcile,account.model_account_full_reconcile,pms.group_pms_user,1,1,1,1
|
||||
call_access_pms_cancelation_rule,call_access_pms_cancelation_rule,model_pms_cancelation_rule,base.group_user,1,0,0,0
|
||||
user_access_property,user_access_property,model_pms_property,pms.group_pms_user,1,0,0,0
|
||||
manager_access_pms_floor,manager_access_pms_floor,model_pms_floor,pms.group_pms_manager,1,1,1,1
|
||||
manager_access_pms_amenity,manager_access_pms_amenity,model_pms_amenity,pms.group_pms_manager,1,1,1,1
|
||||
manager_access_pms_amenity_type,manager_access_pms_amenity_type,model_pms_amenity_type,pms.group_pms_manager,1,1,1,1
|
||||
@@ -42,6 +44,7 @@ manager_access_pms_room_type,manager_access_pms_room_type,model_pms_room_type,pm
|
||||
manager_access_pms_board_service_room_type,manager_access_pms_board_service_room_type,model_pms_board_service_room_type,pms.group_pms_manager,1,1,1,1
|
||||
manager_access_pms_board_service_room_type_line,manager_access_pms_board_service_room_type_line,model_pms_board_service_room_type_line,pms.group_pms_manager,1,1,1,1
|
||||
manager_access_pms_board_service_line,manager_access_pms_board_service_line,model_pms_board_service_line,pms.group_pms_manager,1,1,1,1
|
||||
manager_access_property,manager_access_property,model_pms_property,pms.group_pms_manager,1,1,1,1
|
||||
manager_access_pms_cancelation_rule,manager_access_pms_cancelation_rule,model_pms_cancelation_rule,base.group_user,1,1,1,1
|
||||
call_access_pms_floor,call_access_pms_floor,model_pms_floor,pms.group_pms_call,1,0,0,0
|
||||
call_access_pms_amenity,call_access_pms_amenity,model_pms_amenity,pms.group_pms_call,1,0,0,0
|
||||
@@ -63,4 +66,4 @@ call_access_pms_room_type,call_access_pms_room_type,model_pms_room_type,pms.grou
|
||||
call_access_pms_board_service_room_type,call_access_pms_board_service_room_type,model_pms_board_service_room_type,pms.group_pms_call,1,0,0,0
|
||||
call_access_pms_board_service_room_type_line,call_access_pms_board_service_room_type_line,model_pms_board_service_room_type_line,pms.group_pms_call,1,0,0,0
|
||||
call_access_pms_board_service_line,call_access_pms_board_service_line,model_pms_board_service_line,pms.group_pms_call,1,0,0,0
|
||||
call_access_pms_cancelation_rule,call_access_pms_cancelation_rule,model_pms_cancelation_rule,base.group_user,1,0,0,0
|
||||
call_access_property,call_access_property,model_pms_property,pms.group_pms_call,1,0,0,0
|
||||
|
||||
|
@@ -30,7 +30,7 @@
|
||||
attrs="{'invisible': [('state','=','draft')]}"/>
|
||||
<button string="Delete" name="delete" type="object" class="oe_read_only btn-primary"
|
||||
attrs="{'invisible': [('state','=','draft')]}"/>
|
||||
<button string="Cancel" class="oe_read_only btn-default" special="cancel"/>
|
||||
<button string="Cancel" name="cancel" class="oe_read_only btn-default" special="cancel"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,posted,reconciled,cancelled"/>
|
||||
</header>
|
||||
<sheet>
|
||||
@@ -55,26 +55,45 @@
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="payment_type" invisible="1"/>
|
||||
<field name="save_amount" invisible="1"/>
|
||||
<field name="save_date" invisible="1"/>
|
||||
<field name="save_journal_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1" />
|
||||
<field name="payment_type" invisible="1" />
|
||||
<field name="save_amount" invisible="1" />
|
||||
<field name="save_date" invisible="1" />
|
||||
<field name="save_journal_id" invisible="1" />
|
||||
<field name="partner_type" widget="selection" invisible="1"/>
|
||||
<field name="partner_id" attrs="{'required': [('state', '=', 'draft'), ('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))]}" context="{'default_is_company': True, 'default_supplier': payment_type == 'outbound', 'default_customer': payment_type == 'inbound'}"/>
|
||||
<field name="partner_id" attrs="{
|
||||
'required': [('state', '=', 'draft'), ('payment_type', 'in', ('inbound', 'outbound'))],
|
||||
'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))]
|
||||
}"
|
||||
context="{
|
||||
'default_is_company': True,
|
||||
'default_supplier': payment_type == 'outbound',
|
||||
'default_customer': payment_type == 'inbound'
|
||||
}"/>
|
||||
<label for="amount"/>
|
||||
<div name="amount_div" class="o_row">
|
||||
<field name="amount" />
|
||||
<field name="currency_id" options="{'no_create': True, 'no_open': True}" groups="base.group_multi_currency" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="currency_id"
|
||||
options="{'no_create': True, 'no_open': True}"
|
||||
groups="base.group_multi_currency"
|
||||
attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
</div>
|
||||
<field name="journal_id" widget="selection" />
|
||||
<field name="destination_journal_id" widget="selection" attrs="{'required': [('payment_type', '=', 'transfer')], 'invisible': [('payment_type', '!=', 'transfer')], 'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="destination_journal_id"
|
||||
widget="selection"
|
||||
attrs="{
|
||||
'required': [('payment_type', '=', 'transfer')],
|
||||
'invisible': [('payment_type', '!=', 'transfer')],
|
||||
'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="hide_payment_method" invisible="1"/>
|
||||
<field name="payment_method_id" string=" " widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
|
||||
<field name="payment_method_id" string=" " widget="radio"
|
||||
attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
|
||||
<field name="payment_method_code" invisible="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="payment_date" />
|
||||
<field name="communication" attrs="{'invisible': [('state', '!=', 'draft'), ('communication', '=', False)]}"/>
|
||||
<field name="communication"
|
||||
attrs="{'invisible': [('state', '!=', 'draft'), ('communication', '=', False)]}"/>
|
||||
<field name="folio_id" readonly="1" force_save="1"/>
|
||||
</group>
|
||||
</group>
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='user_id']" position="after">
|
||||
<field name="company_type" invisible="1" />
|
||||
<field name="is_tour_operator" attrs="{'invisible': [('company_type','!=','company')]}"/>
|
||||
</xpath>
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<form string="Room Amenities">
|
||||
<sheet>
|
||||
<h1>
|
||||
<label string="Amenity" />
|
||||
<label for="name" string="Amenity" />
|
||||
<field name="name" select="1" />
|
||||
</h1>
|
||||
<group>
|
||||
@@ -16,7 +16,7 @@
|
||||
</group>
|
||||
<notebook>
|
||||
<page string="Information">
|
||||
<group colspan="4" col="4">
|
||||
<group colspan="4" col="4">
|
||||
<field name="pms_property_ids" widget="many2many_tags"
|
||||
options="{'no_create': True,'no_open': True}"/>
|
||||
<field name="room_amenity_type_id" select="2" string="Amenity Type" />
|
||||
|
||||
@@ -60,13 +60,15 @@
|
||||
<!-- actions -->
|
||||
|
||||
<record id="pms_property_action" model="ir.actions.act_window">
|
||||
<field name="name">pmss</field>
|
||||
<field name="name">Properties</field>
|
||||
<field name="res_model">pms.property</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<!-- menus -->
|
||||
|
||||
<menuitem action="pms_property_action" id="pms_property_menu" parent="base.menu_users" sequence="10"/>
|
||||
<menuitem action="pms_property_action" id="pms_property_menu"
|
||||
parent="base.menu_users" sequence="10"
|
||||
name = "Properties"/>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
attrs="{'invisible':[('splitted', '=', False)]}"
|
||||
/>
|
||||
<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" statusbar_visible="draft,confirm,booking,done" />
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,confirm,booking,done"/>
|
||||
</header>
|
||||
|
||||
<sheet>
|
||||
@@ -74,12 +74,14 @@
|
||||
<bold><button class="alert-link" type="object" name="open_folio" string="Folio Form"/></bold>
|
||||
</div>
|
||||
<field name="shared_folio" invisible="1"/>
|
||||
<div class="oe_button_box" attrs="{'invisible': [('folio_id','=',False)]}">
|
||||
<div class="oe_button_box" name="button_box" attrs="{'invisible': [('folio_id','=',False)]}">
|
||||
<button type="object" class="oe_stat_button"
|
||||
icon="fa-file"
|
||||
name="open_folio">
|
||||
<div class="o_form_field o_stat_info">
|
||||
<span class="o_stat_text"><field name="folio_id" readonly="1" nolabel="1"/></span>
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_text">
|
||||
<field name="folio_id" readonly="1" nolabel="1"/>
|
||||
</span>
|
||||
</div>
|
||||
</button>
|
||||
<button type="action" class="oe_stat_button"
|
||||
@@ -87,7 +89,7 @@
|
||||
attrs="{'invisible': ['|', ('partner_id','=',False), ('reservation_type','in',('out'))]}"
|
||||
name="%(open_pms_reservation_form_tree_all)d"
|
||||
context="{'search_default_partner_id': partner_id}">
|
||||
<div class="o_form_field o_stat_info">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_text">Books</span>
|
||||
</div>
|
||||
</button>
|
||||
@@ -96,7 +98,7 @@
|
||||
icon="fa-money"
|
||||
name="action_pay_folio"
|
||||
attrs="{'invisible': ['|',('folio_pending_amount','<=',0)]}">
|
||||
<div class="o_form_field o_stat_info">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value">
|
||||
<field name="folio_pending_amount" nolabel="1"
|
||||
widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
@@ -107,7 +109,7 @@
|
||||
<button type="object" class="oe_stat_button" id="invoice_button"
|
||||
icon="fa-pencil-square-o" name="open_invoices_reservation"
|
||||
attrs="{'invisible': [('invoice_count','<=',0)]}">
|
||||
<div class="o_form_field o_stat_info">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value">
|
||||
<field name="invoice_count"/>
|
||||
</span>
|
||||
@@ -118,7 +120,7 @@
|
||||
icon="fa-chain-broken"
|
||||
name="open_master"
|
||||
attrs="{'invisible':[('splitted','=',False)]}">
|
||||
<div class="o_form_field o_stat_info">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span><field name="parent_reservation"
|
||||
nolabel="1" readonly="1"/></span>
|
||||
<span class="o_stat_text">Splitted!</span>
|
||||
@@ -160,11 +162,13 @@
|
||||
attrs="{'invisible': [('reservation_type','not in',('out'))]}"/>
|
||||
</h1>
|
||||
<h3>
|
||||
From <span class="fa fa-sign-in" style="margin: 5px;"/>
|
||||
<field name="checkin" style="margin-right: 10px;"/>
|
||||
to
|
||||
<span class="fa fa-sign-out" style="margin-right: 5px;"/>
|
||||
<field name="checkout" />
|
||||
<group>
|
||||
<div class="o_row">
|
||||
<field name="checkin" widget="daterange" nolabel="1" class="oe_inline" options="{'related_end_date': 'checkout'}"/>
|
||||
<i class="fa fa-long-arrow-right mx-2" aria-label="Arrow icon" title="Arrow"/>
|
||||
<field name="checkout" widget="daterange" nolabel="1" class="oe_inline" options="{'related_start_date': 'checkin'}"/>
|
||||
</div>
|
||||
</group>
|
||||
</h3>
|
||||
<field name="out_service_description" placeholder="Out service description"
|
||||
attrs="{'invisible':[('reservation_type','not in',('out'))]}"/>
|
||||
|
||||
@@ -58,13 +58,16 @@
|
||||
<search string="Services By Day">
|
||||
<field name="service_id" />
|
||||
<filter string="Today"
|
||||
domain="[('date', '=', context_today().strftime('%Y-%m-%d'))]"
|
||||
help="Current Booking" />
|
||||
name="today"
|
||||
domain="[('date', '=', context_today().strftime('%Y-%m-%d'))]"
|
||||
help="Current Booking" />
|
||||
<filter string="Tomorrow"
|
||||
domain="[('date', '=', (context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))]"
|
||||
/>
|
||||
name="tomorrow"
|
||||
domain="[('date', '=', (context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))]"
|
||||
/>
|
||||
<filter string="Next 7 days"
|
||||
domain="[('date', '>', context_today().strftime('%Y-%m-%d')),
|
||||
name="next_7_days"
|
||||
domain="[('date', '>', context_today().strftime('%Y-%m-%d')),
|
||||
('date', '<', (context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]"
|
||||
/>
|
||||
<group expand="0" string="Group By">
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import time
|
||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||
from odoo import api, fields, models, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from datetime import timedelta
|
||||
|
||||
@@ -85,7 +84,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
product_id = fields.Many2one('product.product', string="Product",
|
||||
domain=[('type', '=', 'service')], default=_default_product_id)
|
||||
amount = fields.Float('Down Payment Amount',
|
||||
digits=dp.get_precision('Account'),
|
||||
digits=('Account'),
|
||||
help="The amount to be invoiced in advance, taxes excluded.")
|
||||
deposit_account_id = fields.Many2one("account.account", string="Income Account",
|
||||
domain=[('deprecated', '=', False)],
|
||||
@@ -106,7 +105,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
return {'value': {'amount': 0}}
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
def _create_invoice(self, folio, service, amount):
|
||||
inv_obj = self.env['account.invoice']
|
||||
ir_property_obj = self.env['ir.property']
|
||||
@@ -142,7 +141,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
|
||||
invoice = inv_obj.create({
|
||||
'name': folio.client_order_ref or folio.name,
|
||||
'origin': folio.name,
|
||||
'invoice_origin': folio.name,
|
||||
'type': 'out_invoice',
|
||||
'reference': False,
|
||||
'folio_ids': [(6, 0, [folio.id])], #REVIEW: Folio_ids is a computed field, Why need this value?
|
||||
@@ -150,7 +149,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
'partner_id': folio.partner_invoice_id.id,
|
||||
'invoice_line_ids': [(0, 0, {
|
||||
'name': name,
|
||||
'origin': folio.name,
|
||||
'invoice_origin': folio.name,
|
||||
'account_id': account_id,
|
||||
'price_unit': amount,
|
||||
'quantity': 1.0,
|
||||
@@ -172,7 +171,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
invoice.compute_taxes()
|
||||
invoice.message_post_with_view(
|
||||
'mail.message_origin_link',
|
||||
values={'self': invoice, 'origin': folio},
|
||||
values={'self': invoice, 'invoice_origin': folio},
|
||||
subtype_id=self.env.ref('mail.mt_note').id)
|
||||
return invoice
|
||||
|
||||
@@ -201,7 +200,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
invoice.assign_outstanding_credit(line.id)
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def create_invoices(self):
|
||||
inv_obj = self.env['account.invoice']
|
||||
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
|
||||
@@ -270,7 +269,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
invoice.compute_taxes()
|
||||
self._validate_invoices(invoice)
|
||||
invoice.message_post_with_view('mail.message_origin_link',
|
||||
values={'self': invoice, 'origin': folios},
|
||||
values={'self': invoice, 'invoice_origin': folios},
|
||||
subtype_id=self.env.ref('mail.mt_note').id)
|
||||
if self._context.get('open_invoices', False):
|
||||
return folios.open_invoices_folio()
|
||||
@@ -394,7 +393,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
# raise UserError(_('All Folios must hace the same pricelist'))
|
||||
invoice_vals = {
|
||||
'name': self.folio_ids[0].client_order_ref or '',
|
||||
'origin': origin,
|
||||
'invoice_origin': origin,
|
||||
'type': 'out_invoice',
|
||||
'account_id': self.partner_invoice_id.property_account_receivable_id.id,
|
||||
'partner_id': self.partner_invoice_id.id,
|
||||
@@ -427,7 +426,7 @@ class LineAdvancePaymentInv(models.TransientModel):
|
||||
price_room = fields.Float(compute='_compute_price_room')
|
||||
discount = fields.Float(
|
||||
string='Discount (%)',
|
||||
digits=dp.get_precision('Discount'), default=0.0)
|
||||
digits=('Discount'), default=0.0)
|
||||
to_invoice = fields.Boolean('To Invoice')
|
||||
description = fields.Text('Description')
|
||||
description_dates = fields.Text('Range')
|
||||
@@ -474,7 +473,7 @@ class LineAdvancePaymentInv(models.TransientModel):
|
||||
((fields.Date.from_string(record.reservation_line_ids[-1].date)) + \
|
||||
timedelta(days=1)).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
|
||||
|
||||
def invoice_line_create(self, invoice_id, qty):
|
||||
""" Create an invoice line.
|
||||
:param invoice_id: integer
|
||||
@@ -496,7 +495,7 @@ class LineAdvancePaymentInv(models.TransientModel):
|
||||
account = fpos.map_account(account)
|
||||
vals = {
|
||||
'sequence': origin.sequence,
|
||||
'origin': origin.name,
|
||||
'invoice_origin': origin.name,
|
||||
'account_id': account.id,
|
||||
'price_unit': self.price_unit,
|
||||
'quantity': self.qty,
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div attrs="{'invisible': [('advance_payment_method', 'not in', ('fixed','percentage'))]}">
|
||||
<field name="amount"
|
||||
attrs="{'required': [('advance_payment_method', 'in', ('fixed','percentage'))]}" class="oe_inline" widget="monetary"/>
|
||||
<label string="%%"
|
||||
<label for="" string="%%"
|
||||
attrs="{'invisible': [('advance_payment_method', '!=', 'percentage')]}" class="oe_inline"/>
|
||||
</div>
|
||||
<field name="deposit_account_id" class="oe_inline"
|
||||
@@ -93,7 +93,7 @@
|
||||
<field name="res_model">folio.advance.payment.inv</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
<field name="groups_id" eval="[(4,ref('sales_team.group_sale_salesman'))]"/>
|
||||
<field name="groups_id" eval="[(4,ref('pms.group_pms_user'))]"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -8,6 +8,7 @@ from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||
|
||||
class MassiveChangesWizard(models.TransientModel):
|
||||
_name = 'pms.wizard.massive.changes'
|
||||
_description = 'Massive Changes'
|
||||
|
||||
# Default methods
|
||||
@api.model
|
||||
@@ -91,7 +92,7 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
self.date_end = self.date_start
|
||||
|
||||
# Action methods
|
||||
|
||||
|
||||
def _get_restrictions_values(self, record):
|
||||
self.ensure_one()
|
||||
vals = {}
|
||||
@@ -208,7 +209,7 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
elif record.section == 'prices':
|
||||
self._save_prices(ndate, room_types, record)
|
||||
|
||||
|
||||
|
||||
def _do_massive_change(self):
|
||||
pms_room_type_obj = self.env['pms.room.type']
|
||||
for record in self:
|
||||
@@ -230,20 +231,20 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
self._save(ndate, room_types, record)
|
||||
return True
|
||||
|
||||
|
||||
|
||||
def massive_change(self):
|
||||
self._do_massive_change()
|
||||
return {
|
||||
"type": "ir.actions.do_nothing",
|
||||
}
|
||||
|
||||
|
||||
|
||||
def massive_change_close(self):
|
||||
self._do_massive_change()
|
||||
return True
|
||||
|
||||
# TODO: method deprecated and not used anywhere
|
||||
|
||||
|
||||
def is_valid_date(self, chkdate):
|
||||
self.ensure_one()
|
||||
wday = chkdate.timetuple()[6]
|
||||
|
||||
@@ -5,13 +5,14 @@ from openerp import models, fields, api
|
||||
|
||||
class MassivePriceChangeWizard(models.TransientModel):
|
||||
_name = 'pms.wizard.massive.price.reservation.days'
|
||||
_description = 'Massive Price Changes'
|
||||
|
||||
new_price = fields.Float('New Price', default=1, min=1)
|
||||
change_price = fields.Boolean('Change Prices', default=False)
|
||||
new_discount = fields.Float('New Discount', default=0, min=1)
|
||||
change_discount = fields.Boolean('Change Discounts', default=False)
|
||||
|
||||
|
||||
|
||||
def massive_price_change_days(self):
|
||||
self.ensure_one()
|
||||
pms_reservation_obj = self.env['pms.reservation']
|
||||
|
||||
@@ -7,6 +7,7 @@ from odoo.tools import (
|
||||
|
||||
class ServiceOnDay(models.TransientModel):
|
||||
_name = 'service.on.day'
|
||||
_description = 'Set service for today'
|
||||
|
||||
def _get_default_date(self):
|
||||
tz_property = self.env.user.pms_property_id.tz
|
||||
@@ -18,7 +19,7 @@ class ServiceOnDay(models.TransientModel):
|
||||
product_qty = fields.Integer('Quantity', default=1)
|
||||
date = fields.Date('Date', default=_get_default_date)
|
||||
|
||||
|
||||
|
||||
def set_service(self):
|
||||
self.ensure_one()
|
||||
pms_reservation_obj = self.env['pms.reservation']
|
||||
|
||||
@@ -10,10 +10,11 @@ from openerp.tools import (
|
||||
|
||||
class SplitReservationWizard(models.TransientModel):
|
||||
_name = 'pms.wizard.split.reservation'
|
||||
_description = 'Split Reservation'
|
||||
|
||||
nights = fields.Integer('Nights', default=1, min=1)
|
||||
|
||||
|
||||
|
||||
def split_reservation(self):
|
||||
reservation_id = self.env['pms.reservation'].browse(
|
||||
self.env.context.get('active_id'))
|
||||
|
||||
@@ -9,12 +9,12 @@ from odoo.tools import (
|
||||
DEFAULT_SERVER_DATE_FORMAT,
|
||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
from odoo import models, fields, api, _
|
||||
import odoo.addons.decimal_precision as dp
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class FolioWizard(models.TransientModel):
|
||||
_name = 'pms.folio.wizard'
|
||||
_description = 'Wizard for reservation groups'
|
||||
|
||||
@api.model
|
||||
def _get_default_center_user(self):
|
||||
@@ -159,7 +159,7 @@ class FolioWizard(models.TransientModel):
|
||||
}))
|
||||
self.reservation_wizard_ids = cmds
|
||||
|
||||
|
||||
|
||||
@api.onchange('checkin', 'checkout')
|
||||
def onchange_checks(self):
|
||||
'''
|
||||
@@ -213,7 +213,7 @@ class FolioWizard(models.TransientModel):
|
||||
total += line.price
|
||||
self.total = total
|
||||
|
||||
|
||||
|
||||
def create_folio(self):
|
||||
self.ensure_one()
|
||||
if not self.partner_id:
|
||||
@@ -275,8 +275,9 @@ class FolioWizard(models.TransientModel):
|
||||
|
||||
class PmsRoomTypeWizards(models.TransientModel):
|
||||
_name = 'pms.room.type.wizard'
|
||||
_description = 'Virtual Room Type to Reserve Groups'
|
||||
|
||||
|
||||
|
||||
def _get_default_checkin(self):
|
||||
return self.folio_wizard_id.checkin
|
||||
|
||||
@@ -303,7 +304,7 @@ class PmsRoomTypeWizards(models.TransientModel):
|
||||
board_service_room_id = fields.Many2one('pms.board.service.room.type',
|
||||
string="Board Service")
|
||||
|
||||
|
||||
|
||||
@api.onchange('rooms_num')
|
||||
def domain_board_service(self):
|
||||
for line in self:
|
||||
@@ -317,7 +318,7 @@ class PmsRoomTypeWizards(models.TransientModel):
|
||||
domain_boardservice = [('id', 'in', board_service_room_ids)]
|
||||
return {'domain': {'board_service_room_id': domain_boardservice}}
|
||||
|
||||
|
||||
|
||||
def _can_confirm(self):
|
||||
for record in self:
|
||||
date_start = fields.Date.from_string(record.checkin)
|
||||
@@ -434,6 +435,7 @@ class PmsRoomTypeWizards(models.TransientModel):
|
||||
|
||||
class ReservationWizard(models.TransientModel):
|
||||
_name = 'pms.reservation.wizard'
|
||||
_description = 'Virtual Reservation to Groups'
|
||||
_rec_name = 'room_id'
|
||||
|
||||
room_id = fields.Many2one('pms.room',
|
||||
@@ -458,14 +460,14 @@ class ReservationWizard(models.TransientModel):
|
||||
board_service_room_id = fields.Many2one('pms.board.service.room.type',
|
||||
string="Board Service")
|
||||
|
||||
|
||||
|
||||
def _compute_assign(self):
|
||||
for rec in self:
|
||||
user = self.env['res.users'].browse(self.env.uid)
|
||||
if user.has_group('pms.group_pms_call'):
|
||||
rec.to_assign = True
|
||||
|
||||
|
||||
|
||||
@api.onchange('room_id')
|
||||
def onchange_room_id(self):
|
||||
for line in self:
|
||||
@@ -483,7 +485,7 @@ class ReservationWizard(models.TransientModel):
|
||||
raise ValidationError(_("This room is occupied!, please, \
|
||||
choice other room or change the reservation date"))
|
||||
|
||||
|
||||
|
||||
@api.onchange('checkin', 'checkout', 'room_type_id',
|
||||
'discount', 'board_service_room_id', 'product_ids')
|
||||
def onchange_dates(self):
|
||||
@@ -574,6 +576,7 @@ class ReservationWizard(models.TransientModel):
|
||||
|
||||
class ServiceWizard(models.TransientModel):
|
||||
_name = 'pms.service.wizard'
|
||||
_description = 'Virtual Service for Groups'
|
||||
|
||||
product_id = fields.Many2one('product.product',
|
||||
string="Service")
|
||||
@@ -581,7 +584,7 @@ class ServiceWizard(models.TransientModel):
|
||||
folio_wizard_id = fields.Many2one('pms.folio.wizard')
|
||||
discount = fields.Float('discount')
|
||||
price_unit = fields.Float('Unit Price', required=True,
|
||||
digits=dp.get_precision('Product Price'),
|
||||
digits=('Product Price'),
|
||||
default=0.0)
|
||||
price_total = fields.Float(compute='_compute_amount', string='Total',
|
||||
readonly=True, store=True)
|
||||
@@ -589,7 +592,7 @@ class ServiceWizard(models.TransientModel):
|
||||
domain=['|', ('active', '=', False),
|
||||
('active', '=', True)])
|
||||
product_uom_qty = fields.Float(string='Quantity',
|
||||
digits=dp.get_precision('Product Unit of Measure'),
|
||||
digits=('Product Unit of Measure'),
|
||||
required=True,
|
||||
default=1.0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user