From 9e1bf442b3d7122c7c3f7c8864660eb6fbfddf68 Mon Sep 17 00:00:00 2001 From: Dario Lodeiros Date: Fri, 18 Jan 2019 17:37:43 +0100 Subject: [PATCH] [WIP] Invoice WorkFlow --- hotel/models/hotel_folio.py | 5 -- hotel/models/hotel_reservation_line.py | 10 +++ hotel/views/hotel_folio_views.xml | 3 +- hotel/views/hotel_reservation_views.xml | 8 +- hotel/wizard/folio_make_invoice_advance.py | 76 +++++++++---------- .../folio_make_invoice_advance_views.xml | 26 ++++--- 6 files changed, 72 insertions(+), 56 deletions(-) diff --git a/hotel/models/hotel_folio.py b/hotel/models/hotel_folio.py index 3f1f34b37..5049dd8e4 100644 --- a/hotel/models/hotel_folio.py +++ b/hotel/models/hotel_folio.py @@ -228,7 +228,6 @@ class HotelFolio(models.Model): 'Prepaid Warning Days', help='Margin in days to create a notice if a payment \ advance has not been recorded') - rooms_char = fields.Char('Rooms', compute='_computed_rooms_char') segmentation_ids = fields.Many2many('res.partner.category', string='Segmentation') client_order_ref = fields.Char(string='Customer Reference', copy=False) @@ -253,10 +252,6 @@ class HotelFolio(models.Model): 'amount_total': amount_untaxed + amount_tax, }) - def _computed_rooms_char(self): - for record in self: - record.rooms_char = ', '.join(record.mapped('room_lines.room_id.name')) - @api.depends('amount_total', 'payment_ids', 'return_ids') @api.multi def compute_amount(self): diff --git a/hotel/models/hotel_reservation_line.py b/hotel/models/hotel_reservation_line.py index 84a1e5ff5..7ee0fbf22 100644 --- a/hotel/models/hotel_reservation_line.py +++ b/hotel/models/hotel_reservation_line.py @@ -4,11 +4,21 @@ from odoo import models, fields, api, _ from odoo.addons import decimal_precision as dp from odoo.exceptions import ValidationError +from datetime import date class HotelReservationLine(models.Model): _name = "hotel.reservation.line" _order = "date" + @api.multi + def name_get(self): + result = [] + for res in self: + date = fields.Date.from_string(res.date) + name = u'%s/%s' % (date.day, date.month) + result.append((res.id, name)) + return result + reservation_id = fields.Many2one('hotel.reservation', string='Reservation', ondelete='cascade', required=True, copy=False) diff --git a/hotel/views/hotel_folio_views.xml b/hotel/views/hotel_folio_views.xml index 862dea67f..315445b0d 100644 --- a/hotel/views/hotel_folio_views.xml +++ b/hotel/views/hotel_folio_views.xml @@ -201,6 +201,7 @@
+
@@ -219,7 +220,7 @@ - + diff --git a/hotel/views/hotel_reservation_views.xml b/hotel/views/hotel_reservation_views.xml index 42fed20c2..3cda84a48 100644 --- a/hotel/views/hotel_reservation_views.xml +++ b/hotel/views/hotel_reservation_views.xml @@ -195,10 +195,13 @@ + ('pricelist_id', 'in', [pricelist_id, False])]" + options="{'no_create': True,'no_open': True}" /> + + @@ -259,7 +262,7 @@ attrs = "{'required': [('per_day','=',True)]}" /> + options="{'no_create': True,'no_open': True}" />