[UPD] use to_assign + button highligh

This commit is contained in:
Pablo
2019-03-05 13:13:56 +01:00
parent 56dac40616
commit 79c62d1060
11 changed files with 18 additions and 19 deletions

View File

@@ -77,3 +77,4 @@ class BusHotelCalendar(models.TransientModel):
self.env['bus.bus'].sendone(
(self._cr.dbname, 'hotel.reservation',
HOTEL_BUS_CHANNEL_ID), notif)

View File

@@ -54,5 +54,5 @@ class HotelReservation(models.Model):
def confirm(self):
for record in self:
if record.to_assign:
record.write({'to_read': False, 'to_assign': False})
record.write({'to_assign': False})
return super(HotelReservation, self).confirm()

View File

@@ -45,8 +45,8 @@ var PMSHotelCalendarController = PMSCalendarController.include({
_update_buttons_counter: function (ev) {
this._super(ev);
var self = this;
var domain_reservations = [['to_read', '=', true]];
var domain_issues = [['to_read', '=', true]];
var domain_reservations = [['to_assign', '=', true]];
var domain_issues = [['to_assign', '=', true]];
$.when(
this.model.search_count(domain_reservations),
this.model.search_count(domain_issues),

View File

@@ -10,12 +10,14 @@ odoo.define('hotel_calendar_channel_connector.PMSHotelCalendarRenderer', functio
update_buttons_counter_channel_connector: function (nreservations, nissues) {
// Cloud Reservations
debugger;
var $text = this.$el.find('#btn_channel_manager_request .cloud-text');
$text.text(nreservations);
if (nreservations > 0) {
$text.parent().parent().addClass('button-highlight');
$text.parent().addClass('incoming');
$text.text(nreservations);
} else {
$text.parent().parent().removeClass('button-highlight');
$text.parent().removeClass('incoming');
}

View File

@@ -7,7 +7,7 @@
<field name="res_model">hotel.reservation</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="hotel_toassign_reservation_view_tree" />
<field name="domain">[('to_read','=',True)]</field>
<field name="domain">[('to_assign','=',True)]</field>
</record>
@@ -16,7 +16,7 @@
<field name="name">Channel Connector Issues</field>
<field name="res_model">hotel.channel.connector.issue</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('to_read','=',True)]</field>
<field name="domain">[('to_assign','=',True)]</field>
</record>
</data>

View File

@@ -9,7 +9,7 @@
<field name="inherit_id" ref="hotel.hotel_reservation_view_tree" />
<field name="arch" type="xml">
<field name="room_type_id" position="after">
<field name="to_read" invisible="1"/>
<field name="to_assign" invisible="1"/>
</field>
</field>
</record>
@@ -19,11 +19,11 @@
<field name="inherit_id" ref="hotel.hotel_reservation_view_form" />
<field name="arch" type="xml">
<xpath expr="//button[@name='unify']" position="after">
<field name="to_read" invisible="1"/>
<field name="to_assign" invisible="1"/>
<button name="mark_as_readed" string="Mark as Read"
type="object" class="oe_highlight"
icon="fa-1x fa-thumb-tack"
attrs="{'invisible':[('to_read','=', False)]}" />
attrs="{'invisible':[('to_assign','=', False)]}" />
</xpath>
</field>
</record>

View File

@@ -144,7 +144,6 @@ class HotelReservation(models.Model):
readonly=True)
able_to_modify_channel = fields.Boolean(compute=_set_access_for_channel_fields,
string='Is user able to modify channel fields?')
to_read = fields.Boolean('To Read', default=False)
customer_notes = fields.Text(related='folio_id.customer_notes')
unconfirmed_channel_price = fields.Boolean(related='folio_id.unconfirmed_channel_price')
@@ -164,7 +163,7 @@ class HotelReservation(models.Model):
from_channel = True
user = self.env['res.users'].browse(self.env.uid)
if user.has_group('hotel.group_hotel_call'):
vals.update({'to_read': True})
vals.update({'to_assign': True})
reservation_id = super(HotelReservation, self).create(vals)
backend_id = self.env['channel.hotel.room.type'].search([
@@ -243,7 +242,7 @@ class HotelReservation(models.Model):
'channel_bind_ids': commands,
'customer_notes': self.customer_notes,
'is_from_ota': self.is_from_ota,
'to_read': self.to_read,
'to_assign': self.to_assign,
})
return res
@@ -266,7 +265,7 @@ class HotelReservation(models.Model):
@api.multi
def mark_as_readed(self):
self.write({'to_read': False, 'to_assign': False})
self.write({'to_assign': False})
class ChannelBindingHotelReservationListener(Component):

View File

@@ -32,7 +32,6 @@ class HotelFolio(models.Model):
def action_confirm(self):
for rec in self:
rec.room_lines.write({
'to_read': False,
'to_assign': False,
})
return super().action_confirm()

View File

@@ -11,7 +11,7 @@
<field name="ota_reservation_id" />
<field name="channel_status" />
<field name="channel_status_reason" />
<field name="to_read" />
<field name="to_assign" />
</group>
</form>
</field>

View File

@@ -39,7 +39,7 @@ class HotelReservation(models.Model):
raise ValidationError(_("Can't cancel reservations from OTA's"))
user = self.env['res.users'].browse(self.env.uid)
if user.has_group('hotel.group_hotel_call'):
self.write({'to_read': True, 'to_assign': True})
self.write({'to_assign': True})
res = super(HotelReservation, self).action_cancel()
for record in self:

View File

@@ -136,8 +136,7 @@ class HotelReservationImporter(Component):
'reservation_line_ids': reservation_lines,
'price_unit': tprice,
'to_assign': True,
'to_read': True,
'state': is_cancellation and 'cancelled' or 'draft',
'state': is_cancellation and 'cancelled' or 'confirm',
'room_type_id': room_type_bind.odoo_id.id,
'splitted': split_booking,
'name': room_type_bind and room_type_bind.name,
@@ -201,7 +200,6 @@ class HotelReservationImporter(Component):
'channel_raw_data': json.dumps(book),
'channel_status': str(book['status']),
'channel_status_reason': book.get('status_reason', ''),
'to_read': True,
'to_assign': True,
'price_unit': book['amount'],
'customer_notes': book['customer_notes'],