mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[MIG] Views
This commit is contained in:
@@ -341,7 +341,6 @@ class CallCenterReportWizard(models.TransientModel):
|
||||
'xls_binary': base64.encodestring(file_data.read()),
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def export(self):
|
||||
self.write(self._export())
|
||||
return {
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">call.center.report.wizard</field>
|
||||
<field name="view_id" ref="view_call_center_report_wizard"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
<record id="action_account_payments_internal" model="ir.actions.act_window">
|
||||
<field name="name">Internal Transfers</field>
|
||||
<field name="res_model">account.payment</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,kanban,form,graph</field>
|
||||
<field name="context">{'default_payment_type': 'transfer', 'search_default_transfers_filter': 1}</field>
|
||||
<field name="domain">[]</field>
|
||||
|
||||
@@ -299,7 +299,7 @@ class CashDailyReportWizard(models.TransientModel):
|
||||
'xls_binary': base64.encodestring(file_data.read()),
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
def export(self):
|
||||
self.write(self._export())
|
||||
return {
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">cash.daily.report.wizard</field>
|
||||
<field name="view_id" ref="view_cash_daily_report_wizard"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
@@ -242,7 +242,7 @@ class GlassofExporterWizard(models.TransientModel):
|
||||
'xls_invoices_binary': base64.encodestring(file_data.read()),
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
def export(self):
|
||||
towrite = {}
|
||||
if self.export_journals:
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">glasof.exporter.wizard</field>
|
||||
<field name="view_id" ref="view_glasof_exporter_wizard"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<field name="name">Hotel Calendar</field>
|
||||
<field name="res_model">hotel.reservation</field>
|
||||
<field name="view_mode">pms</field>
|
||||
<field name="view_type">form</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hotel_calendar_management" model="ir.actions.act_window">
|
||||
|
||||
@@ -14,7 +14,7 @@ class HotelCalendarManagement(models.TransientModel):
|
||||
_name = 'hotel.calendar.management'
|
||||
|
||||
# Business methods
|
||||
@api.multi
|
||||
|
||||
def get_hcalendar_settings(self):
|
||||
return {
|
||||
'eday_week': self.env.user.hotel_id.pms_end_day_week,
|
||||
|
||||
@@ -7,7 +7,7 @@ class HotelFolio(models.Model):
|
||||
_inherit = 'hotel.folio'
|
||||
|
||||
# ORM overrides
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
ret = super(HotelFolio, self).write(vals)
|
||||
fields_to_check = ('reservation_ids', 'service_ids', 'pending_amount')
|
||||
@@ -17,7 +17,7 @@ class HotelFolio(models.Model):
|
||||
record.reservation_ids.send_bus_notification('write', 'noshow')
|
||||
return ret
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
for record in self:
|
||||
record.reservation_ids.send_bus_notification('unlink', 'warn',
|
||||
@@ -25,7 +25,7 @@ class HotelFolio(models.Model):
|
||||
return super(HotelFolio, self).unlink()
|
||||
|
||||
# Business methods
|
||||
@api.multi
|
||||
|
||||
def compute_amount(self):
|
||||
ret = super(HotelFolio, self).compute_amount()
|
||||
with self.env.norecompute():
|
||||
|
||||
@@ -19,7 +19,7 @@ class HotelReservation(models.Model):
|
||||
store=True)
|
||||
|
||||
# TODO: Add the following method into _compute_color
|
||||
@api.multi
|
||||
|
||||
def _generate_color(self):
|
||||
self.ensure_one()
|
||||
company_id = self.env.user.company_id
|
||||
@@ -77,14 +77,14 @@ class HotelReservation(models.Model):
|
||||
_("Reservation Created"))
|
||||
return reservation_id
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
_logger.info("RESERV WRITE")
|
||||
ret = super(HotelReservation, self).write(vals)
|
||||
self.send_bus_notification('write', 'noshow')
|
||||
return ret
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
self.send_bus_notification('unlink',
|
||||
'warn',
|
||||
@@ -429,7 +429,7 @@ class HotelReservation(models.Model):
|
||||
'show_num_rooms': self.env.user.hotel_id.pms_show_num_rooms,
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
def generate_bus_values(self, naction, ntype, ntitle=''):
|
||||
self.ensure_one()
|
||||
return {
|
||||
@@ -475,7 +475,7 @@ class HotelReservation(models.Model):
|
||||
if service.product_id.show_in_calendar] or False,
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
def send_bus_notification(self, naction, ntype, ntitle=''):
|
||||
hotel_cal_obj = self.env['bus.hotel.calendar']
|
||||
for record in self:
|
||||
|
||||
@@ -28,7 +28,7 @@ class HotelRoomTypeRestrictionItem(models.Model):
|
||||
})
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
ret_vals = super(HotelRoomTypeRestrictionItem, self).write(vals)
|
||||
bus_hotel_calendar_obj = self.env['bus.hotel.calendar']
|
||||
@@ -48,7 +48,7 @@ class HotelRoomTypeRestrictionItem(models.Model):
|
||||
})
|
||||
return ret_vals
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
default_restriction_id = self.env.user.hotel_id.default_restriction_id.id
|
||||
# Construct dictionary with relevant info of removed records
|
||||
|
||||
@@ -37,7 +37,7 @@ class ProductPricelistItem(models.Model):
|
||||
})
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
|
||||
pricelist_default_id = self.env['ir.default'].sudo().get(
|
||||
@@ -77,7 +77,7 @@ class ProductPricelistItem(models.Model):
|
||||
})
|
||||
return ret_vals
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
# TODO: refactoring res.config.settings', 'default_pricelist_id' by the current hotel.property.pricelist_id
|
||||
pricelist_default_id = self.env['ir.default'].sudo().get(
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
<record model="ir.actions.act_window" id="hotel_reservation_action_checkin">
|
||||
<field name="name">Hotel folio checkin</field>
|
||||
<field name="res_model">hotel.reservation</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('real_checkin','=', datetime.datetime.now().strftime('%Y-%m-%d')),
|
||||
('state', 'in', ['confirm']),
|
||||
@@ -14,7 +13,6 @@
|
||||
<record model="ir.actions.act_window" id="hotel_reservation_action_checkout">
|
||||
<field name="name">Hotel folio checkout</field>
|
||||
<field name="res_model">hotel.reservation</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('real_checkout','=', datetime.datetime.now().strftime('%Y-%m-%d')),
|
||||
('state', 'in', ['booking']),
|
||||
@@ -24,7 +22,6 @@
|
||||
<record model="ir.actions.act_window" id="hotel_calendar_action_form_tree">
|
||||
<field name="name">Hotel Calendar</field>
|
||||
<field name="res_model">hotel.calendar</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class HotelCalendarManagement(models.TransientModel):
|
||||
}
|
||||
return vals
|
||||
|
||||
@api.multi
|
||||
|
||||
def save_changes(self, pricelist_id, restriction_id, pricelist,
|
||||
restrictions, availability={}):
|
||||
res = super(HotelCalendarManagement, self).save_changes(
|
||||
|
||||
@@ -8,7 +8,7 @@ _logger = logging.getLogger(__name__)
|
||||
class HotelReservation(models.Model):
|
||||
_inherit = "hotel.reservation"
|
||||
|
||||
@api.multi
|
||||
|
||||
def _hcalendar_reservation_data(self, reservations):
|
||||
vals = super(HotelReservation, self)._hcalendar_reservation_data(reservations)
|
||||
# TODO: Improve performance by doing a SQL as in get_hcalendar_reservations_data()
|
||||
@@ -35,7 +35,7 @@ class HotelReservation(models.Model):
|
||||
# REVIEW: What happens if the reservation is splitted and no parent with channel_bind_ids ¿?
|
||||
return vals
|
||||
|
||||
@api.multi
|
||||
|
||||
def generate_bus_values(self, naction, ntype, ntitle=''):
|
||||
self.ensure_one()
|
||||
vals = super(HotelReservation, self).generate_bus_values(naction, ntype, ntitle)
|
||||
@@ -50,7 +50,7 @@ class HotelReservation(models.Model):
|
||||
})
|
||||
return vals
|
||||
|
||||
@api.multi
|
||||
|
||||
def confirm(self):
|
||||
for record in self:
|
||||
if record.to_assign:
|
||||
|
||||
@@ -25,7 +25,7 @@ class HotelRoomTypeAvailability(models.Model):
|
||||
)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
ret_vals = super(HotelRoomTypeAvailability, self).write(vals)
|
||||
bus_hotel_calendar_obj = self.env['bus.hotel.calendar']
|
||||
@@ -35,7 +35,7 @@ class HotelRoomTypeAvailability(models.Model):
|
||||
)
|
||||
return ret_vals
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
# Construct dictionary with relevant info of removed records
|
||||
unlink_vals = []
|
||||
|
||||
@@ -53,12 +53,12 @@ class ChannelBackend(models.Model):
|
||||
'backend_id',
|
||||
string="OTA's")
|
||||
|
||||
@api.multi
|
||||
|
||||
def generate_key(self):
|
||||
for record in self:
|
||||
record.security_token = binascii.hexlify(os.urandom(16)).decode()
|
||||
|
||||
@api.multi
|
||||
|
||||
def synchronize_push_urls(self):
|
||||
base_url = self.env['ir.config_parameter'].get_param('web.base.url')
|
||||
base_url = base_url.replace("http://", "https://")
|
||||
@@ -66,7 +66,7 @@ class ChannelBackend(models.Model):
|
||||
for record in self:
|
||||
channel_ota_info_obj.push_activation(record, base_url)
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_reservations(self):
|
||||
channel_hotel_reservation_obj = self.env['channel.hotel.reservation']
|
||||
for backend in self:
|
||||
@@ -80,7 +80,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Reservations")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_reservations_range(self):
|
||||
channel_hotel_reservation_obj = self.env['channel.hotel.reservation']
|
||||
for backend in self:
|
||||
@@ -97,7 +97,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Reservations")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_reservation(self):
|
||||
channel_hotel_reservation_obj = self.env['channel.hotel.reservation']
|
||||
for backend in self:
|
||||
@@ -110,7 +110,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Reservations")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_rooms(self):
|
||||
channel_hotel_room_type_obj = self.env['channel.hotel.room.type']
|
||||
for backend in self:
|
||||
@@ -124,7 +124,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Rooms")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_otas_info(self):
|
||||
channel_ota_info_obj = self.env['channel.ota.info']
|
||||
for backend in self:
|
||||
@@ -134,7 +134,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import OTA's")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_availability(self):
|
||||
channel_hotel_room_type_avail_obj = self.env['channel.hotel.room.type.availability']
|
||||
for backend in self:
|
||||
@@ -147,7 +147,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Availability")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def push_availability(self):
|
||||
channel_hotel_room_type_avail_obj = self.env['channel.hotel.room.type.availability']
|
||||
for backend in self:
|
||||
@@ -157,7 +157,7 @@ class ChannelBackend(models.Model):
|
||||
title="Export Availability")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_restriction_plans(self):
|
||||
channel_hotel_room_type_restr_obj = self.env['channel.hotel.room.type.restriction']
|
||||
for backend in self:
|
||||
@@ -171,7 +171,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Restrictions")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_restriction_values(self):
|
||||
channel_hotel_restr_item_obj = self.env['channel.hotel.room.type.restriction.item']
|
||||
for backend in self:
|
||||
@@ -185,7 +185,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Restrictions")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def push_restriction(self):
|
||||
channel_hotel_restr_item_obj = self.env['channel.hotel.room.type.restriction.item']
|
||||
for backend in self:
|
||||
@@ -195,7 +195,7 @@ class ChannelBackend(models.Model):
|
||||
title="Export Restrictions")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_pricelist_plans(self):
|
||||
channel_product_pricelist_obj = self.env['channel.product.pricelist']
|
||||
for backend in self:
|
||||
@@ -209,7 +209,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Pricelists")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def import_pricelist_values(self):
|
||||
channel_product_pricelist_item_obj = self.env['channel.product.pricelist.item']
|
||||
for backend in self:
|
||||
@@ -223,7 +223,7 @@ class ChannelBackend(models.Model):
|
||||
title="Import Pricelists")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def push_pricelist(self):
|
||||
channel_product_pricelist_item_obj = self.env['channel.product.pricelist.item']
|
||||
for backend in self:
|
||||
@@ -233,7 +233,7 @@ class ChannelBackend(models.Model):
|
||||
title="Export Pricelists")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def close_online_sales(self):
|
||||
channel_hotel_restr_item_obj = self.env['channel.hotel.room.type.restriction.item']
|
||||
for backend in self:
|
||||
@@ -243,7 +243,7 @@ class ChannelBackend(models.Model):
|
||||
title="Export Restrictions")
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def channel_availability_watchdog(self):
|
||||
# search all availability to the future TODO: It not prepared for multiple backends
|
||||
availabilities = self.env['hotel.room.type.availability'].search([
|
||||
|
||||
@@ -37,17 +37,17 @@ class HotelChannelConnectorIssue(models.Model):
|
||||
title=_("Oops! %s Issue Reported!!") % issue_id.section)
|
||||
return issue_id
|
||||
|
||||
@api.multi
|
||||
|
||||
def mark_readed(self):
|
||||
for record in self:
|
||||
record.to_read = False
|
||||
|
||||
@api.multi
|
||||
|
||||
def toggle_to_read(self):
|
||||
for record in self:
|
||||
record.to_read = not record.to_read
|
||||
|
||||
@api.multi
|
||||
|
||||
def mark_as_read(self):
|
||||
reserv_ids = []
|
||||
for record in self:
|
||||
|
||||
@@ -72,20 +72,20 @@ class ChannelHotelReservation(models.Model):
|
||||
return importer.fetch_bookings(dfrom, dto)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
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')
|
||||
@api.multi
|
||||
|
||||
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)
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
vals = []
|
||||
for record in self:
|
||||
@@ -116,7 +116,7 @@ class ChannelHotelReservation(models.Model):
|
||||
class HotelReservation(models.Model):
|
||||
_inherit = 'hotel.reservation'
|
||||
|
||||
@api.multi
|
||||
|
||||
def _set_access_for_channel_fields(self):
|
||||
for record in self:
|
||||
user = self.env['res.users'].browse(self.env.uid)
|
||||
@@ -215,7 +215,7 @@ class HotelReservation(models.Model):
|
||||
|
||||
return reservation_id
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
if self._context.get('connector_no_export', True) and \
|
||||
(vals.get('checkin') or vals.get('checkout') or
|
||||
@@ -267,7 +267,7 @@ class HotelReservation(models.Model):
|
||||
res = super().write(vals)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
def generate_copy_values(self, checkin=False, checkout=False):
|
||||
self.ensure_one()
|
||||
res = super().generate_copy_values(checkin=checkin, checkout=checkout)
|
||||
@@ -282,7 +282,7 @@ class HotelReservation(models.Model):
|
||||
})
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_reservation_checkout(self):
|
||||
for record in self:
|
||||
if record.state != 'cancelled':
|
||||
@@ -299,7 +299,7 @@ class HotelReservation(models.Model):
|
||||
|
||||
return (json_reservs, json_tooltips)
|
||||
|
||||
@api.multi
|
||||
|
||||
def mark_as_readed(self):
|
||||
self.write({'to_assign': False})
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class ChannelHotelRoomType(models.Model):
|
||||
raise ValidationError(_("OTA's capacity can't be greater than room type capacity"))
|
||||
|
||||
|
||||
@api.multi
|
||||
|
||||
@api.constrains('channel_short_code')
|
||||
def _check_channel_short_code(self):
|
||||
for record in self:
|
||||
@@ -95,7 +95,7 @@ class ChannelHotelRoomType(models.Model):
|
||||
raise ValidationError(_("Chanel short code can't be longer than 4 characters"))
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def create_room(self):
|
||||
self.ensure_one()
|
||||
if not self.external_id:
|
||||
@@ -104,7 +104,7 @@ class ChannelHotelRoomType(models.Model):
|
||||
exporter.create_room(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def modify_room(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -113,7 +113,7 @@ class ChannelHotelRoomType(models.Model):
|
||||
exporter.modify_room(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def delete_room(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -145,7 +145,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))
|
||||
|
||||
@api.multi
|
||||
|
||||
def get_restrictions(self, date, restriction_plan_id):
|
||||
self.ensure_one()
|
||||
restriction = self.env['hotel.room.type.restriction.item'].search([
|
||||
@@ -155,7 +155,7 @@ class HotelRoomType(models.Model):
|
||||
], limit=1)
|
||||
return restriction
|
||||
|
||||
@api.multi
|
||||
|
||||
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 +176,12 @@ class HotelRoomType(models.Model):
|
||||
'default_total_rooms_count': self.total_rooms_count}
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
|
||||
def disconnect_channel_bind_ids(self):
|
||||
# TODO: multichannel rooms is not implemented
|
||||
self.channel_bind_ids.with_context({'connector_no_export': True}).unlink()
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
if 'active' in vals and vals.get('active') is False:
|
||||
self.channel_bind_ids.unlink()
|
||||
|
||||
@@ -20,7 +20,7 @@ class ChannelHotelRoomTypeRestriction(models.Model):
|
||||
ondelete='cascade')
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def create_plan(self):
|
||||
self.ensure_one()
|
||||
if not self.external_id:
|
||||
@@ -29,7 +29,7 @@ class ChannelHotelRoomTypeRestriction(models.Model):
|
||||
exporter.create_rplan(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def update_plan_name(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -38,7 +38,7 @@ class ChannelHotelRoomTypeRestriction(models.Model):
|
||||
exporter.rename_rplan(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def delete_plan(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -62,7 +62,7 @@ class HotelRoomTypeRestriction(models.Model):
|
||||
inverse_name='odoo_id',
|
||||
string='Hotel Channel Connector Bindings')
|
||||
|
||||
@api.multi
|
||||
|
||||
@api.depends('name')
|
||||
def name_get(self):
|
||||
room_type_restriction_obj = self.env['hotel.room.type.restriction']
|
||||
@@ -80,7 +80,7 @@ class HotelRoomTypeRestriction(models.Model):
|
||||
names.append((name[0], name[1]))
|
||||
return names
|
||||
|
||||
@api.multi
|
||||
|
||||
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_restriction_action').read()[0]
|
||||
@@ -98,12 +98,12 @@ class HotelRoomTypeRestriction(models.Model):
|
||||
}
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
|
||||
def disconnect_channel_bind_ids(self):
|
||||
# TODO: multichannel rooms is not implemented
|
||||
self.channel_bind_ids.with_context({'connector_no_export': True}).unlink()
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
if 'active' in vals and vals.get('active') is False:
|
||||
self.channel_bind_ids.unlink()
|
||||
|
||||
@@ -28,7 +28,7 @@ class HotelFolio(models.Model):
|
||||
importer = work.component(usage='channel.importer')
|
||||
importer.fetch_new_bookings()
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_confirm(self):
|
||||
for rec in self:
|
||||
rec.reservation_ids.write({
|
||||
@@ -36,7 +36,7 @@ class HotelFolio(models.Model):
|
||||
})
|
||||
return super().action_confirm()
|
||||
|
||||
@api.multi
|
||||
|
||||
def get_grouped_reservations_json(self, state, import_all=False):
|
||||
super().get_grouped_reservations_json(state, import_all=import_all)
|
||||
self.ensure_one()
|
||||
|
||||
@@ -9,7 +9,7 @@ from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||
class HotelRoom(models.Model):
|
||||
_inherit = 'hotel.room'
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
"""
|
||||
Update default availability for segmentation management
|
||||
|
||||
@@ -10,14 +10,14 @@ class HotelRoomTypeClass(models.Model):
|
||||
|
||||
_locked_codes = []
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
for record in self:
|
||||
if record.code_class in self._locked_codes:
|
||||
raise ValidationError(_("Can't modify channel room type class"))
|
||||
return super(HotelRoomTypeClass, self).write(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
for record in self:
|
||||
if record.code_class in self._locked_codes:
|
||||
|
||||
@@ -22,7 +22,7 @@ class ChannelProductPricelist(models.Model):
|
||||
ondelete='cascade')
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def create_plan(self):
|
||||
self.ensure_one()
|
||||
if not self.external_id:
|
||||
@@ -31,7 +31,7 @@ class ChannelProductPricelist(models.Model):
|
||||
exporter.create_plan(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def create_vplan(self):
|
||||
self.ensure_one()
|
||||
if not self.external_id:
|
||||
@@ -40,7 +40,7 @@ class ChannelProductPricelist(models.Model):
|
||||
exporter.create_vplan(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def modify_vplan(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -49,7 +49,7 @@ class ChannelProductPricelist(models.Model):
|
||||
exporter.modify_vplan(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def update_plan_name(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -58,7 +58,7 @@ class ChannelProductPricelist(models.Model):
|
||||
exporter.update_plan_name(self)
|
||||
|
||||
@job(default_channel='root.channel')
|
||||
@api.multi
|
||||
|
||||
def delete_plan(self):
|
||||
self.ensure_one()
|
||||
if self.external_id:
|
||||
@@ -103,7 +103,7 @@ class ProductPricelist(models.Model):
|
||||
for item in record.item_ids):
|
||||
record.is_virtual_plan = False
|
||||
|
||||
@api.multi
|
||||
|
||||
@api.depends('name')
|
||||
def name_get(self):
|
||||
pricelist_obj = self.env['product.pricelist']
|
||||
@@ -121,7 +121,7 @@ class ProductPricelist(models.Model):
|
||||
names.append((name[0], name[1]))
|
||||
return names
|
||||
|
||||
@api.multi
|
||||
|
||||
def open_channel_bind_ids(self):
|
||||
channel_bind_ids = self.mapped('channel_bind_ids')
|
||||
action = self.env.ref('hotel_channel_connector.channel_product_pricelist_action').read()[0]
|
||||
@@ -140,12 +140,12 @@ class ProductPricelist(models.Model):
|
||||
}
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
|
||||
def disconnect_channel_bind_ids(self):
|
||||
# TODO: multichannel rooms is not implemented
|
||||
self.channel_bind_ids.with_context({'connector_no_export': True}).unlink()
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
if 'active' in vals and vals.get('active') is False:
|
||||
self.channel_bind_ids.unlink()
|
||||
|
||||
@@ -40,7 +40,7 @@ class TestHotelWubook(TestHotel):
|
||||
def _init_mock_hotel(cls):
|
||||
super(TestHotelWubook, cls)._init_mock_hotel()
|
||||
|
||||
@api.multi
|
||||
|
||||
def wubook_ommit(self, *args, **kwargs):
|
||||
return True
|
||||
|
||||
|
||||
@@ -205,7 +205,6 @@
|
||||
<record id="action_channel_backend" model="ir.actions.act_window">
|
||||
<field name="name">Hotel Channel Backends</field>
|
||||
<field name="res_model">channel.backend</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="channel_backend_view_tree"/>
|
||||
</record>
|
||||
|
||||
@@ -30,9 +30,7 @@
|
||||
<record id="channel_hotel_room_type_restriction_action" model="ir.actions.act_window">
|
||||
<field name="name">Hotel Channel Connector Bindings</field>
|
||||
<field name="res_model">channel.hotel.room.type.restriction</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[]</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -63,9 +63,7 @@
|
||||
<record id="channel_hotel_room_type_action" model="ir.actions.act_window">
|
||||
<field name="name">Hotel Channel Connector Bindings</field>
|
||||
<field name="res_model">channel.hotel.room.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[]</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
||||
@@ -32,9 +32,7 @@
|
||||
<record id="channel_product_pricelist_action" model="ir.actions.act_window">
|
||||
<field name="name">Hotel Channel Connector Bindings</field>
|
||||
<field name="res_model">channel.product.pricelist</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[]</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -77,7 +77,6 @@
|
||||
<record model="ir.actions.act_window" id="open_hotel_channel_connector_issue_tree_all">
|
||||
<field name="name">Hotel Channel Connector Issues</field>
|
||||
<field name="res_model">hotel.channel.connector.issue</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="search_view_id" ref="view_hotel_channel_connector_issue_form_search"/>
|
||||
<field name="context">{"search_default_to_read":True}</field>
|
||||
|
||||
@@ -56,7 +56,6 @@
|
||||
<record model="ir.actions.act_window" id="hotel_room_type_availability_action">
|
||||
<field name="name">Room Type Availability</field>
|
||||
<field name="res_model">hotel.room.type.availability</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -63,13 +63,13 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
'mail_create_nosubscribe': True,
|
||||
}).create(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
def massive_change(self):
|
||||
res = super(MassiveChangesWizard, self).massive_change()
|
||||
self.env['channel.backend'].cron_push_changes()
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
def massive_change_close(self):
|
||||
res = super(MassiveChangesWizard, self).massive_change_close()
|
||||
self.env['channel.backend'].cron_push_changes()
|
||||
|
||||
@@ -7,7 +7,7 @@ from odoo import models, api, _
|
||||
class MassivePriceChangeWizard(models.TransientModel):
|
||||
_inherit = 'hotel.wizard.massive.price.reservation.days'
|
||||
|
||||
@api.multi
|
||||
|
||||
def massive_price_change_days(self):
|
||||
self.ensure_one()
|
||||
hotel_reservation_obj = self.env['hotel.reservation']
|
||||
|
||||
@@ -35,7 +35,7 @@ class ChannelBackend(models.Model):
|
||||
default=_get_default_wubook_parity)
|
||||
|
||||
@contextmanager
|
||||
@api.multi
|
||||
|
||||
def work_on(self, model_name, **kwargs):
|
||||
self.ensure_one()
|
||||
wubook_login = WuBookLogin(
|
||||
|
||||
@@ -51,7 +51,7 @@ class ChannelHotelReservation(models.Model):
|
||||
class HotelReservation(models.Model):
|
||||
_inherit = 'hotel.reservation'
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_cancel(self):
|
||||
for record in self:
|
||||
# Can't cancel in Odoo
|
||||
@@ -63,7 +63,7 @@ class HotelReservation(models.Model):
|
||||
|
||||
return super(HotelReservation, self).action_cancel()
|
||||
|
||||
@api.multi
|
||||
|
||||
def confirm(self):
|
||||
for record in self:
|
||||
if record.is_from_ota:
|
||||
|
||||
@@ -10,14 +10,14 @@ class HotelRoomTypeClass(models.Model):
|
||||
|
||||
_locked_codes = ('1', '2', '3', '4', '5', '6', '7', '8')
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
for record in self:
|
||||
if record.code_class in self._locked_codes:
|
||||
raise ValidationError(_("Can't modify channel room type class"))
|
||||
return super(HotelRoomTypeClass, self).write(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
for record in self:
|
||||
if record.code_class in self._locked_codes:
|
||||
|
||||
@@ -39,7 +39,7 @@ class TestHotelWubook(TestHotel):
|
||||
def _init_mock_hotel(cls):
|
||||
super()._init_mock_hotel()
|
||||
|
||||
@api.multi
|
||||
|
||||
def wubook_ommit(self, *args, **kwargs):
|
||||
return True
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ class Inherit_hotel_reservation(models.Model):
|
||||
_inherit = 'hotel.reservation'
|
||||
|
||||
# Default methods
|
||||
@api.multi
|
||||
|
||||
def _compute_door_codes(self):
|
||||
for res in self:
|
||||
entrada = datetime.strptime(
|
||||
@@ -63,7 +63,7 @@ class Inherit_hotel_reservation(models.Model):
|
||||
box_number = fields.Integer('Box Number')
|
||||
box_code = fields.Char('Box code')
|
||||
|
||||
@api.multi
|
||||
|
||||
def doorcode4(self, fecha):
|
||||
# Calculate de Door Code... need a date in String format "%Y-%m-%d"
|
||||
compan = self.env.user.hotel_id
|
||||
|
||||
@@ -28,7 +28,7 @@ class DoorCodeWizard(models.TransientModel):
|
||||
_description = 'Door Code Generator'
|
||||
|
||||
# Default methods
|
||||
@api.multi
|
||||
|
||||
def _get_default_date_start(self):
|
||||
return datetime.now().strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
@@ -41,7 +41,7 @@ class DoorCodeWizard(models.TransientModel):
|
||||
default=_get_default_date_start)
|
||||
door_code = fields.Html("Door code")
|
||||
|
||||
@api.multi
|
||||
|
||||
def check_code(self):
|
||||
reservation = self.env['hotel.reservation']
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ class Wizard(models.TransientModel):
|
||||
adr_screen = fields.Char()
|
||||
rev_screen = fields.Char()
|
||||
|
||||
@api.one
|
||||
def generate_file(self):
|
||||
_logger.warning("Start Export INE XML file")
|
||||
last_day = calendar.monthrange(self.ine_year, self.ine_month)[1]
|
||||
|
||||
@@ -28,7 +28,7 @@ class TourismCategory(models.Model):
|
||||
name = fields.Char('Category', required=True)
|
||||
category_type = fields.Char('Category type', required=True)
|
||||
|
||||
@api.multi
|
||||
|
||||
def name_get(self):
|
||||
data = []
|
||||
for record in self:
|
||||
|
||||
@@ -29,7 +29,7 @@ class CodeIne(models.Model):
|
||||
name = fields.Char('Place', required=True)
|
||||
code = fields.Char('Code', required=True)
|
||||
|
||||
@api.multi
|
||||
|
||||
def name_get(self):
|
||||
data = []
|
||||
for record in self:
|
||||
|
||||
@@ -55,7 +55,7 @@ class HotelCheckinPartner(models.Model):
|
||||
vals.pop('lastname')
|
||||
return super(HotelCheckinPartner, self).create(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
for record in self:
|
||||
if not vals.get('partner_id') and not record.partner_id:
|
||||
@@ -71,7 +71,7 @@ class HotelCheckinPartner(models.Model):
|
||||
vals.pop('lastname')
|
||||
return super(HotelCheckinPartner, self).write(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_on_board(self):
|
||||
self.check_required_fields()
|
||||
return super(HotelCheckinPartner, self).action_on_board()
|
||||
@@ -107,7 +107,7 @@ class HotelCheckinPartner(models.Model):
|
||||
if partner:
|
||||
record.update({'partner_id': partner})
|
||||
|
||||
@api.multi
|
||||
|
||||
def check_required_fields(self):
|
||||
for record in self:
|
||||
missing_fields = []
|
||||
|
||||
@@ -24,7 +24,7 @@ from openerp import models, api
|
||||
class HotelReservation(models.Model):
|
||||
_inherit = 'hotel.reservation'
|
||||
|
||||
@api.multi
|
||||
|
||||
def print_all_checkins(self):
|
||||
checkins = self.env['hotel.checkin.partner']
|
||||
for record in self:
|
||||
|
||||
@@ -91,7 +91,7 @@ class ResPartner(models.Model):
|
||||
duplicated_fields = ['vat', 'document_number']
|
||||
return duplicated_fields
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
if vals.get('vat') and not self._context.get(
|
||||
"ignore_vat_update", False):
|
||||
@@ -198,7 +198,7 @@ class ResPartner(models.Model):
|
||||
"The Document Number %s already exists in another "
|
||||
"partner.") % record.document_number)
|
||||
|
||||
@api.multi
|
||||
|
||||
def open_main_partner(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('base.action_partner_form').read()[0]
|
||||
@@ -439,7 +439,7 @@ class ResPartner(models.Model):
|
||||
reverse=True,
|
||||
)
|
||||
|
||||
@api.multi
|
||||
|
||||
def _compute_models(self):
|
||||
""" Compute the different models needed by the system if you want to exclude some partners. """
|
||||
model_mapping = {}
|
||||
|
||||
@@ -39,7 +39,6 @@ class PoliceWizard(models.TransientModel):
|
||||
log_police = fields.Char()
|
||||
error_partner = fields.Many2one('res.partner')
|
||||
|
||||
@api.one
|
||||
def generate_file(self):
|
||||
company = self.env.user.company_id
|
||||
if company.police_number is not False and company.property_name is not False:
|
||||
|
||||
@@ -45,13 +45,13 @@ class KellysWizard(models.TransientModel):
|
||||
required=True,
|
||||
help='Establece el orden en el que se imprimira el listado')
|
||||
|
||||
@api.multi
|
||||
|
||||
def calculate_report(self):
|
||||
self.habitaciones = self.calculalimpiar(
|
||||
datetime.strptime(self.date_start, "%Y-%m-%d"))
|
||||
return
|
||||
|
||||
@api.multi
|
||||
|
||||
def calculalimpiar(self, fechalimpieza=datetime.now()):
|
||||
dates = datetime.strftime(fechalimpieza, "%Y-%m-%d")
|
||||
grids = self.env['hotel.room'].search([], order='sequence ASC')
|
||||
@@ -113,7 +113,7 @@ class KellysWizard(models.TransientModel):
|
||||
}).id)
|
||||
return self.env['kellysrooms'].search([('id', 'in', listid)])
|
||||
|
||||
@api.multi
|
||||
|
||||
def print_rooms_report(self):
|
||||
rooms = self.env['kellysrooms'].search([('id', 'in',
|
||||
self.habitaciones.ids)],
|
||||
|
||||
@@ -5,7 +5,7 @@ from odoo import models,api
|
||||
class MailComposer(models.TransientModel):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
@api.multi
|
||||
|
||||
def get_mail_values(self, res_ids):
|
||||
res = super(MailComposer, self).get_mail_values(res_ids)
|
||||
if self.composition_mode == 'comment':
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
'name': 'pms',
|
||||
'summary': "A property management system",
|
||||
'version': '11.0.2.0.0',
|
||||
'version': '13.0.1.0.0',
|
||||
'development_status': 'Beta',
|
||||
'category': 'Generic Modules/Property Management System',
|
||||
'website': 'https://github.com/hootel/hootel',
|
||||
@@ -13,14 +13,13 @@
|
||||
'Jose Luis Algara, '
|
||||
'Pablo Quesada ',
|
||||
'license': "AGPL-3",
|
||||
'application': False,
|
||||
'application': True,
|
||||
'installable': True,
|
||||
'depends': [
|
||||
'base',
|
||||
'mail',
|
||||
'account_payment_return',
|
||||
'partner_firstname',
|
||||
'account_cancel',
|
||||
'email_template_qweb'
|
||||
],
|
||||
'data': [
|
||||
|
||||
@@ -6,8 +6,8 @@ import json
|
||||
from odoo.tools import float_is_zero
|
||||
|
||||
|
||||
class AccountInvoice(models.Model):
|
||||
_inherit = 'account.invoice'
|
||||
class AccountMove(models.Model):
|
||||
_inherit = 'account.move'
|
||||
|
||||
# Field Declarations
|
||||
folio_ids = fields.Many2many(
|
||||
@@ -23,20 +23,20 @@ class AccountInvoice(models.Model):
|
||||
compute='_get_outstanding_folios_JSON')
|
||||
|
||||
# Compute and Search methods
|
||||
@api.multi
|
||||
|
||||
def _computed_folio_origin(self):
|
||||
for inv in self:
|
||||
folios = inv.mapped('invoice_line_ids.reservation_ids.folio_id')
|
||||
folios |= inv.mapped('invoice_line_ids.service_ids.folio_id')
|
||||
folios = inv.mapped('move_line_ids.reservation_ids.folio_id')
|
||||
folios |= inv.mapped('move_line_ids.service_ids.folio_id')
|
||||
if folios:
|
||||
inv.from_folio = True
|
||||
inv.folio_ids = [(6, 0, folios.ids)]
|
||||
|
||||
# Action methods
|
||||
@api.multi
|
||||
|
||||
def action_folio_payments(self):
|
||||
self.ensure_one()
|
||||
sales = self.mapped('invoice_line_ids.sale_line_ids.order_id')
|
||||
sales = self.mapped('move_line_ids.sale_line_ids.order_id')
|
||||
folios = self.env['pms.folio'].search([
|
||||
('order_id.id', 'in', sales.ids)
|
||||
])
|
||||
@@ -54,8 +54,8 @@ class AccountInvoice(models.Model):
|
||||
}
|
||||
|
||||
# Business methods
|
||||
@api.one
|
||||
def _get_outstanding_folios_JSON(self):
|
||||
self.ensure_one()
|
||||
self.outstanding_folios_debits_widget = json.dumps(False)
|
||||
if self.from_folio:
|
||||
payment_ids = self.folio_ids.mapped('payment_ids.id')
|
||||
@@ -82,7 +82,7 @@ class AccountInvoice(models.Model):
|
||||
info = {'title': '',
|
||||
'outstanding': True,
|
||||
'content': [],
|
||||
'invoice_id': self.id}
|
||||
'move_id': self.id}
|
||||
lines = self.env['account.move.line'].search(domain)
|
||||
currency_id = self.currency_id
|
||||
if len(lines) != 0:
|
||||
|
||||
@@ -4,22 +4,22 @@
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountInvoiceLine(models.Model):
|
||||
_inherit = 'account.invoice.line'
|
||||
class AccountMoveLine(models.Model):
|
||||
_inherit = 'account.move.line'
|
||||
|
||||
# Fields declaration
|
||||
reservation_ids = fields.Many2many(
|
||||
'pms.reservation',
|
||||
'reservation_invoice_rel',
|
||||
'invoice_line_id', 'reservation_id',
|
||||
'reservation_move_rel',
|
||||
'move_line_id', 'reservation_id',
|
||||
string='Reservations', readonly=True, copy=False)
|
||||
service_ids = fields.Many2many(
|
||||
'pms.service',
|
||||
'service_line_invoice_rel',
|
||||
'invoice_line_id', 'service_id',
|
||||
'service_line_move_rel',
|
||||
'move_line_id', 'service_id',
|
||||
string='Services', readonly=True, copy=False)
|
||||
reservation_line_ids = fields.Many2many(
|
||||
'pms.reservation.line',
|
||||
'reservation_line_invoice_rel',
|
||||
'invoice_line_id', 'reservation_line_id',
|
||||
'reservation_line_move_rel',
|
||||
'move_line_id', 'reservation_line_id',
|
||||
string='Reservation Lines', readonly=True, copy=False)
|
||||
|
||||
@@ -20,7 +20,7 @@ class AccountPayment(models.Model):
|
||||
save_journal_id = fields.Integer()
|
||||
|
||||
# Compute and Search methods
|
||||
@api.multi
|
||||
|
||||
@api.depends('state')
|
||||
def _compute_folio_amount(self):
|
||||
# FIXME: Finalize method
|
||||
@@ -52,7 +52,7 @@ class AccountPayment(models.Model):
|
||||
|
||||
# Action methods
|
||||
"""WIP"""
|
||||
@api.multi
|
||||
|
||||
def return_payment_folio(self):
|
||||
journal = self.journal_id
|
||||
partner = self.partner_id
|
||||
@@ -81,7 +81,7 @@ class AccountPayment(models.Model):
|
||||
return_pay.action_confirm()
|
||||
|
||||
# Business methods
|
||||
@api.multi
|
||||
|
||||
def modify(self):
|
||||
self.cancel()
|
||||
vals = {
|
||||
@@ -109,7 +109,7 @@ class AccountPayment(models.Model):
|
||||
self.save_journal_id).name, self.journal_id.name)
|
||||
self.folio_id.message_post(subject=_('Payment'), body=msg)
|
||||
|
||||
@api.multi
|
||||
|
||||
def delete(self):
|
||||
msg = False
|
||||
if self.folio_id:
|
||||
@@ -121,7 +121,7 @@ class AccountPayment(models.Model):
|
||||
if msg:
|
||||
self.folio_id.message_post(subject=_('Payment Deleted'), body=msg)
|
||||
|
||||
@api.multi
|
||||
|
||||
def post(self):
|
||||
rec = super(AccountPayment, self).post()
|
||||
if rec and not self._context.get("ignore_notification_post", False):
|
||||
@@ -133,11 +133,11 @@ class AccountPayment(models.Model):
|
||||
pay.communication, pay.journal_id.name)
|
||||
pay.folio_id.message_post(subject=_('Payment'), body=msg)
|
||||
|
||||
@api.multi
|
||||
|
||||
def modify_payment(self):
|
||||
self.ensure_one()
|
||||
view_form_id = self.env.ref('pms.account_payment_view_form_folio').id
|
||||
# invoices = self.mapped('invoice_ids.id')
|
||||
# moves = self.mapped('move_ids.id')
|
||||
return{
|
||||
'name': _('Payment'),
|
||||
'view_type': 'form',
|
||||
|
||||
@@ -7,7 +7,7 @@ from odoo import api, models
|
||||
class MailComposeMessage(models.TransientModel):
|
||||
_inherit = 'mail.compose.message'
|
||||
|
||||
@api.multi
|
||||
|
||||
def send_mail(self, auto_commit=False):
|
||||
if self._context.get('default_model') == 'pms.folio' and \
|
||||
self._context.get('default_res_id') and \
|
||||
|
||||
@@ -17,7 +17,7 @@ class PaymentReturn(models.Model):
|
||||
related='folio_id.pms_property_id')
|
||||
|
||||
# Business methods
|
||||
@api.multi
|
||||
|
||||
def action_confirm(self):
|
||||
pay = super(PaymentReturn, self).action_confirm()
|
||||
if pay:
|
||||
|
||||
@@ -22,6 +22,6 @@ class ResUsers(models.Model):
|
||||
'pms.property',
|
||||
'pms_property_users_rel',
|
||||
'user_id',
|
||||
'property_id',
|
||||
'pms_property_id',
|
||||
string='Properties',
|
||||
default=_get_default_pms_property)
|
||||
|
||||
@@ -13,7 +13,7 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
_description = 'Board Service included in Room'
|
||||
|
||||
# Default Methods ang Gets
|
||||
@api.multi
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for res in self:
|
||||
@@ -100,7 +100,7 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
can't repeat without pricelist"))
|
||||
|
||||
# Action methods
|
||||
@api.multi
|
||||
|
||||
def open_board_lines_form(self):
|
||||
action = self.env.ref(
|
||||
'pms.action_pms_board_service_room_type_view').read()[0]
|
||||
@@ -111,7 +111,6 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
return action
|
||||
|
||||
# ORM Overrides
|
||||
@api.model_cr
|
||||
def init(self):
|
||||
self._cr.execute(
|
||||
'SELECT indexname FROM pg_indexes WHERE indexname = %s',
|
||||
@@ -131,7 +130,7 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
)
|
||||
return super(PmsBoardServiceRoomType, self).create(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
if 'pms_board_service_id' in vals:
|
||||
vals.update(
|
||||
|
||||
@@ -111,7 +111,7 @@ class PmsCheckinPartner(models.Model):
|
||||
track_visibility='onchange')
|
||||
|
||||
# Constraints and onchanges
|
||||
@api.multi
|
||||
|
||||
@api.constrains('exit_date', 'enter_date')
|
||||
def _check_exit_date(self):
|
||||
for record in self:
|
||||
@@ -133,7 +133,7 @@ class PmsCheckinPartner(models.Model):
|
||||
_('Departure date, is prior to arrival. Check it now. %s') %
|
||||
date_out)
|
||||
|
||||
@api.multi
|
||||
|
||||
@api.onchange('partner_id')
|
||||
def _check_partner_id(self):
|
||||
for record in self:
|
||||
@@ -152,7 +152,7 @@ class PmsCheckinPartner(models.Model):
|
||||
_('This guest is already registered in the room'))
|
||||
|
||||
# Action methods
|
||||
@api.multi
|
||||
|
||||
def action_on_board(self):
|
||||
for record in self:
|
||||
if record.reservation_id.checkin > fields.Date.today():
|
||||
@@ -185,7 +185,7 @@ class PmsCheckinPartner(models.Model):
|
||||
"type": "ir.actions.do_nothing",
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_done(self):
|
||||
for record in self:
|
||||
if record.state == 'booking':
|
||||
|
||||
@@ -113,8 +113,8 @@ class PmsFolio(models.Model):
|
||||
checkin_partner_ids = fields.One2many(
|
||||
'pms.checkin.partner',
|
||||
'folio_id')
|
||||
invoice_ids = fields.Many2many(
|
||||
'account.invoice',
|
||||
move_ids = fields.Many2many(
|
||||
'account.move',
|
||||
string='Invoices',
|
||||
compute='_get_invoiced',
|
||||
readonly=True,
|
||||
@@ -279,14 +279,14 @@ class PmsFolio(models.Model):
|
||||
refund is not directly linked to the Folio.
|
||||
"""
|
||||
for folio in self:
|
||||
invoice_ids = folio.reservation_ids.mapped('invoice_line_ids').\
|
||||
mapped('invoice_id').filtered(lambda r: r.type in [
|
||||
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('invoice_line_ids').mapped(
|
||||
'invoice_id').filtered(lambda r: r.type in [
|
||||
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'
|
||||
# (filter_refund = 'modify' in 'account.invoice.refund')
|
||||
# (filter_refund = 'modify' in 'account.move.refund')
|
||||
# use like as origin may contains multiple references
|
||||
# (e.g. 'SO01, SO02')
|
||||
refunds = invoice_ids.search([
|
||||
@@ -296,7 +296,7 @@ class PmsFolio(models.Model):
|
||||
invoice_ids |= refunds.filtered(
|
||||
lambda r: folio.id in r.folio_ids.ids)
|
||||
# Search for refunds as well
|
||||
refund_ids = self.env['account.invoice'].browse()
|
||||
refund_ids = self.env['account.move'].browse()
|
||||
if invoice_ids:
|
||||
for inv in invoice_ids:
|
||||
refund_ids += refund_ids.search([
|
||||
@@ -330,8 +330,8 @@ class PmsFolio(models.Model):
|
||||
invoice_status = 'no'
|
||||
|
||||
folio.update({
|
||||
'invoice_count': len(set(invoice_ids.ids + refund_ids.ids)),
|
||||
'invoice_ids': invoice_ids.ids + refund_ids.ids,
|
||||
'invoice_count': len(set(move_ids.ids + refund_ids.ids)),
|
||||
'invoice_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')
|
||||
@api.multi
|
||||
|
||||
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.multi
|
||||
|
||||
@api.onchange('partner_id')
|
||||
def onchange_partner_id(self):
|
||||
"""
|
||||
@@ -478,13 +478,13 @@ class PmsFolio(models.Model):
|
||||
"""
|
||||
if not self.partner_id:
|
||||
self.update({
|
||||
'partner_invoice_id': False,
|
||||
'partner_move_id': False,
|
||||
'payment_term_id': False,
|
||||
'fiscal_position_id': False,
|
||||
})
|
||||
return
|
||||
|
||||
addr = self.partner_id.address_get(['invoice'])
|
||||
addr = self.partner_id.address_get(['move'])
|
||||
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.multi
|
||||
|
||||
@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
|
||||
@api.multi
|
||||
|
||||
def action_pay(self):
|
||||
self.ensure_one()
|
||||
partner = self.partner_id.id
|
||||
@@ -541,31 +541,31 @@ class PmsFolio(models.Model):
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
@api.multi
|
||||
def open_invoices_folio(self):
|
||||
invoices = self.mapped('invoice_ids')
|
||||
action = self.env.ref('account.action_invoice_tree1').read()[0]
|
||||
|
||||
def open_moves_folio(self):
|
||||
invoices = self.mapped('move_ids')
|
||||
action = self.env.ref('account.action_move_out_invoice_type').read()[0]
|
||||
if len(invoices) > 1:
|
||||
action['domain'] = [('id', 'in', invoices.ids)]
|
||||
elif len(invoices) == 1:
|
||||
action['views'] = [
|
||||
(self.env.ref('account.invoice_form').id, 'form')]
|
||||
(self.env.ref('account.view_move_form').id, 'form')]
|
||||
action['res_id'] = invoices.ids[0]
|
||||
else:
|
||||
action = {'type': 'ir.actions.act_window_close'}
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_return_payments(self):
|
||||
self.ensure_one()
|
||||
return_move_ids = []
|
||||
acc_pay_obj = self.env['account.payment']
|
||||
payments = acc_pay_obj.search([
|
||||
'|',
|
||||
('invoice_ids', 'in', self.invoice_ids.ids),
|
||||
('move_ids', 'in', self.move_ids.ids),
|
||||
('folio_id', '=', self.id)
|
||||
])
|
||||
return_move_ids += self.invoice_ids.filtered(
|
||||
return_move_ids += self.move_ids.filtered(
|
||||
lambda invoice: invoice.type == 'out_refund').mapped(
|
||||
'payment_move_line_ids.move_id.id')
|
||||
return_lines = self.env['payment.return.line'].search([
|
||||
@@ -582,7 +582,7 @@ class PmsFolio(models.Model):
|
||||
'domain': [('id', 'in', return_move_ids)],
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_checks(self):
|
||||
self.ensure_one()
|
||||
rooms = self.mapped('reservation_ids.id')
|
||||
@@ -596,7 +596,7 @@ class PmsFolio(models.Model):
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
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'
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_done(self):
|
||||
reservation_ids = self.mapped('reservation_ids')
|
||||
for line in reservation_ids:
|
||||
if line.state == "booking":
|
||||
line.action_reservation_checkout()
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
"""
|
||||
|
||||
@api.multi
|
||||
|
||||
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)
|
||||
|
||||
@api.multi
|
||||
|
||||
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'])
|
||||
|
||||
@api.multi
|
||||
|
||||
def _get_tax_amount_by_group(self):
|
||||
self.ensure_one()
|
||||
res = {}
|
||||
|
||||
@@ -163,11 +163,11 @@ class PmsReservation(models.Model):
|
||||
string='Taxes',
|
||||
ondelete='restrict',
|
||||
domain=['|', ('active', '=', False), ('active', '=', True)])
|
||||
invoice_line_ids = fields.Many2many(
|
||||
'account.invoice.line',
|
||||
'reservation_invoice_rel',
|
||||
move_line_ids = fields.Many2many(
|
||||
'account.move.line',
|
||||
'reservation_move_rel',
|
||||
'reservation_id',
|
||||
'invoice_line_id',
|
||||
'move_line_id',
|
||||
string='Invoice Lines',
|
||||
copy=False)
|
||||
analytic_tag_ids = fields.Many2many(
|
||||
@@ -386,8 +386,8 @@ class PmsReservation(models.Model):
|
||||
else:
|
||||
line.qty_to_invoice = 0
|
||||
|
||||
@api.depends('invoice_line_ids.invoice_id.state',
|
||||
'invoice_line_ids.quantity')
|
||||
@api.depends('move_line_ids.move_id.state',
|
||||
'move_line_ids.quantity')
|
||||
def _get_invoice_qty(self):
|
||||
"""
|
||||
Compute the quantity invoiced. If case of a refund, the quantity
|
||||
@@ -397,12 +397,12 @@ class PmsReservation(models.Model):
|
||||
for line in self:
|
||||
qty_invoiced = 0.0
|
||||
for day in line.reservation_line_ids:
|
||||
invoice_lines = day.invoice_line_ids.filtered(
|
||||
lambda r: r.invoice_id.state != 'cancel')
|
||||
invoice_lines = day.move_line_ids.filtered(
|
||||
lambda r: r.move_id.state != 'cancel')
|
||||
qty_invoiced += len(invoice_lines.filtered(
|
||||
lambda r: r.invoice_id.type == 'out_invoice')
|
||||
lambda r: r.move_id.type == 'out_invoice')
|
||||
) - len(invoice_lines.filtered(
|
||||
lambda r: r.invoice_id.type ==
|
||||
lambda r: r.move_id.type ==
|
||||
'out_refund'))
|
||||
line.qty_invoiced = qty_invoiced
|
||||
|
||||
@@ -512,7 +512,7 @@ class PmsReservation(models.Model):
|
||||
reservation period: %s ') % occupied_name
|
||||
raise ValidationError(warning_msg)
|
||||
|
||||
@api.multi
|
||||
|
||||
@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.multi
|
||||
|
||||
@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.multi
|
||||
|
||||
@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.multi
|
||||
|
||||
@api.onchange('checkin', 'checkout', 'room_id')
|
||||
def onchange_room_availabiltiy_domain(self):
|
||||
self.ensure_one()
|
||||
@@ -704,15 +704,15 @@ class PmsReservation(models.Model):
|
||||
service.price_unit = service._compute_price_unit()
|
||||
|
||||
# Action methods
|
||||
@api.multi
|
||||
|
||||
def open_invoices_reservation(self):
|
||||
invoices = self.folio_id.mapped('invoice_ids')
|
||||
action = self.env.ref('account.action_invoice_tree1').read()[0]
|
||||
invoices = self.folio_id.mapped('move_ids')
|
||||
action = self.env.ref('account.action_move_out_invoice_type').read()[0]
|
||||
if len(invoices) > 1:
|
||||
action['domain'] = [('id', 'in', invoices.ids)]
|
||||
elif len(invoices) == 1:
|
||||
action['views'] = [
|
||||
(self.env.ref('account.invoice_form').id, 'form')]
|
||||
(self.env.ref('account.view_move_form').id, 'form')]
|
||||
action['res_id'] = invoices.ids[0]
|
||||
else:
|
||||
action = self.env.ref(
|
||||
@@ -721,7 +721,7 @@ class PmsReservation(models.Model):
|
||||
'default_folio_id': self.folio_id.id}
|
||||
return action
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_pay_folio(self):
|
||||
self.ensure_one()
|
||||
return self.folio_id.action_pay()
|
||||
|
||||
@api.multi
|
||||
|
||||
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)
|
||||
|
||||
@api.multi
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for res in self:
|
||||
@@ -853,7 +853,7 @@ class PmsReservation(models.Model):
|
||||
record.confirm()
|
||||
return record
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
if self.notify_update(vals):
|
||||
vals.update({
|
||||
@@ -937,7 +937,7 @@ class PmsReservation(models.Model):
|
||||
return record
|
||||
|
||||
# Business methods
|
||||
@api.multi
|
||||
|
||||
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))
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
def overbooking_button(self):
|
||||
self.ensure_one()
|
||||
self.overbooking = not self.overbooking
|
||||
|
||||
@api.multi
|
||||
|
||||
def generate_copy_values(self, checkin=False, checkout=False):
|
||||
self.ensure_one()
|
||||
return {
|
||||
@@ -1091,7 +1091,7 @@ class PmsReservation(models.Model):
|
||||
STATE WORKFLOW -----------------------------------------------------
|
||||
"""
|
||||
|
||||
@api.multi
|
||||
|
||||
def confirm(self):
|
||||
'''
|
||||
@param self: object pointer
|
||||
@@ -1130,7 +1130,7 @@ class PmsReservation(models.Model):
|
||||
splitted_reservs.confirm()
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def button_done(self):
|
||||
'''
|
||||
@param self: object pointer
|
||||
@@ -1139,7 +1139,7 @@ class PmsReservation(models.Model):
|
||||
record.action_reservation_checkout()
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
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()
|
||||
|
||||
@api.multi
|
||||
|
||||
def compute_cancelation_reason(self):
|
||||
self.ensure_one()
|
||||
pricelist = self.pricelist_id
|
||||
@@ -1184,7 +1184,7 @@ class PmsReservation(models.Model):
|
||||
return 'intime'
|
||||
return False
|
||||
|
||||
@api.multi
|
||||
|
||||
def draft(self):
|
||||
for record in self:
|
||||
record.state = 'draft'
|
||||
@@ -1207,7 +1207,7 @@ class PmsReservation(models.Model):
|
||||
"""
|
||||
PRICE PROCESS ------------------------------------------------------
|
||||
"""
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
def _compute_cancelled_discount(self):
|
||||
self.ensure_one()
|
||||
pricelist = self.pricelist_id
|
||||
@@ -1378,7 +1378,7 @@ class PmsReservation(models.Model):
|
||||
CHECKIN/OUT PROCESS ------------------------------------------------
|
||||
"""
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
@api.multi
|
||||
|
||||
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 []
|
||||
|
||||
@api.multi
|
||||
|
||||
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
|
||||
|
||||
@api.multi
|
||||
|
||||
def action_checks(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref(
|
||||
@@ -1437,7 +1437,7 @@ class PmsReservation(models.Model):
|
||||
RESERVATION SPLITTED -----------------------------------------------
|
||||
"""
|
||||
|
||||
@api.multi
|
||||
|
||||
def split(self, nights):
|
||||
for record in self:
|
||||
date_start_dt = fields.Date.from_string(record.checkin)
|
||||
@@ -1463,7 +1463,7 @@ class PmsReservation(models.Model):
|
||||
'price': rline.price,
|
||||
'cancel_discount': rline.cancel_discount,
|
||||
'discount': rline.discount,
|
||||
'invoice_line_ids': rline.invoice_line_ids,
|
||||
'move_line_ids': rline.move_line_ids,
|
||||
'state': rline.state,
|
||||
}))
|
||||
reservation_lines[0].append((2, rline.id, False))
|
||||
@@ -1490,7 +1490,7 @@ class PmsReservation(models.Model):
|
||||
})
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def unify(self):
|
||||
self.ensure_one()
|
||||
if not self.splitted:
|
||||
@@ -1548,7 +1548,7 @@ class PmsReservation(models.Model):
|
||||
'price': rline.price,
|
||||
'cancel_discount': rline.cancel_discount,
|
||||
'discount': rline.discount,
|
||||
'invoice_line_ids': rline.invoice_line_ids,
|
||||
'move_line_ids': rline.move_line_ids,
|
||||
'state': rline.state,
|
||||
}))
|
||||
|
||||
@@ -1570,7 +1570,7 @@ class PmsReservation(models.Model):
|
||||
})
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def open_master(self):
|
||||
self.ensure_one()
|
||||
if not self.parent_reservation:
|
||||
@@ -1586,15 +1586,15 @@ class PmsReservation(models.Model):
|
||||
MAILING PROCESS
|
||||
"""
|
||||
|
||||
@api.multi
|
||||
|
||||
def send_reservation_mail(self):
|
||||
return self.folio_id.send_reservation_mail()
|
||||
|
||||
@api.multi
|
||||
|
||||
def send_exit_mail(self):
|
||||
return self.folio_id.send_exit_mail()
|
||||
|
||||
@api.multi
|
||||
|
||||
def send_cancel_mail(self):
|
||||
return self.folio_id.send_cancel_mail()
|
||||
|
||||
@@ -1602,7 +1602,7 @@ class PmsReservation(models.Model):
|
||||
INVOICING PROCESS
|
||||
"""
|
||||
|
||||
@api.multi
|
||||
|
||||
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)
|
||||
|
||||
@api.multi
|
||||
|
||||
def set_call_center_user(self):
|
||||
user = self.env['res.users'].browse(self.env.uid)
|
||||
return user.has_group('pms.group_pms_call')
|
||||
|
||||
@@ -11,7 +11,7 @@ class PmsReservationLine(models.Model):
|
||||
_order = "date"
|
||||
|
||||
# Default Methods ang Gets
|
||||
@api.multi
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for res in self:
|
||||
@@ -27,11 +27,11 @@ class PmsReservationLine(models.Model):
|
||||
ondelete='cascade',
|
||||
required=True,
|
||||
copy=False)
|
||||
invoice_line_ids = fields.Many2many(
|
||||
'account.invoice.line',
|
||||
'reservation_line_invoice_rel',
|
||||
move_line_ids = fields.Many2many(
|
||||
'account.move.line',
|
||||
'reservation_line_move_rel',
|
||||
'reservation_line_id',
|
||||
'invoice_line_id',
|
||||
'move_line_id',
|
||||
string='Invoice Lines',
|
||||
readonly=True,
|
||||
copy=False)
|
||||
|
||||
@@ -67,7 +67,7 @@ class PmsRoom(models.Model):
|
||||
of another property."))
|
||||
return super().create(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
for record in self:
|
||||
if vals.get('pms_property_id', record.pms_property_id.id) != record.pms_property_id.id:
|
||||
@@ -86,7 +86,7 @@ class PmsRoom(models.Model):
|
||||
return super().write(vals)
|
||||
|
||||
# Business methods
|
||||
@api.multi
|
||||
|
||||
def get_capacity(self, extra_bed=0):
|
||||
if not self.shared_room_id:
|
||||
return self.capacity + extra_bed
|
||||
|
||||
@@ -80,14 +80,14 @@ class PmsRoomType(models.Model):
|
||||
})
|
||||
return super().create(vals)
|
||||
|
||||
@api.multi
|
||||
|
||||
def unlink(self):
|
||||
for record in self:
|
||||
record.product_id.unlink()
|
||||
return super().unlink()
|
||||
|
||||
# Business methods
|
||||
@api.multi
|
||||
|
||||
def get_capacity(self):
|
||||
self.ensure_one()
|
||||
capacities = self.room_ids.mapped('capacity')
|
||||
|
||||
@@ -29,7 +29,7 @@ class PmsRoomTypeRestrictionItem(models.Model):
|
||||
day for the same room type!')]
|
||||
|
||||
# Constraints and onchanges
|
||||
@api.multi
|
||||
|
||||
@api.constrains('min_stay', 'min_stay_arrival', 'max_stay',
|
||||
'max_stay_arrival')
|
||||
def _check_min_stay(self):
|
||||
|
||||
@@ -17,7 +17,7 @@ class PmsService(models.Model):
|
||||
_description = 'Services and its charges'
|
||||
|
||||
# Default methods
|
||||
@api.multi
|
||||
|
||||
def name_get(self):
|
||||
result = []
|
||||
for rec in self:
|
||||
@@ -77,12 +77,12 @@ class PmsService(models.Model):
|
||||
'account.tax',
|
||||
string='Taxes',
|
||||
domain=['|', ('active', '=', False), ('active', '=', True)])
|
||||
invoice_line_ids = fields.Many2many(
|
||||
'account.invoice.line',
|
||||
'service_line_invoice_rel',
|
||||
move_line_ids = fields.Many2many(
|
||||
'account.move.line',
|
||||
'service_line_move_rel',
|
||||
'service_id',
|
||||
'invoice_line_id',
|
||||
string='Invoice Lines',
|
||||
'move_line_id',
|
||||
string='move Lines',
|
||||
copy=False)
|
||||
analytic_tag_ids = fields.Many2many(
|
||||
'account.analytic.tag',
|
||||
@@ -102,7 +102,7 @@ class PmsService(models.Model):
|
||||
# Non-stored related field to allow portal user to
|
||||
# see the image of the product he has ordered
|
||||
product_image = fields.Binary(
|
||||
'Product Image', related="product_id.image",
|
||||
'Product Image', related="product_id.image_1024",
|
||||
store=False, related_sudo=True)
|
||||
invoice_status = fields.Selection([
|
||||
('invoiced', 'Fully Invoiced'),
|
||||
@@ -169,8 +169,8 @@ class PmsService(models.Model):
|
||||
else:
|
||||
line.qty_to_invoice = 0
|
||||
|
||||
@api.depends('invoice_line_ids.invoice_id.state',
|
||||
'invoice_line_ids.quantity')
|
||||
@api.depends('move_line_ids.move_id.state',
|
||||
'move_line_ids.quantity')
|
||||
def _get_invoice_qty(self):
|
||||
"""
|
||||
Compute the quantity invoiced. If case of a refund,
|
||||
@@ -183,13 +183,13 @@ class PmsService(models.Model):
|
||||
"""
|
||||
for line in self:
|
||||
qty_invoiced = 0.0
|
||||
for invoice_line in line.invoice_line_ids:
|
||||
if invoice_line.invoice_id.state != 'cancel':
|
||||
if invoice_line.invoice_id.type == 'out_invoice':
|
||||
for invoice_line in line.move_line_ids:
|
||||
if invoice_line.move_id.state != 'cancel':
|
||||
if invoice_line.move_id.type == 'out_invoice':
|
||||
qty_invoiced += invoice_line.uom_id._compute_quantity(
|
||||
invoice_line.quantity, line.product_id.uom_id)
|
||||
elif invoice_line.invoice_id.type == 'out_refund':
|
||||
qty_invoiced -= invoice_line.uom_id._compute_quantity(
|
||||
elif invoice_line.move_id.type == 'out_refund':
|
||||
qty_invoiced -= move_line.uom_id._compute_quantity(
|
||||
invoice_line.quantity, line.product_id.uom_id)
|
||||
line.qty_invoiced = qty_invoiced
|
||||
|
||||
@@ -337,7 +337,7 @@ class PmsService(models.Model):
|
||||
record.update(vals)
|
||||
|
||||
# Action methods
|
||||
@api.multi
|
||||
|
||||
def open_service_ids(self):
|
||||
action = self.env.ref('pms.action_pms_services_form').read()[0]
|
||||
action['views'] = [
|
||||
@@ -387,7 +387,7 @@ class PmsService(models.Model):
|
||||
record = super(PmsService, self).create(vals)
|
||||
return record
|
||||
|
||||
@api.multi
|
||||
|
||||
def write(self, vals):
|
||||
# If you write product, We must check if its necesary create or delete
|
||||
# service lines
|
||||
@@ -439,7 +439,7 @@ class PmsService(models.Model):
|
||||
line[field], line)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
|
||||
def compute_lines_out_vals(self, vals):
|
||||
"""
|
||||
Compute if It is necesary service days in write/create
|
||||
@@ -453,7 +453,7 @@ class PmsService(models.Model):
|
||||
return True
|
||||
return False
|
||||
|
||||
@api.multi
|
||||
|
||||
def _compute_tax_ids(self):
|
||||
for record in self:
|
||||
# If company_id is set, always filter taxes by the company
|
||||
@@ -466,7 +466,7 @@ class PmsService(models.Model):
|
||||
lambda r: not record.company_id or
|
||||
r.company_id == origin.company_id)
|
||||
|
||||
@api.multi
|
||||
|
||||
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 +499,7 @@ class PmsService(models.Model):
|
||||
# negative discounts (= surcharge) are included in the display price
|
||||
return max(base_price, final_price)
|
||||
|
||||
@api.multi
|
||||
|
||||
def _compute_price_unit(self):
|
||||
self.ensure_one()
|
||||
folio = self.folio_id or self.env.context.get('default_folio_id')
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="invoice_form" model="ir.ui.view">
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form" />
|
||||
<record id="move_form" model="ir.ui.view">
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='date_invoice']" position="after">
|
||||
<xpath expr="//field[@name='invoice_date']" position="after">
|
||||
<field name="folio_ids" widget="many2many_tags"/>
|
||||
<field name="from_folio" invisible="1" />
|
||||
<field name="pms_property_id" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='%(account.action_account_invoice_payment)d']" position="attributes">
|
||||
<xpath expr="//button[@name='action_invoice_register_payment']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|',('from_folio','=',True)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='outstanding_credits_debits_widget']" position="before">
|
||||
<xpath expr="//field[@name='invoice_outstanding_credits_debits_widget']" position="before">
|
||||
<field name="outstanding_folios_debits_widget" colspan="2" nolabel="1" widget="payment" attrs="{'invisible': [('state', 'not in', 'open')]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
<record model="ir.actions.act_window" id="action_pms_room_amenity_type_view_form">
|
||||
<field name="name">Room amenity Type</field>
|
||||
<field name="res_model">pms.amenity.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!--===== Room Amenities ===== -->
|
||||
<!-- Form view of pms room amenities -->
|
||||
<record id="pms_amenity_view_form" model="ir.ui.view">
|
||||
<field name="name">pms.amenity.form</field>
|
||||
<field name="model">pms.amenity</field>
|
||||
@@ -64,7 +62,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Search view of pms room amenities -->
|
||||
<record model="ir.ui.view" id="pms_amenity_search">
|
||||
<field name="name">pms.room_amenity_search</field>
|
||||
<field name="model">pms.amenity</field>
|
||||
@@ -83,7 +80,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Tree view of pms room amenities -->
|
||||
<record model="ir.ui.view" id="pms_amenity_view_list">
|
||||
<field name="name">pms.room_amenity_list</field>
|
||||
<field name="model">pms.amenity</field>
|
||||
@@ -96,11 +92,9 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Action for pms room amenities -->
|
||||
<record model="ir.actions.act_window" id="action_pms_room_amenity_view_form">
|
||||
<field name="name">Room Amenities</field>
|
||||
<field name="res_model">pms.amenity</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="pms_amenity_view_list" />
|
||||
</record>
|
||||
|
||||
@@ -22,8 +22,7 @@
|
||||
|
||||
<record model="ir.actions.act_window" id="action_pms_board_service_room_type_view">
|
||||
<field name="name">Board Service</field>
|
||||
<field name="res_model">board.service.room.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="res_model">pms.board.service.room.type</field>
|
||||
<field name="view_mode">form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
<record model="ir.actions.act_window" id="open_pms_board_service_form_tree">
|
||||
<field name="name">Board Services</field>
|
||||
<field name="res_model">pms.board.service</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@
|
||||
<record model="ir.actions.act_window" id="action_pms_cancelation_rule">
|
||||
<field name="name">Cancelation Rules</field>
|
||||
<field name="res_model">pms.cancelation.rule</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -103,13 +103,13 @@
|
||||
<search string="Checkin Detail">
|
||||
<field name="partner_id" />
|
||||
<field name="reservation_id" />
|
||||
<filter string="On Board"
|
||||
domain="[('state','in',['booking'])]"
|
||||
<filter string="On Board" name="on_board"
|
||||
domain="[('state','=','booking')]"
|
||||
help="Current Booking" />
|
||||
<filter string="To enter"
|
||||
<filter string="To enter" name="to_enter"
|
||||
domain="[('state', '=', 'draft')]"
|
||||
/>
|
||||
<filter string="Out"
|
||||
<filter string="Out" name="out"
|
||||
domain="[('state', '=', 'done')]"
|
||||
/>
|
||||
<filter string="Checkins Tomorrow" name="enter_tomorrow"
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
<record model="ir.actions.act_window" id="open_pms_floor_form_tree">
|
||||
<field name="name">Floor Structure</field>
|
||||
<field name="res_model">pms.floor</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
<act_window id="action_view_folio_advance_payment_inv"
|
||||
name="Invoice Folio"
|
||||
src_model="pms.folio"
|
||||
binding_model="pms.folio"
|
||||
res_model="folio.advance.payment.inv"
|
||||
key2="client_action_multi" target="new"
|
||||
view_mode="form" multi="True"/>
|
||||
target="new"
|
||||
view_mode="form" />
|
||||
|
||||
<record model="ir.ui.view" id="pms_folio_view_form">
|
||||
<field name="name">pms.folio.form</field>
|
||||
@@ -114,7 +114,7 @@
|
||||
</group>
|
||||
</group>
|
||||
<group invisible="1">
|
||||
<field name="invoice_ids" invisible="1"/>
|
||||
<field name="move_ids" invisible="1"/>
|
||||
<field name="invoice_status" invisible="1" />
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="refund_amount" invisible="1" />
|
||||
@@ -300,11 +300,11 @@
|
||||
domain="[('pending_amount', '>', 0)]" />
|
||||
<group expand="0" string="Group By">
|
||||
<filter string="Customer" icon="terp-stock_symbol-selection"
|
||||
context="{'group_by':'partner_id'}" />
|
||||
name="group_customer" context="{'group_by':'partner_id'}" />
|
||||
<filter string="Invoice Contact"
|
||||
context="{'group_by':'partner_invoice_id'}" />
|
||||
name="group_invoice_contact" context="{'group_by':'partner_invoice_id'}" />
|
||||
<filter string="Tour Operator" domain="[]"
|
||||
context="{'group_by':'tour_operator_id'}"/>
|
||||
name="group_tour_operator" context="{'group_by':'tour_operator_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
@@ -323,12 +323,9 @@
|
||||
|
||||
<act_window name="Send Confirm Mail"
|
||||
res_model="mail.compose.message"
|
||||
src_model="pms.folio"
|
||||
binding_model="pms.folio"
|
||||
view_mode="form"
|
||||
multi="False"
|
||||
view_type="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_folio_send_confirm_mail"
|
||||
context="{
|
||||
'default_model': 'pms.folio',
|
||||
@@ -343,7 +340,6 @@
|
||||
<record model="ir.actions.act_window" id="open_pms_folio1_form_tree_all">
|
||||
<field name="name">Folio</field>
|
||||
<field name="res_model">pms.folio</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,graph</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@
|
||||
<record id="pms_property_action" model="ir.actions.act_window">
|
||||
<field name="name">pmss</field>
|
||||
<field name="res_model">pms.property</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<record model="ir.actions.act_window" id="open_pms_reservation_form_tree_all">
|
||||
<field name="name">Reservation</field>
|
||||
<field name="res_model">pms.reservation</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,graph,pivot</field>
|
||||
<field name="context">{'from_room': True}</field>
|
||||
</record>
|
||||
@@ -557,18 +556,18 @@
|
||||
<field name="folio_id" />
|
||||
<field name="tour_operator_id" />
|
||||
<filter string="My Reservations"
|
||||
domain="[('create_uid', '=', uid)]"
|
||||
name="my_reservations" domain="[('create_uid', '=', uid)]"
|
||||
/>
|
||||
<filter string="Cancelled"
|
||||
domain="[('state', '=', 'cancelled')]"
|
||||
name="cancelled" domain="[('state', '=', 'cancelled')]"
|
||||
/>
|
||||
<filter string="On Board"
|
||||
<filter string="On Board" name="on_board"
|
||||
domain="[('state','in',['booking'])]"
|
||||
help="Current Booking" />
|
||||
<filter string="To enter"
|
||||
<filter string="To enter" name="to_enter"
|
||||
domain="[('state', '=', 'confirm')]"
|
||||
/>
|
||||
<filter string="Overbookings"
|
||||
<filter string="Overbookings" name="overbookings"
|
||||
domain="[('overbooking', '=', 'True')]"
|
||||
/>
|
||||
<filter string="Reservations to 7 days" name="next_res_week"
|
||||
@@ -583,52 +582,52 @@
|
||||
domain="[('checkin', '<', (context_today()+datetime.timedelta(days=30)).strftime('%Y-%m-%d')),
|
||||
('state', '=', 'confirm')]"
|
||||
help="Show all reservations for which date enter is before than aprox. 1 month"/>
|
||||
<filter string="To Assign"
|
||||
<filter string="To Assign" name="to_assign"
|
||||
domain="[('to_assign','=',True)]"
|
||||
/>
|
||||
<separator/>
|
||||
<filter string="Call Center"
|
||||
<filter string="Call Center" name="call_center"
|
||||
domain="[('channel_type', '=', 'call')]"
|
||||
/>
|
||||
<filter string="Web"
|
||||
<filter string="Web" name="web"
|
||||
domain="[('channel_type', '=', 'web')]"
|
||||
/>
|
||||
<filter string="Door"
|
||||
<filter string="Door" name="door"
|
||||
domain="[('channel_type', '=', 'door')]"
|
||||
/>
|
||||
<filter string="Mail"
|
||||
<filter string="Mail" name="mail"
|
||||
domain="[('channel_type', '=', 'mail')]"
|
||||
/>
|
||||
<filter string="Phone"
|
||||
<filter string="Phone" name="phone"
|
||||
domain="[('channel_type', '=', 'phone')]"
|
||||
/>
|
||||
<separator/>
|
||||
<filter string="Still to be paid"
|
||||
<filter string="Still to be paid" name="still_to_be_paid"
|
||||
domain="[('folio_id.pending_amount','>',0)]"
|
||||
/>
|
||||
<filter string="Late Payment"
|
||||
<filter string="Late Payment" name="late_payment"
|
||||
domain="[('folio_id.pending_amount','>',0),('state','in',['done'])]"
|
||||
/>
|
||||
<filter string="Lates and NoShows"
|
||||
<filter string="Lates and NoShows" name="lates_and_noshows"
|
||||
domain="[('cancelled_reason','in',['late','noshow'])]"
|
||||
/>
|
||||
<separator/>
|
||||
<filter string="Staff"
|
||||
<filter string="Staff" name="staff"
|
||||
domain="[('reservation_type','in',['staff'])]"
|
||||
/>
|
||||
<filter string="Out of Service"
|
||||
<filter string="Out of Service" name="out_of_service"
|
||||
domain="[('reservation_type','in',['dontsell'])]"
|
||||
/>
|
||||
<group expand="0" string="Group By">
|
||||
<!-- <filter string="Room Type" domain="[]"
|
||||
context="{'group_by':'room_type_id'}"/> -->
|
||||
<filter string="Room Type" domain="[]"
|
||||
<filter string="Room Type" domain="[]" name="room_type"
|
||||
context="{'group_by':'room_type_id'}"/>
|
||||
<filter string="Creation Date" domain="[]"
|
||||
<filter string="Creation Date" domain="[]" name="creation_date"
|
||||
context="{'group_by':'create_date'}" />
|
||||
<filter string="Checkin Date" domain="[]"
|
||||
<filter string="Checkin Date" domain="[]" name="checkin_date"
|
||||
context="{'group_by':'checkin'}" />
|
||||
<filter string="Created By" domain="[]"
|
||||
<filter string="Created By" domain="[]" name="created_by"
|
||||
context="{'group_by':'create_uid'}" />
|
||||
</group>
|
||||
</search>
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
<record model="ir.actions.act_window" id="open_pms_room_closure_reason_form_tree">
|
||||
<field name="name">Room Closure Reason</field>
|
||||
<field name="res_model">room.closure.reason</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem name="Closure Reasons" id="menu_pms_room_closure_reason_form_tree"
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
<record model="ir.actions.act_window" id="open_pms_room_type_class_form_tree">
|
||||
<field name="name">Room Type Class</field>
|
||||
<field name="res_model">pms.room.type.class</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem name="Type Class" id="menu_open_pms_room_type_class_form_tree"
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
<record model="ir.actions.act_window" id="room_type_restriction_action">
|
||||
<field name="name">Reservation restrictions</field>
|
||||
<field name="res_model">pms.room.type.restriction</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -78,7 +78,6 @@
|
||||
<record model="ir.actions.act_window" id="open_pms_room_type_form_tree">
|
||||
<field name="name">Room Type</field>
|
||||
<field name="res_model">pms.room.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem id="menu_pms_room" name="Room"
|
||||
|
||||
@@ -201,7 +201,6 @@
|
||||
<record model="ir.actions.act_window" id="action_pms_room_form">
|
||||
<field name="name">pms Room</field>
|
||||
<field name="res_model">pms.room</field>
|
||||
<field name="view_type">form</field>
|
||||
<!-- <field name="context">{'default_isroom':1,'default_rental':1}
|
||||
</field> -->
|
||||
<field name="view_id" ref="pms_room_view_tree" />
|
||||
@@ -236,7 +235,6 @@
|
||||
<!-- <record id="action_room_cate" model="ir.actions.act_window">
|
||||
<field name="name">Category Items</field>
|
||||
<field name="res_model">product.product</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">['|','|',('isroom','=',True), ('iscategid' , '=', True), ('isservice', '=', True)]</field>
|
||||
<field name="context">{'search_default_categ_id':active_id, 'default_categ_id':active_id}</field>
|
||||
|
||||
@@ -85,7 +85,6 @@
|
||||
<record model="ir.actions.act_window" id="action_pms_service_line_form">
|
||||
<field name="name">Services</field>
|
||||
<field name="res_model">pms.service.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -110,7 +110,6 @@
|
||||
<record model="ir.actions.act_window" id="action_pms_services_form">
|
||||
<field name="name">Services</field>
|
||||
<field name="res_model">pms.service</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -102,7 +102,6 @@
|
||||
<record model="ir.actions.act_window" id="action_pms_shared_room_form">
|
||||
<field name="name">Shared Room</field>
|
||||
<field name="res_model">pms.shared.room</field>
|
||||
<field name="view_type">form</field>
|
||||
<!-- <field name="context">{'default_isroom':1,'default_rental':1}
|
||||
</field> -->
|
||||
<field name="view_id" ref="pms_shared_room_view_tree" />
|
||||
|
||||
@@ -106,7 +106,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
return {'value': {'amount': 0}}
|
||||
return {}
|
||||
|
||||
@api.multi
|
||||
|
||||
def _create_invoice(self, folio, service, amount):
|
||||
inv_obj = self.env['account.invoice']
|
||||
ir_property_obj = self.env['ir.property']
|
||||
@@ -201,7 +201,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
invoice.assign_outstanding_credit(line.id)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def create_invoices(self):
|
||||
inv_obj = self.env['account.invoice']
|
||||
precision = self.env['decimal.precision'].precision_get('Product Unit of Measure')
|
||||
@@ -474,7 +474,7 @@ class LineAdvancePaymentInv(models.TransientModel):
|
||||
((fields.Date.from_string(record.reservation_line_ids[-1].date)) + \
|
||||
timedelta(days=1)).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
@api.multi
|
||||
|
||||
def invoice_line_create(self, invoice_id, qty):
|
||||
""" Create an invoice line.
|
||||
:param invoice_id: integer
|
||||
|
||||
@@ -91,7 +91,6 @@
|
||||
<field name="name">Invoice Order</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">folio.advance.payment.inv</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
<field name="groups_id" eval="[(4,ref('sales_team.group_sale_salesman'))]"/>
|
||||
|
||||
@@ -91,7 +91,7 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
self.date_end = self.date_start
|
||||
|
||||
# Action methods
|
||||
@api.multi
|
||||
|
||||
def _get_restrictions_values(self, record):
|
||||
self.ensure_one()
|
||||
vals = {}
|
||||
@@ -208,7 +208,7 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
elif record.section == 'prices':
|
||||
self._save_prices(ndate, room_types, record)
|
||||
|
||||
@api.multi
|
||||
|
||||
def _do_massive_change(self):
|
||||
pms_room_type_obj = self.env['pms.room.type']
|
||||
for record in self:
|
||||
@@ -230,20 +230,20 @@ class MassiveChangesWizard(models.TransientModel):
|
||||
self._save(ndate, room_types, record)
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
def massive_change(self):
|
||||
self._do_massive_change()
|
||||
return {
|
||||
"type": "ir.actions.do_nothing",
|
||||
}
|
||||
|
||||
@api.multi
|
||||
|
||||
def massive_change_close(self):
|
||||
self._do_massive_change()
|
||||
return True
|
||||
|
||||
# TODO: method deprecated and not used anywhere
|
||||
@api.multi
|
||||
|
||||
def is_valid_date(self, chkdate):
|
||||
self.ensure_one()
|
||||
wday = chkdate.timetuple()[6]
|
||||
|
||||
@@ -74,7 +74,6 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pms.wizard.massive.changes</field>
|
||||
<field name="view_id" ref="view_pms_massive_changes_wizard"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
@@ -11,7 +11,7 @@ class MassivePriceChangeWizard(models.TransientModel):
|
||||
new_discount = fields.Float('New Discount', default=0, min=1)
|
||||
change_discount = fields.Boolean('Change Discounts', default=False)
|
||||
|
||||
@api.multi
|
||||
|
||||
def massive_price_change_days(self):
|
||||
self.ensure_one()
|
||||
pms_reservation_obj = self.env['pms.reservation']
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pms.wizard.massive.price.reservation.days</field>
|
||||
<field name="view_id" ref="view_pms_massive_price_change_wizard"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
@@ -18,7 +18,7 @@ class ServiceOnDay(models.TransientModel):
|
||||
product_qty = fields.Integer('Quantity', default=1)
|
||||
date = fields.Date('Date', default=_get_default_date)
|
||||
|
||||
@api.multi
|
||||
|
||||
def set_service(self):
|
||||
self.ensure_one()
|
||||
pms_reservation_obj = self.env['pms.reservation']
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">service.on.day</field>
|
||||
<field name="view_id" ref="service_on_day_view_form"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
@@ -13,7 +13,7 @@ class SplitReservationWizard(models.TransientModel):
|
||||
|
||||
nights = fields.Integer('Nights', default=1, min=1)
|
||||
|
||||
@api.multi
|
||||
|
||||
def split_reservation(self):
|
||||
reservation_id = self.env['pms.reservation'].browse(
|
||||
self.env.context.get('active_id'))
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pms.wizard.split.reservation</field>
|
||||
<field name="view_id" ref="view_pms_split_reservation_wizard"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
@@ -159,7 +159,7 @@ class FolioWizard(models.TransientModel):
|
||||
}))
|
||||
self.reservation_wizard_ids = cmds
|
||||
|
||||
@api.multi
|
||||
|
||||
@api.onchange('checkin', 'checkout')
|
||||
def onchange_checks(self):
|
||||
'''
|
||||
@@ -213,7 +213,7 @@ class FolioWizard(models.TransientModel):
|
||||
total += line.price
|
||||
self.total = total
|
||||
|
||||
@api.multi
|
||||
|
||||
def create_folio(self):
|
||||
self.ensure_one()
|
||||
if not self.partner_id:
|
||||
@@ -276,7 +276,7 @@ class FolioWizard(models.TransientModel):
|
||||
class PmsRoomTypeWizards(models.TransientModel):
|
||||
_name = 'pms.room.type.wizard'
|
||||
|
||||
@api.multi
|
||||
|
||||
def _get_default_checkin(self):
|
||||
return self.folio_wizard_id.checkin
|
||||
|
||||
@@ -303,7 +303,7 @@ class PmsRoomTypeWizards(models.TransientModel):
|
||||
board_service_room_id = fields.Many2one('pms.board.service.room.type',
|
||||
string="Board Service")
|
||||
|
||||
@api.multi
|
||||
|
||||
@api.onchange('rooms_num')
|
||||
def domain_board_service(self):
|
||||
for line in self:
|
||||
@@ -317,7 +317,7 @@ class PmsRoomTypeWizards(models.TransientModel):
|
||||
domain_boardservice = [('id', 'in', board_service_room_ids)]
|
||||
return {'domain': {'board_service_room_id': domain_boardservice}}
|
||||
|
||||
@api.multi
|
||||
|
||||
def _can_confirm(self):
|
||||
for record in self:
|
||||
date_start = fields.Date.from_string(record.checkin)
|
||||
@@ -458,14 +458,14 @@ class ReservationWizard(models.TransientModel):
|
||||
board_service_room_id = fields.Many2one('pms.board.service.room.type',
|
||||
string="Board Service")
|
||||
|
||||
@api.multi
|
||||
|
||||
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.multi
|
||||
|
||||
@api.onchange('room_id')
|
||||
def onchange_room_id(self):
|
||||
for line in self:
|
||||
@@ -483,7 +483,7 @@ class ReservationWizard(models.TransientModel):
|
||||
raise ValidationError(_("This room is occupied!, please, \
|
||||
choice other room or change the reservation date"))
|
||||
|
||||
@api.multi
|
||||
|
||||
@api.onchange('checkin', 'checkout', 'room_type_id',
|
||||
'discount', 'board_service_room_id', 'product_ids')
|
||||
def onchange_dates(self):
|
||||
|
||||
@@ -112,7 +112,6 @@
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pms.folio.wizard</field>
|
||||
<field name="view_id" ref="pms.pms_folio_wizard"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user