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