mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] no_ota in massive changes wizard (#57)
* [ADD] no_ota in massive changes wizard * [FIX] view inherit
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
'views/channel_product_pricelist_views.xml',
|
||||
'views/channel_product_pricelist_item_views.xml',
|
||||
'views/channel_connector_backend_views.xml',
|
||||
'wizard/inherited_massive_changes.xml',
|
||||
'data/menus.xml',
|
||||
'data/sequences.xml',
|
||||
#'security/ir.model.access.csv',
|
||||
|
||||
@@ -35,7 +35,7 @@ class ChannelHotelRoomTypeAvailability(models.Model):
|
||||
old_name='wpushed')
|
||||
|
||||
@api.constrains('channel_max_avail')
|
||||
def _check_wmax_avail(self):
|
||||
def _check_channel_max_avail(self):
|
||||
for record in self:
|
||||
if record.channel_max_avail > record.odoo_id.room_type_id.total_rooms_count:
|
||||
raise ValidationError(_("max avail for channel can't be high \
|
||||
|
||||
@@ -2,18 +2,22 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from datetime import datetime, timedelta
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo import models, api
|
||||
from odoo import fields, models, api
|
||||
|
||||
|
||||
class MassiveChangesWizard(models.TransientModel):
|
||||
_inherit = 'hotel.wizard.massive.changes'
|
||||
|
||||
change_no_ota = fields.Boolean(default=False)
|
||||
no_ota = fields.Boolean('No OTA', default=False)
|
||||
|
||||
@api.model
|
||||
def _get_availability_values(self, ndate, room_type, record):
|
||||
vals = super(MassiveChangesWizard, self)._get_availability_values(
|
||||
ndate, room_type, record)
|
||||
vals.update({
|
||||
'wmax_avail': vals['avail']
|
||||
'channel_max_avail': vals['avail'],
|
||||
'no_ota': record.no_ota,
|
||||
})
|
||||
return vals
|
||||
|
||||
|
||||
17
hotel_channel_connector/wizard/inherited_massive_changes.xml
Normal file
17
hotel_channel_connector/wizard/inherited_massive_changes.xml
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="hotel_massive_changes_wizard_view_form">
|
||||
<field name="model">hotel.wizard.massive.changes</field>
|
||||
<field name="inherit_id" ref="hotel.view_hotel_massive_changes_wizard" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//table[hasclass('oe_form_group')][1]/tbody" position="inside">
|
||||
<tr class="oe_form_group_row">
|
||||
<td class="oe_form_group_cell oe_form_group_cell_label"><field name="change_no_ota" /> <strong> No OTA</strong></td>
|
||||
<td class="oe_form_group_cell"><field name="no_ota" attrs="{'readonly':[('change_no_ota', '=', False)]}" /></td>
|
||||
</tr>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user