diff --git a/hotel/wizard/__init__.py b/hotel/wizard/__init__.py index 2717e90d1..d353dd16e 100644 --- a/hotel/wizard/__init__.py +++ b/hotel/wizard/__init__.py @@ -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 diff --git a/hotel/wizard/service_on_day.py b/hotel/wizard/service_on_day.py new file mode 100644 index 000000000..282c5a92e --- /dev/null +++ b/hotel/wizard/service_on_day.py @@ -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 diff --git a/hotel/wizard/service_on_day.xml b/hotel/wizard/service_on_day.xml new file mode 100644 index 000000000..bdd5e8ef7 --- /dev/null +++ b/hotel/wizard/service_on_day.xml @@ -0,0 +1,34 @@ + + + + + service.on.day.view.form + service.on.day + +
+ + + + + +
+
+
+
+
+ + + Service on Day + ir.actions.act_window + service.on.day + + form + form + new + + +