mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[TMP][FIX] run create direct folio
Failed automatic fusion
This commit is contained in:
@@ -314,7 +314,7 @@ class HotelFolio(models.Model):
|
|||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def create(self, vals):
|
def create(self, vals):
|
||||||
if vals.get('name', _('New')) == _('New'):
|
if vals.get('name', _('New')) == _('New') or 'name' not in vals:
|
||||||
if 'company_id' in vals:
|
if 'company_id' in vals:
|
||||||
vals['name'] = self.env['ir.sequence'].with_context(
|
vals['name'] = self.env['ir.sequence'].with_context(
|
||||||
force_company=vals['company_id']
|
force_company=vals['company_id']
|
||||||
@@ -492,18 +492,16 @@ class HotelFolio(models.Model):
|
|||||||
def _compute_cardex_count(self):
|
def _compute_cardex_count(self):
|
||||||
_logger.info('_compute_cardex_amount')
|
_logger.info('_compute_cardex_amount')
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.reservation_type == 'normal':
|
if record.reservation_type == 'normal' and record.room_lines:
|
||||||
write_vals = {}
|
write_vals = {}
|
||||||
filtered_reservs = record.filtered(
|
filtered_reservs = record.room_lines.filtered(
|
||||||
lambda x: x.room_lines.state != 'cancelled' and \
|
lambda x: x.state != 'cancelled' and \
|
||||||
not x.room_lines.parent_reservation)
|
not x.parent_reservation)
|
||||||
|
|
||||||
mapped_cardex = filtered_reservs.mapped('cardex_ids.id')
|
mapped_cardex = filtered_reservs.mapped('cardex_ids.id')
|
||||||
write_vals.update({'cardex_count': len(mapped_cardex)})
|
record.cardex_count = len(mapped_cardex)
|
||||||
mapped_cardex_count = filtered_reservs.mapped(
|
mapped_cardex_count = filtered_reservs.mapped(
|
||||||
lambda x: (x.adults + x.children) - len(x.cardex_ids))
|
lambda x: (x.adults + x.children) - len(x.cardex_ids))
|
||||||
write_vals.update({'cardex_pending_count': sum(mapped_cardex_count)})
|
record.cardex_pending_count = sum(mapped_cardex_count)
|
||||||
record.write(write_vals)
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
MAILING PROCESS
|
MAILING PROCESS
|
||||||
|
|||||||
@@ -334,12 +334,11 @@ class HotelReservation(models.Model):
|
|||||||
def _prepare_add_missing_fields(self, values):
|
def _prepare_add_missing_fields(self, values):
|
||||||
""" Deduce missing required fields from the onchange """
|
""" Deduce missing required fields from the onchange """
|
||||||
res = {}
|
res = {}
|
||||||
onchange_fields = ['room_id', 'reservation_type', 'currency_id']
|
onchange_fields = ['room_id', 'reservation_type', 'currency_id', 'name']
|
||||||
if values.get('partner_id') and values.get('room_type_id'):
|
if values.get('partner_id') and values.get('room_type_id'):
|
||||||
line = self.new(values)
|
line = self.new(values)
|
||||||
if any(f not in values for f in onchange_fields):
|
if any(f not in values for f in onchange_fields):
|
||||||
line.onchange_room_id()
|
line.onchange_room_id()
|
||||||
if 'name' not in values:
|
|
||||||
line.onchange_compute_reservation_description()
|
line.onchange_compute_reservation_description()
|
||||||
if 'pricelist_id' not in values:
|
if 'pricelist_id' not in values:
|
||||||
line.onchange_partner_id()
|
line.onchange_partner_id()
|
||||||
@@ -892,11 +891,9 @@ class HotelReservation(models.Model):
|
|||||||
def _compute_cardex_count(self):
|
def _compute_cardex_count(self):
|
||||||
_logger.info('_compute_cardex_count')
|
_logger.info('_compute_cardex_count')
|
||||||
for record in self:
|
for record in self:
|
||||||
record.write({
|
record.cardex_count = len(record.cardex_ids)
|
||||||
'cardex_count': len(record.cardex_ids),
|
record.cardex_pending_count = (record.adults + record.children) \
|
||||||
'cardex_pending_count': (record.adults + record.children) \
|
|
||||||
- len(record.cardex_ids)
|
- len(record.cardex_ids)
|
||||||
})
|
|
||||||
|
|
||||||
# https://www.odoo.com/es_ES/forum/ayuda-1/question/calculated-fields-in-search-filter-possible-118501
|
# https://www.odoo.com/es_ES/forum/ayuda-1/question/calculated-fields-in-search-filter-possible-118501
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
<span class="o_stat_text">Checks</span>
|
<span class="o_stat_text">Checks</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<!-- <field name="currency_id" invisible="1"/> -->
|
<field name="currency_id" invisible="1"/>
|
||||||
|
|
||||||
<!-- <button type="object" class="oe_stat_button"
|
<!-- <button type="object" class="oe_stat_button"
|
||||||
id="invoices_smart_button"
|
id="invoices_smart_button"
|
||||||
@@ -94,16 +94,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</button> -->
|
</button> -->
|
||||||
|
|
||||||
<!-- <button type="object" class="oe_stat_button"
|
|
||||||
id="payment_smart_button"
|
|
||||||
icon="fa-money"
|
|
||||||
name="action_recalcule_payment"
|
|
||||||
help="Calcule the total Price">
|
|
||||||
<div class="o_form_field o_stat_info">
|
|
||||||
<span class="o_stat_text">Calcule Price</span>
|
|
||||||
</div>
|
|
||||||
</button> -->
|
|
||||||
|
|
||||||
<!-- <button type="object" class="oe_stat_button"
|
<!-- <button type="object" class="oe_stat_button"
|
||||||
id="refunds_smart_button"
|
id="refunds_smart_button"
|
||||||
icon="fa-undo"
|
icon="fa-undo"
|
||||||
@@ -307,8 +297,8 @@
|
|||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="adults"/>
|
<field name="adults"/>
|
||||||
<field name="children"/>
|
<field name="children"/>
|
||||||
<!-- <field name="room_type_id" on_change="1" options="{'no_create': True,'no_open': True}"
|
<field name="room_type_id" on_change="1" options="{'no_create': True,'no_open': True}"
|
||||||
attrs="{'readonly':[('state','not in',('draft'))]}"/> -->
|
attrs="{'readonly':[('state','not in',('draft'))]}"/>
|
||||||
<field name="channel_type" attrs="{'required':[('reservation_type','not in',('staff','out'))]}"/>
|
<field name="channel_type" attrs="{'required':[('reservation_type','not in',('staff','out'))]}"/>
|
||||||
</group>
|
</group>
|
||||||
<group class="oe_subtotal_footer" style="margin-right: 20px; !important" colspan="2" name="reservation_total" string="Amounts">
|
<group class="oe_subtotal_footer" style="margin-right: 20px; !important" colspan="2" name="reservation_total" string="Amounts">
|
||||||
|
|||||||
Reference in New Issue
Block a user