mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[WIP] Checkin Workflow
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
'depends': [
|
'depends': [
|
||||||
'sale_stock',
|
'sale_stock',
|
||||||
'account_payment_return',
|
'account_payment_return',
|
||||||
|
'partner_firstname',
|
||||||
],
|
],
|
||||||
'license': "AGPL-3",
|
'license': "AGPL-3",
|
||||||
'demo': ['data/hotel_demo.xml'],
|
'demo': ['data/hotel_demo.xml'],
|
||||||
|
|||||||
@@ -17,6 +17,14 @@ class HotelCheckinPartner(models.Model):
|
|||||||
return reservation
|
return reservation
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def _default_folio_id(self):
|
||||||
|
if 'folio_id' in self.env.context:
|
||||||
|
folio = self.env['hotel.folio'].browse([
|
||||||
|
self.env.context['reservation_id']
|
||||||
|
])
|
||||||
|
return folio
|
||||||
|
raise ValidationError(_('You only can create checkin from reservations or folios'))
|
||||||
|
|
||||||
def _default_enter_date(self):
|
def _default_enter_date(self):
|
||||||
if 'reservation_id' in self.env.context:
|
if 'reservation_id' in self.env.context:
|
||||||
reservation = self.env['hotel.reservation'].browse([
|
reservation = self.env['hotel.reservation'].browse([
|
||||||
@@ -45,10 +53,18 @@ class HotelCheckinPartner(models.Model):
|
|||||||
partner_id = fields.Many2one('res.partner', default=_default_partner_id,
|
partner_id = fields.Many2one('res.partner', default=_default_partner_id,
|
||||||
required=True)
|
required=True)
|
||||||
reservation_id = fields.Many2one(
|
reservation_id = fields.Many2one(
|
||||||
'hotel.reservation',
|
'hotel.reservation', default=_default_reservation_id)
|
||||||
default=_default_reservation_id, readonly=True)
|
folio_id = fields.Many2one('hotel.reservation',
|
||||||
|
default=_default_folio_id, readonly=True)
|
||||||
enter_date = fields.Date(default=_default_enter_date, required=True)
|
enter_date = fields.Date(default=_default_enter_date, required=True)
|
||||||
exit_date = fields.Date(default=_default_exit_date, required=True)
|
exit_date = fields.Date(default=_default_exit_date, required=True)
|
||||||
|
state = fields.Selection([('draft', 'Pending Entry'),
|
||||||
|
('booking', 'On Board'),
|
||||||
|
('done', 'Out'),
|
||||||
|
('cancelled', 'Cancelled')],
|
||||||
|
'State', readonly=True,
|
||||||
|
default=lambda *a: 'draft',
|
||||||
|
track_visibility='onchange')
|
||||||
|
|
||||||
# Validation for Departure date is after arrival date.
|
# Validation for Departure date is after arrival date.
|
||||||
@api.multi
|
@api.multi
|
||||||
@@ -72,3 +88,13 @@ class HotelCheckinPartner(models.Model):
|
|||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_('Departure date, is prior to arrival. Check it now. %s') %
|
_('Departure date, is prior to arrival. Check it now. %s') %
|
||||||
date_out)
|
date_out)
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def action_on_board(self):
|
||||||
|
for record in self:
|
||||||
|
record.state = 'booking'
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
def action_done(self):
|
||||||
|
for record in self:
|
||||||
|
record.state = 'done'
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ class HotelFolio(models.Model):
|
|||||||
compute='_amount_all', track_visibility='always')
|
compute='_amount_all', track_visibility='always')
|
||||||
|
|
||||||
#Checkin Fields-----------------------------------------------------
|
#Checkin Fields-----------------------------------------------------
|
||||||
|
checkin_partner_ids = fields.One2many('hotel.checkin.partner', 'reservation_id')
|
||||||
booking_pending = fields.Integer('Booking pending',
|
booking_pending = fields.Integer('Booking pending',
|
||||||
compute='_compute_checkin_partner_count')
|
compute='_compute_checkin_partner_count')
|
||||||
checkin_partner_count = fields.Integer('Checkin counter',
|
checkin_partner_count = fields.Integer('Checkin counter',
|
||||||
@@ -567,7 +568,6 @@ class HotelFolio(models.Model):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _compute_checkin_partner_count(self):
|
def _compute_checkin_partner_count(self):
|
||||||
_logger.info('_compute_checkin_partner_amount')
|
|
||||||
for record in self:
|
for record in self:
|
||||||
if record.reservation_type == 'normal' and record.room_lines:
|
if record.reservation_type == 'normal' and record.room_lines:
|
||||||
write_vals = {}
|
write_vals = {}
|
||||||
|
|||||||
@@ -572,6 +572,13 @@ class HotelReservation(models.Model):
|
|||||||
if self.reservation_type == 'out':
|
if self.reservation_type == 'out':
|
||||||
self.update({'partner_id': self.env.user.company_id.partner_id.id})
|
self.update({'partner_id': self.env.user.company_id.partner_id.id})
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
@api.onchange('checkin_partner_ids')
|
||||||
|
def onchange_checkin_partner_ids(self):
|
||||||
|
for record in self:
|
||||||
|
if len(record.checkin_partner_ids) > record.adults + record.children:
|
||||||
|
raise models.ValidationError(_('The room already is completed'))
|
||||||
|
|
||||||
# When we need to overwrite the prices even if they were already established
|
# When we need to overwrite the prices even if they were already established
|
||||||
@api.onchange('room_type_id', 'pricelist_id', 'reservation_type')
|
@api.onchange('room_type_id', 'pricelist_id', 'reservation_type')
|
||||||
def onchange_overwrite_price_by_day(self):
|
def onchange_overwrite_price_by_day(self):
|
||||||
@@ -953,6 +960,13 @@ class HotelReservation(models.Model):
|
|||||||
CHECKIN/OUT PROCESS ------------------------------------------------
|
CHECKIN/OUT PROCESS ------------------------------------------------
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@api.multi
|
||||||
|
@api.constrains('checkin_partner_ids')
|
||||||
|
def _max_checkin_partner_ids(self):
|
||||||
|
for record in self:
|
||||||
|
if len(record.checkin_partner_ids) > record.adults + record.children:
|
||||||
|
raise models.ValidationError(_('The room already is completed'))
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _compute_checkin_partner_count(self):
|
def _compute_checkin_partner_count(self):
|
||||||
_logger.info('_compute_checkin_partner_count')
|
_logger.info('_compute_checkin_partner_count')
|
||||||
@@ -972,6 +986,7 @@ class HotelReservation(models.Model):
|
|||||||
def action_reservation_checkout(self):
|
def action_reservation_checkout(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
record.state = 'done'
|
record.state = 'done'
|
||||||
|
record.checkin_partner_ids.action_done()
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_checks(self):
|
def action_checks(self):
|
||||||
|
|||||||
@@ -1,19 +1,12 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<!-- Action to open INE Codes list -->
|
|
||||||
<act_window
|
<act_window
|
||||||
id="action_checkin_partner"
|
id="action_checkin_partner"
|
||||||
name="Action checkin"
|
name="Action checkin"
|
||||||
res_model='hotel.checkin.partner'
|
res_model='hotel.checkin.partner'
|
||||||
view_mode="tree,form" />
|
view_mode="tree,form" />
|
||||||
|
|
||||||
<act_window
|
|
||||||
id="action_checkin_partner_download"
|
|
||||||
name="Action checkin download"
|
|
||||||
res_model='hotel.checkin.partner'
|
|
||||||
view_mode="form" />
|
|
||||||
|
|
||||||
<menuitem
|
<menuitem
|
||||||
id="menu_hotel_checkin_partner"
|
id="menu_hotel_checkin_partner"
|
||||||
name="Checkins"
|
name="Checkins"
|
||||||
@@ -25,7 +18,7 @@
|
|||||||
<field name="name">Checkin Form</field>
|
<field name="name">Checkin Form</field>
|
||||||
<field name="model">hotel.checkin.partner</field>
|
<field name="model">hotel.checkin.partner</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form>
|
<form create="false">
|
||||||
<sheet>
|
<sheet>
|
||||||
<group name="group_top">
|
<group name="group_top">
|
||||||
<group name="group_left">
|
<group name="group_left">
|
||||||
@@ -42,17 +35,92 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
<record id="hotel_checkin_partner_view_tree" model="ir.ui.view">
|
<record id="hotel_checkin_partner_reservation_view_tree" model="ir.ui.view">
|
||||||
<field name="name">Checkin Tree</field>
|
<field name="name">hotel.checkin.partner.reservation.view.tree</field>
|
||||||
<field name="model">hotel.checkin.partner</field>
|
<field name="model">hotel.checkin.partner</field>
|
||||||
|
<field name="priority">20</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree>
|
<tree editable="bottom"
|
||||||
<field name="partner_id" string="Client name"/>
|
decoration-danger="state == 'draft'"
|
||||||
|
decoration-muted="state == 'cancelled' or state =='done'"
|
||||||
|
decoration-success="state == 'booking'">
|
||||||
|
<button type="object" class="oe_stat_button"
|
||||||
|
icon="fa fa-2x fa-check-circle"
|
||||||
|
name="action_on_board"
|
||||||
|
attrs="{'invisible':[('state','not in', ['draft'])]}"
|
||||||
|
help="Get in"
|
||||||
|
/>
|
||||||
|
<field name="partner_id" required="True"/>
|
||||||
<field name="enter_date"/>
|
<field name="enter_date"/>
|
||||||
<field name="exit_date"/>
|
<field name="exit_date"/>
|
||||||
<field name="reservation_id"/>
|
<field name="reservation_id"/>
|
||||||
|
<field name="state" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="hotel_checkin_partner_view_tree" model="ir.ui.view">
|
||||||
|
<field name="name">hotel.checkin.partner.view.tree</field>
|
||||||
|
<field name="model">hotel.checkin.partner</field>
|
||||||
|
<field name="priority">10</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree create="false"
|
||||||
|
decoration-danger="state == 'draft'"
|
||||||
|
decoration-muted="state == 'cancelled' or state =='done'"
|
||||||
|
decoration-success="state == 'booking'">
|
||||||
|
<button type="object" class="oe_stat_button"
|
||||||
|
icon="fa fa-2x fa-check-circle"
|
||||||
|
name="action_on_board"
|
||||||
|
attrs="{'invisible':[('state','not in', ['draft'])]}"
|
||||||
|
help="Get in"
|
||||||
|
/>
|
||||||
|
<field name="partner_id" required="True"/>
|
||||||
|
<field name="enter_date"/>
|
||||||
|
<field name="exit_date"/>
|
||||||
|
<field name="reservation_id"/>
|
||||||
|
<field name="state" />
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="hotel_checkin_partner_view_search">
|
||||||
|
<field name="name">hotel.checkin.partner.search</field>
|
||||||
|
<field name="model">hotel.checkin.partner</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="Checkin Detail">
|
||||||
|
<field name="partner_id" />
|
||||||
|
<field name="reservation_id" />
|
||||||
|
<filter string="On Board"
|
||||||
|
domain="[('state','in',['booking'])]"
|
||||||
|
help="Current Booking" />
|
||||||
|
<filter string="To enter"
|
||||||
|
domain="[('state', '=', 'draft')]"
|
||||||
|
/>
|
||||||
|
<filter string="Out"
|
||||||
|
domain="[('state', '=', 'done')]"
|
||||||
|
/>
|
||||||
|
<filter string="Checkins Tomorrow" name="enter_tomorrow"
|
||||||
|
domain="[('enter_date', '=', (context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d')),
|
||||||
|
('state', '=', 'draft')]"
|
||||||
|
help="Show all checkins for enter tomorrow"/>
|
||||||
|
<filter string="Checkins to 7 days" name="next_res_week"
|
||||||
|
domain="[('enter_date', '<', (context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d')),
|
||||||
|
('state', '=', 'draft')]"
|
||||||
|
help="Show all reservations for which date enter is before than 7 days"/>
|
||||||
|
<filter string="On Board Tomorrow" name="next_res_2week"
|
||||||
|
domain="[('enter_date', '<', (context_today()+datetime.timedelta(days=14)).strftime('%Y-%m-%d')),
|
||||||
|
('state', 'in', ['confirm','draft'])]"
|
||||||
|
help="Show all checkins for Tomorrow"/>
|
||||||
|
<group expand="0" string="Group By">
|
||||||
|
<filter string="Creation Date" domain="[]"
|
||||||
|
context="{'group_by':'create_date'}" />
|
||||||
|
<filter string="Checkin Date" domain="[]"
|
||||||
|
context="{'group_by':'checkin'}" />
|
||||||
|
<filter string="Checkout Date" domain="[]"
|
||||||
|
context="{'group_by':'checkout'}" />
|
||||||
|
</group>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
@@ -82,7 +82,6 @@
|
|||||||
<sheet>
|
<sheet>
|
||||||
<div class="oe_button_box" attrs="{'invisible': [('folio_id','=',False)]}">
|
<div class="oe_button_box" attrs="{'invisible': [('folio_id','=',False)]}">
|
||||||
<button type="object" class="oe_stat_button"
|
<button type="object" class="oe_stat_button"
|
||||||
id="folio_smart_button"
|
|
||||||
icon="fa-file"
|
icon="fa-file"
|
||||||
name="open_folio">
|
name="open_folio">
|
||||||
<div class="o_form_field o_stat_info">
|
<div class="o_form_field o_stat_info">
|
||||||
@@ -90,7 +89,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<button type="action" class="oe_stat_button"
|
<button type="action" class="oe_stat_button"
|
||||||
id="books"
|
|
||||||
icon="fa-list-ul"
|
icon="fa-list-ul"
|
||||||
attrs="{'invisible': [('partner_id','=',False)]}"
|
attrs="{'invisible': [('partner_id','=',False)]}"
|
||||||
name="%(open_hotel_reservation_form_tree_all)d"
|
name="%(open_hotel_reservation_form_tree_all)d"
|
||||||
@@ -109,7 +107,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<button type="object" class="oe_stat_button"
|
<button type="object" class="oe_stat_button"
|
||||||
id="open_master"
|
|
||||||
icon="fa-chain-broken"
|
icon="fa-chain-broken"
|
||||||
name="open_master"
|
name="open_master"
|
||||||
attrs="{'invisible':[('splitted','=',False)]}">
|
attrs="{'invisible':[('splitted','=',False)]}">
|
||||||
@@ -120,7 +117,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<button type="action" class="oe_stat_button"
|
<button type="action" class="oe_stat_button"
|
||||||
id="pending_checkins_smart_button"
|
|
||||||
icon="fa-user-plus"
|
icon="fa-user-plus"
|
||||||
name="%(launch_checkin_wizard_add)d"
|
name="%(launch_checkin_wizard_add)d"
|
||||||
context="{'partner_id': partner_id,'enter_date': checkin,
|
context="{'partner_id': partner_id,'enter_date': checkin,
|
||||||
@@ -134,7 +130,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<button type="object" class="oe_stat_button"
|
<button type="object" class="oe_stat_button"
|
||||||
id="checkin_smart_button"
|
|
||||||
icon="fa-users"
|
icon="fa-users"
|
||||||
name="action_checks"
|
name="action_checks"
|
||||||
attrs="{'invisible': ['|', ('checkin_partner_count','<=',0),
|
attrs="{'invisible': ['|', ('checkin_partner_count','<=',0),
|
||||||
@@ -253,7 +248,7 @@
|
|||||||
decoration-success="is_board_service == True">
|
decoration-success="is_board_service == True">
|
||||||
<field name="is_board_service" invisible="1" />
|
<field name="is_board_service" invisible="1" />
|
||||||
<button type="object" class="oe_stat_button"
|
<button type="object" class="oe_stat_button"
|
||||||
id="included_in_room" icon="fa fa-1x fa-bed"
|
icon="fa fa-1x fa-bed"
|
||||||
name="open_service_lines"
|
name="open_service_lines"
|
||||||
attrs="{'invisible':[('is_board_service','=', False)]}" />
|
attrs="{'invisible':[('is_board_service','=', False)]}" />
|
||||||
<field name="per_day" invisible="1"/>
|
<field name="per_day" invisible="1"/>
|
||||||
@@ -266,7 +261,7 @@
|
|||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="product_qty" attrs="{'readonly': [('per_day','=',True)]}" force_save="1"/>
|
<field name="product_qty" attrs="{'readonly': [('per_day','=',True)]}" force_save="1"/>
|
||||||
<button type="object" class="oe_stat_button"
|
<button type="object" class="oe_stat_button"
|
||||||
id="go_service_lines" icon="fa fa-2x fa-bars"
|
icon="fa fa-2x fa-bars"
|
||||||
name="open_service_lines"
|
name="open_service_lines"
|
||||||
attrs="{'invisible': [('per_day','=',False)]}"/>
|
attrs="{'invisible': [('per_day','=',False)]}"/>
|
||||||
<field name="days_qty" invisible="1"/>
|
<field name="days_qty" invisible="1"/>
|
||||||
@@ -295,6 +290,15 @@
|
|||||||
</field>
|
</field>
|
||||||
</group>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
|
<page name="persons" string="Persons">
|
||||||
|
<field name="checkin_partner_ids"
|
||||||
|
context="{
|
||||||
|
'default_reservation_id': id,
|
||||||
|
'reservation_id': id,
|
||||||
|
'tree_view_ref':'hotel.hotel_checkin_partner_reservation_view_tree',
|
||||||
|
}"
|
||||||
|
/>
|
||||||
|
</page>
|
||||||
<page name="others" string="Others">
|
<page name="others" string="Others">
|
||||||
<group>
|
<group>
|
||||||
<field name="segmentation_ids" widget="many2many_tags" placeholder="Segmentation..."
|
<field name="segmentation_ids" widget="many2many_tags" placeholder="Segmentation..."
|
||||||
@@ -337,7 +341,6 @@
|
|||||||
<button icon="fa fa-2x fa-angellist"
|
<button icon="fa fa-2x fa-angellist"
|
||||||
attrs="{'invisible':['|',('folio_pending_amount','>',0),('state' ,'!=', 'done')]}"
|
attrs="{'invisible':['|',('folio_pending_amount','>',0),('state' ,'!=', 'done')]}"
|
||||||
type="object"
|
type="object"
|
||||||
id="open_folio"
|
|
||||||
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"
|
||||||
@@ -396,7 +399,6 @@
|
|||||||
<tree position="attributes">
|
<tree position="attributes">
|
||||||
<attribute name="editable">bottom</attribute>
|
<attribute name="editable">bottom</attribute>
|
||||||
<attribute name="delete">false</attribute>
|
<attribute name="delete">false</attribute>
|
||||||
<attribute name="options">{'no_open': True}</attribute>
|
|
||||||
<attribute name="string">Rooms</attribute>
|
<attribute name="string">Rooms</attribute>
|
||||||
</tree>
|
</tree>
|
||||||
<xpath expr="//field[@name='folio_id']" position="attributes">
|
<xpath expr="//field[@name='folio_id']" position="attributes">
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
decoration-success="is_board_service == True">
|
decoration-success="is_board_service == True">
|
||||||
<field name="is_board_service" invisible="1" />
|
<field name="is_board_service" invisible="1" />
|
||||||
<button type="object" class="oe_stat_button"
|
<button type="object" class="oe_stat_button"
|
||||||
id="included_in_room" icon="fa fa-1x fa-bed"
|
icon="fa fa-1x fa-bed"
|
||||||
name="open_service_lines"
|
name="open_service_lines"
|
||||||
attrs="{'invisible':[('is_board_service','=', False)]}" />
|
attrs="{'invisible':[('is_board_service','=', False)]}" />
|
||||||
<field name="per_day" invisible="1"/>
|
<field name="per_day" invisible="1"/>
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="product_qty" attrs="{'readonly': [('per_day','=',True)]}" force_save="1"/>
|
<field name="product_qty" attrs="{'readonly': [('per_day','=',True)]}" force_save="1"/>
|
||||||
<button type="object" class="oe_stat_button"
|
<button type="object" class="oe_stat_button"
|
||||||
id="go_service_lines" icon="fa fa-2x fa-bars"
|
icon="fa fa-2x fa-bars"
|
||||||
name="open_service_lines"
|
name="open_service_lines"
|
||||||
attrs="{'invisible': [('per_day','=',False)]}"/>
|
attrs="{'invisible': [('per_day','=',False)]}"/>
|
||||||
<field name="days_qty" invisible="1"/>
|
<field name="days_qty" invisible="1"/>
|
||||||
@@ -102,6 +102,7 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
<!-- Action for hotel service -->
|
<!-- Action for hotel service -->
|
||||||
<record model="ir.actions.act_window" id="action_hotel_services_form">
|
<record model="ir.actions.act_window" id="action_hotel_services_form">
|
||||||
<field name="name">Hotel Services</field>
|
<field name="name">Hotel Services</field>
|
||||||
|
|||||||
@@ -256,9 +256,8 @@ var HotelCalendarView = AbstractRenderer.extend({
|
|||||||
model = 'hotel.reservation';
|
model = 'hotel.reservation';
|
||||||
title = _t('Reservations');
|
title = _t('Reservations');
|
||||||
} else if (type === 'checkin') {
|
} else if (type === 'checkin') {
|
||||||
model = 'hotel.reservation';
|
model = 'hotel.checkin.partner';
|
||||||
title = _t('Checkins');
|
title = _t('Checkins');
|
||||||
domain.splice(0, 0, ['checkin', '=', moment().format(HotelConstants.ODOO_DATETIME_MOMENT_FORMAT)]);
|
|
||||||
} else if (type === 'invoice') {
|
} else if (type === 'invoice') {
|
||||||
model = 'sale.order';
|
model = 'sale.order';
|
||||||
title = _t('Invoices');
|
title = _t('Invoices');
|
||||||
|
|||||||
@@ -24,3 +24,4 @@ from . import category_type
|
|||||||
from . import code_ine
|
from . import code_ine
|
||||||
from . import inherit_res_company
|
from . import inherit_res_company
|
||||||
from . import inherit_res_partner
|
from . import inherit_res_partner
|
||||||
|
from . import inherit_hotel_checkin_partner
|
||||||
|
|||||||
38
hotel_l10n_es/models/inherit_hotel_checkin_partner.py
Normal file
38
hotel_l10n_es/models/inherit_hotel_checkin_partner.py
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# OpenERP, Open Source Management Solution
|
||||||
|
# Copyright (C) 2017 Alda Hotels <informatica@aldahotels.com>
|
||||||
|
# Jose Luis Algara <osotranquilo@gmail.com>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from openerp import models, fields, api, _
|
||||||
|
from odoo.osv.expression import get_unaccent_wrapper
|
||||||
|
|
||||||
|
|
||||||
|
class HotelCheckinPartner(models.Model):
|
||||||
|
_inherit = 'hotel.checkin.partner'
|
||||||
|
|
||||||
|
document_type = fields.Selection(related='partner_id.document_type')
|
||||||
|
document_number = fields.Char(related='partner_id.document_number')
|
||||||
|
document_expedition_date = fields.Date(related='partner_id.document_expedition_date')
|
||||||
|
|
||||||
|
code_ine_id = fields.Many2one(related="partner_id.code_ine_id")
|
||||||
|
|
||||||
|
#TMP_FIX VAT Validation
|
||||||
|
@api.constrains("vat")
|
||||||
|
def check_vat(self):
|
||||||
|
return
|
||||||
@@ -68,12 +68,12 @@ class ResPartner(models.Model):
|
|||||||
|
|
||||||
query = """SELECT id
|
query = """SELECT id
|
||||||
FROM res_partner
|
FROM res_partner
|
||||||
{where} ({poldocument} {operator} {percent})
|
{where} ({document_number} {operator} {percent})
|
||||||
ORDER BY {display_name} {operator} {percent} desc,
|
ORDER BY {display_name} {operator} {percent} desc,
|
||||||
{display_name}
|
{display_name}
|
||||||
""".format(where=where_str,
|
""".format(where=where_str,
|
||||||
operator=operator,
|
operator=operator,
|
||||||
poldocument=unaccent('poldocument'),
|
document_number=unaccent('document_number'),
|
||||||
display_name=unaccent('display_name'),
|
display_name=unaccent('display_name'),
|
||||||
percent=unaccent('%s'),)
|
percent=unaccent('%s'),)
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ class ResPartner(models.Model):
|
|||||||
|
|
||||||
#TODO: Review better VAT & DocumentNumber integration
|
#TODO: Review better VAT & DocumentNumber integration
|
||||||
@api.onchange('document_number')
|
@api.onchange('document_number')
|
||||||
def onchange_poldocument(self):
|
def onchange_document_number(self):
|
||||||
for partner in self:
|
for partner in self:
|
||||||
if partner.document_number and partner.document_type == 'D':
|
if partner.document_number and partner.document_type == 'D':
|
||||||
partner.vat = 'ES' + partner.poldocument
|
partner.vat = 'ES' + partner.document_number
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='reservation_id']" position="after">
|
<xpath expr="//field[@name='reservation_id']" position="after">
|
||||||
<button type="action" class="oe_stat_button"
|
<button type="action" class="oe_stat_button"
|
||||||
id="cardex_smart_button_2"
|
|
||||||
icon="fa-file-pdf-o"
|
icon="fa-file-pdf-o"
|
||||||
name="%(action_report_viajero)d"
|
name="%(action_report_viajero)d"
|
||||||
context="{'partner_id': partner_id,'enter_date': enter_date,
|
context="{'partner_id': partner_id,'enter_date': enter_date,
|
||||||
@@ -18,4 +17,48 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="hotel_checkin_partner_view_tree" model="ir.ui.view">
|
||||||
|
<field name="name">hotel.checkin.partner.view.tree</field>
|
||||||
|
<field name="model">hotel.checkin.partner</field>
|
||||||
|
<field name="inherit_id" ref="hotel.hotel_checkin_partner_view_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//button[@name='action_on_board']" position="before">
|
||||||
|
<button type="action" class="oe_stat_button"
|
||||||
|
icon="fa fa-2x fa-file-pdf-o"
|
||||||
|
name="%(action_report_viajero)d"
|
||||||
|
context="{'partner_id': partner_id,'enter_date': enter_date,
|
||||||
|
'exit_date': exit_date,'reservation_ids': reservation_id,
|
||||||
|
'hidden_cardex': True, 'edit_cardex': True }"/>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='partner_id']" position="after">
|
||||||
|
<field name="document_type"/>
|
||||||
|
<field name="document_number"/>
|
||||||
|
<field name="document_expedition_date"/>
|
||||||
|
<field name="code_ine_id" />
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="hotel_checkin_partner_reservation_view_tree" model="ir.ui.view">
|
||||||
|
<field name="name">hotel.checkin.partner.view.tree</field>
|
||||||
|
<field name="model">hotel.checkin.partner</field>
|
||||||
|
<field name="inherit_id" ref="hotel.hotel_checkin_partner_reservation_view_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//button[@name='action_on_board']" position="before">
|
||||||
|
<button type="action" class="oe_stat_button"
|
||||||
|
icon="fa fa-2x fa-file-pdf-o"
|
||||||
|
name="%(action_report_viajero)d"
|
||||||
|
context="{'partner_id': partner_id,'enter_date': enter_date,
|
||||||
|
'exit_date': exit_date,'reservation_ids': reservation_id,
|
||||||
|
'hidden_cardex': True, 'edit_cardex': True }"/>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='partner_id']" position="after">
|
||||||
|
<field name="document_type"/>
|
||||||
|
<field name="document_number"/>
|
||||||
|
<field name="document_expedition_date"/>
|
||||||
|
<field name="code_ine_id" />
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user