[ADD] no_ota in massive changes wizard (#57)

* [ADD] no_ota in massive changes wizard

* [FIX] view inherit
This commit is contained in:
QS5ELkMu
2018-11-10 02:11:59 +01:00
committed by GitHub
parent 98599dbb91
commit c06f1db8db
4 changed files with 25 additions and 3 deletions

View File

@@ -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',

View File

@@ -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 \

View File

@@ -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

View 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>