minor fixes

This commit is contained in:
Camilo Sarmiento 2020-07-11 10:21:01 -05:00
parent 1fb3708c2c
commit 2bb0b6e99d
7 changed files with 761 additions and 590 deletions

Binary file not shown.

View File

@ -267,6 +267,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'invalid_number_principal_guest': ('Must exist one principal guest'),
'payterm_missing': ('The payment term is missing!'),
'check_time_not_configured': ('The check out time is not configured!'),
'invalid_date_check_in': ('You cannot check in before the reserved date!'),
'missing_main_guest': ('Missing main guest in lines!'),
'missing_select_room': ('Missing select room!'),
'missing_default_configuration': ('Missing default configuration sequence!'),
@ -370,7 +371,10 @@ class Booking(Workflow, ModelSQL, ModelView):
@ModelView.button
@Workflow.transition('check_in')
def check_in(cls, records):
Date = Pool().get('ir.today')
for record in records:
if Date.today() < record.booking_date:
cls.raise_user_error('invalid_date_check_in')
cls.set_registration_card_number([record])
for line in record.lines:
if line.main_guest is None:

File diff suppressed because it is too large Load Diff

View File

@ -30,10 +30,10 @@ STATES_MNT = {
OPERATION_STATES = [
('draft', 'Draft'),
('check_in', 'Check-In'),
('check_out', 'Check-Out'),
('done', 'Done'),
('cancelled', 'Cancelled'),
('open', 'Open'),
('closed', 'Closes'),
('invoiced', 'Invoiced'),
('transfer', 'Transfer'),
]
COLOR_BOOKING = {
@ -136,24 +136,24 @@ class Operation(Workflow, ModelSQL, ModelView):
'time or check-out time!'),
})
cls._transitions |= set((
('draft', 'check_in'),
('draft', 'cancelled'),
('check_in', 'check_out'),
('check_out', 'done'),
('draft', 'open'),
('open', 'draft'),
('open', 'closed'),
('closed', 'open'),
))
cls._buttons.update({
'draft': {
'invisible': True,
},
'check_in': {
'open': {
'invisible': Eval('state') != 'draft',
},
'check_out_wizard': {
'invisible': Eval('state') != 'check_in',
},
'cancel': {
'invisible': Eval('state') != 'draft',
'close': {
'invisible': Eval('state') != 'open',
},
# 'cancel': {
# 'invisible': Eval('state') != 'draft',
# },
'bill': {
'invisible': Eval('invoice_state'),
},
@ -244,15 +244,15 @@ class Operation(Workflow, ModelSQL, ModelView):
@classmethod
@ModelView.button
@Workflow.transition('check_in')
def check_in(cls, records):
@Workflow.transition('open')
def open(cls, records):
for rec in records:
rec.update_housekeeping('check_in')
@classmethod
@ModelView.button
@Workflow.transition('check_out')
def check_out(cls, records):
@Workflow.transition('closed')
def close(cls, records):
for rec in records:
rec.update_housekeeping('check_out')
@ -267,11 +267,11 @@ class Operation(Workflow, ModelSQL, ModelView):
def draft(cls, records):
pass
@classmethod
@ModelView.button
@Workflow.transition('cancelled')
def cancel(cls, records):
pass
# @classmethod
# @ModelView.button
# @Workflow.transition('cancelled')
# def cancel(cls, records):
# pass
@classmethod
@ModelView.button_action('hotel.wizard_operation_check_out')
@ -1170,7 +1170,7 @@ class TransferOperation(Wizard):
'operation': target_op.id
})
current_op.state = 'check_out'
current_op.state = 'transfer'
current_op.operation_target = target_op.id
current_op.save()
target_op.save()

View File

@ -42,14 +42,14 @@ this repository contains the full copyright notices and license terms. -->
<menuitem name="Operations" parent="hotel.menu_hotel" sequence="14"
id="menu_hotel_operation" action="act_operation_tree"/>
<record model="ir.model.button" id="operation_cancel_button">
<!-- <record model="ir.model.button" id="operation_cancel_button">
<field name="name">cancel</field>
<field name="model" search="[('model', '=', 'hotel.operation')]"/>
</record>
<record model="ir.model.button-res.group" id="operation_cancel_button_group_hotel">
<field name="button" ref="operation_cancel_button"/>
<field name="group" ref="hotel.group_hotel"/>
</record>
</record> -->
<record model="ir.model.button" id="operation_draft_button">
<field name="name">draft</field>
@ -61,7 +61,7 @@ this repository contains the full copyright notices and license terms. -->
</record>
<record model="ir.model.button" id="operation_confirm_button">
<field name="name">confirm</field>
<field name="name">open</field>
<field name="model" search="[('model', '=', 'hotel.operation')]"/>
</record>
<record model="ir.model.button-res.group" id="operation_confirm_button_group_hotel">
@ -70,8 +70,8 @@ this repository contains the full copyright notices and license terms. -->
</record>
<record model="ir.model.button" id="hotel_operation_check_out_button">
<field name="name">check_out</field>
<field name="string">Check Out</field>
<field name="name">close</field>
<field name="string">Closed</field>
<field name="model" search="[('model', '=', 'hotel.operation')]"/>
</record>
<record model="ir.model.button-res.group" id="hotel_operation_check_out_button_group_hotel">
@ -202,9 +202,9 @@ this repository contains the full copyright notices and license terms. -->
<field name="act_window" ref="act_operation_tree"/>
</record>
<record model="ir.action.act_window.domain" id="act_operation_form_domain_check_in">
<field name="name">Check In</field>
<field name="name">Open</field>
<field name="sequence" eval="30"/>
<field name="domain" eval="[('state', '=', 'check_in')]" pyson="1"/>
<field name="domain" eval="[('state', '=', 'open')]" pyson="1"/>
<field name="count" eval="True"/>
<field name="act_window" ref="act_operation_tree"/>
</record>

View File

@ -14,7 +14,9 @@ __all__ = ['Service', 'ServiceLine', 'ServiceReport', 'ServiceKind',
STATES = {
'readonly': Eval('state') == 'checked'
}
STATES_LINE = {
'readonly': Eval('state') == 'loaded'
}
class ServiceKind(ModelSQL, ModelView):
'Service Kind'
@ -127,21 +129,21 @@ class ServiceLine(Workflow, ModelSQL, ModelView):
'Service Line'
__name__ = 'hotel.service.line'
service = fields.Many2One('hotel.service', 'Service', required=True)
room = fields.Many2One('hotel.room', 'Room', select=True, required=True)
time_service = fields.Time('Time Service', select=True)
room = fields.Many2One('hotel.room', 'Room', select=True, required=True, states=STATES_LINE)
time_service = fields.Time('Time Service', select=True, states=STATES_LINE)
product = fields.Many2One('product.product', 'Product',
domain=[
('salable', '=', True),
('active', '=', True),
], required=True)
# ('template.kind', '!=', 'accommodation'),
quantity = fields.Integer('Quantity', required=True)
description = fields.Char('Description')
order = fields.Char('Order', select=True, states=STATES)
quantity = fields.Integer('Quantity', required=True, states=STATES_LINE)
description = fields.Char('Description', states=STATES_LINE)
order = fields.Char('Order', select=True, states=STATES_LINE)
sale_line = fields.Many2One('sale.line', 'Sale Line', states={
'readonly': True,
})
guest = fields.Many2One('hotel.operation.guest', 'Guest', states=STATES,
guest = fields.Many2One('hotel.operation.guest', 'Guest', states=STATES_LINE,
domain=[
('operation.room', '=', Eval('room')),
# ('operation.start_date', '<=', Eval('')),

View File

@ -65,8 +65,8 @@ this repository contains the full copyright notices and license terms. -->
<label name="total_amount"/>
<field name="total_amount"/>
<button name="pay_advance" string="Pay Advance" icon="tryton-ok"/>
<button name="check_in" string="Check In" icon="tryton-ok"/>
<button name="check_out_wizard" string="Check Out" icon="tryton-ok"/>
<button name="open" string="Open" icon="tryton-ok"/>
<button name="closed" string="Closed" icon="tryton-ok"/>
<button name="bill" string="Bill" icon="tryton-ok"/>
</group>
</form>