mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[MIG] V13 models
This commit is contained in:
@@ -26,6 +26,8 @@ class AccountMove(models.Model):
|
||||
|
||||
def _computed_folio_origin(self):
|
||||
for inv in self:
|
||||
inv.from_folio = False
|
||||
inv.folio_ids = False
|
||||
folios = inv.mapped('invoice_line_ids.reservation_ids.folio_id')
|
||||
folios |= inv.mapped('invoice_line_ids.service_ids.folio_id')
|
||||
if folios:
|
||||
|
||||
@@ -476,7 +476,7 @@ class PmsFolio(models.Model):
|
||||
"""
|
||||
if not self.partner_id:
|
||||
self.update({
|
||||
'partner_move_id': False,
|
||||
'partner_invoice_id': False,
|
||||
'payment_term_id': False,
|
||||
'fiscal_position_id': False,
|
||||
})
|
||||
|
||||
@@ -810,7 +810,7 @@ class PmsReservation(models.Model):
|
||||
vals.update(self._prepare_add_missing_fields(vals))
|
||||
if 'folio_id' in vals and 'channel_type' not in vals:
|
||||
folio = self.env["pms.folio"].browse(vals['folio_id'])
|
||||
vals.update({'channel_type': folio.channel_type})
|
||||
vasls.update({'channel_type': folio.channel_type})
|
||||
elif 'partner_id' in vals:
|
||||
folio_vals = {'partner_id': int(vals.get('partner_id')),
|
||||
'channel_type': vals.get('channel_type')}
|
||||
|
||||
@@ -13,7 +13,7 @@ var SwitchPmsMenu = Widget.extend({
|
||||
template: 'pms.SwitchPmsMenu',
|
||||
willStart: function() {
|
||||
this.isMobile = config.device.isMobile;
|
||||
if (!session.user_pmss) {
|
||||
if (!session.user_pms) {
|
||||
return $.Deferred().reject();
|
||||
}
|
||||
return this._super();
|
||||
|
||||
@@ -443,23 +443,23 @@
|
||||
<field name="splitted" invisible="1" />
|
||||
<field name="pricelist_id" invisible="1" />
|
||||
<field name="to_print" invisible="1"/>
|
||||
<button icon="fa fa-1x fa-chain-broken"
|
||||
<button icon="fa-chain-broken"
|
||||
type="object"
|
||||
class="oe_stat_button"
|
||||
name="open_master"
|
||||
attrs="{'invisible':[('splitted','=', False)]}" />
|
||||
<button icon="fa fa-2x fa-angellist"
|
||||
<button icon="fa-angellist"
|
||||
attrs="{'invisible':['|',('folio_pending_amount','>',0),('state' ,'!=', 'done')]}"
|
||||
type="object"
|
||||
name="open_folio" />
|
||||
<field name="state" />
|
||||
<button type="object" class="oe_stat_button"
|
||||
icon="fa fa-2x fa-file"
|
||||
icon="fa-file"
|
||||
name="open_folio"
|
||||
/>
|
||||
<field name="folio_id"/>
|
||||
<button type="object" class="oe_stat_button"
|
||||
icon="fa fa-2x fa-user-plus"
|
||||
icon="fa-user-plus"
|
||||
name="action_checks"
|
||||
context="{'partner_id': partner_id,'enter_date': checkin,
|
||||
'exit_date': checkout,'reservation_id': id, 'hidden_checkin_partner': True, 'edit_checkin_partner': True }"
|
||||
@@ -467,7 +467,7 @@
|
||||
/>
|
||||
<field name="room_id" options="{'no_create': True,'no_open': True}" />
|
||||
<button type="action" class="oe_stat_button"
|
||||
icon="fa fa-2x fa-list-ul"
|
||||
icon="fa-list-ul"
|
||||
name="%(open_pms_reservation_form_tree_all)d"
|
||||
context="{'search_default_partner_id': partner_id}"
|
||||
/>
|
||||
@@ -490,7 +490,7 @@
|
||||
<field name="price_total" />
|
||||
<field name="folio_pending_amount" string="Folio Pending Amount"/>
|
||||
<button type="object" class="oe_stat_button"
|
||||
icon="fa fa-3x fa-money"
|
||||
icon="fa-money"
|
||||
name="action_pay_folio"
|
||||
attrs="{'invisible':[('folio_pending_amount','=',0)]}"
|
||||
/>
|
||||
|
||||
@@ -304,11 +304,11 @@ class FolioAdvancePaymentInv(models.TransientModel):
|
||||
'service_id': service.id,
|
||||
}
|
||||
for reservation in folio.reservation_ids.filtered(
|
||||
lambda x: x.id in self.reservation_ids.ids and
|
||||
lambda x: x._origin.id in self.reservation_ids.ids and
|
||||
x.invoice_status == 'to invoice'):
|
||||
board_service = reservation.board_service_room_id
|
||||
for day in reservation.reservation_line_ids.filtered(
|
||||
lambda x: not x.invoice_line_ids).sorted('date'):
|
||||
lambda x: not x.move_line_ids).sorted('date'):
|
||||
extra_price = 0
|
||||
if board_service:
|
||||
services = reservation.service_ids.filtered(
|
||||
@@ -452,6 +452,7 @@ class LineAdvancePaymentInv(models.TransientModel):
|
||||
})
|
||||
|
||||
def _compute_price_room(self):
|
||||
self.price_room = False
|
||||
for record in self:
|
||||
if record.reservation_id:
|
||||
record.price_room = record.reservation_line_ids[0].price
|
||||
@@ -468,8 +469,8 @@ class LineAdvancePaymentInv(models.TransientModel):
|
||||
if not record.reservation_line_ids:
|
||||
raise UserError(_('If you want drop the line, use the trash icon'))
|
||||
record.qty = len(record.reservation_line_ids)
|
||||
record.description_dates = record.reservation_line_ids[0].date + ' - ' + \
|
||||
((fields.Date.from_string(record.reservation_line_ids[-1].date)) + \
|
||||
record.description_dates = (record.reservation_line_ids[0].date).strftime(DEFAULT_SERVER_DATE_FORMAT) + ' - ' + \
|
||||
((record.reservation_line_ids[-1].date) + \
|
||||
timedelta(days=1)).strftime(DEFAULT_SERVER_DATE_FORMAT)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user