mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Service on day wizard
This commit is contained in:
@@ -27,3 +27,4 @@ from . import split_reservation
|
||||
from . import duplicate_reservation
|
||||
from . import massive_price_reservation_days
|
||||
from . import wizard_reservation
|
||||
from . import service_on_day
|
||||
|
||||
36
hotel/wizard/service_on_day.py
Normal file
36
hotel/wizard/service_on_day.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# Copyright 2017 Darío Lodeiros
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
from openerp import models, fields, api
|
||||
|
||||
|
||||
class ServiceOnDay(models.TransientModel):
|
||||
_name = 'service.on.day'
|
||||
|
||||
|
||||
product_id = fields.Many2one('product.product', 'Service', required=True,
|
||||
domain=[('per_day', '=', True)])
|
||||
product_qty = fields.Integer('Quantity', default=1)
|
||||
date = fields.Date('Date', default=fields.Date.today())
|
||||
|
||||
@api.multi
|
||||
def set_service(self):
|
||||
self.ensure_one()
|
||||
hotel_reservation_obj = self.env['hotel.reservation']
|
||||
reservation = hotel_reservation_obj.browse(
|
||||
self.env.context.get('active_id'))
|
||||
if not reservation:
|
||||
return False
|
||||
service_data = [(0, 0, {
|
||||
'product_id': self.product_id.id,
|
||||
'reservation_id': reservation.id,
|
||||
'folio_id': reservation.folio_id.id,
|
||||
'product_qty': self.product_qty,
|
||||
'service_line_ids': [(0, 0, {
|
||||
'date': self.date,
|
||||
'day_qty': self.product_qty
|
||||
})]
|
||||
})]
|
||||
reservation.write({
|
||||
'service_ids': service_data
|
||||
})
|
||||
return True
|
||||
34
hotel/wizard/service_on_day.xml
Normal file
34
hotel/wizard/service_on_day.xml
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="service_on_day_view_form">
|
||||
<field name="name">service.on.day.view.form</field>
|
||||
<field name="model">service.on.day</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Service on Day" >
|
||||
<group>
|
||||
<field name="product_id" />
|
||||
<field name="date" />
|
||||
<field name="product_qty" />
|
||||
</group>
|
||||
<footer>
|
||||
<button name="set_service" string="Set Service" type="object"
|
||||
class="oe_highlight" />
|
||||
or
|
||||
<button string="Cancel" class="oe_link" special="cancel" />
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_service_on_day" model="ir.actions.act_window">
|
||||
<field name="name">Service on Day</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">service.on.day</field>
|
||||
<field name="view_id" ref="service_on_day_view_form"/>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user