diff --git a/booking.py b/booking.py
index c2bc46b..740ed05 100644
--- a/booking.py
+++ b/booking.py
@@ -150,7 +150,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'invisible': Eval('state').in_(['finished', 'cancelled', 'not_show']),
},
'create_guest': {
- 'invisible': Eval('state') != 'offer',
+ 'invisible': Eval('party'),
},
'cancel': {
'invisible': Eval('state').in_(
@@ -379,9 +379,11 @@ class Booking(Workflow, ModelSQL, ModelView):
else:
party = fo.main_guest
- booking = fo.booking
+ if not party:
+ raise UserError(gettext('hotel.msg_customer_is_required'))
+ bk = fo.booking
# FIXME: Add agent
- agent_id = booking.party_seller.party.id if booking.party_seller else None
+ agent_id = bk.party_seller.agent.id if bk.party_seller else None
if party.id not in res.keys():
# Add room product to sale
reference = ''
@@ -393,23 +395,23 @@ class Booking(Workflow, ModelSQL, ModelView):
)
res[party.id] = {
'party': party,
- 'currency': booking.currency.id,
+ 'currency': bk.currency.id,
'payment_term': None,
'guests_qty': len(fo.guests) + 1,
'reference': reference,
- # 'agent': agent_id,
+ 'agent': agent_id,
'rooms': fo.room.name,
- 'company': booking.company.id,
- 'price_list': booking.price_list.id if booking.price_list else None,
+ 'company': bk.company.id,
+ 'price_list': bk.price_list.id if bk.price_list else None,
'add_default_charges': False,
- 'vouchers': booking.vouchers,
+ 'vouchers': bk.vouchers,
'lines': [{
'folios': [fo],
'description': fo.get_room_info(),
'quantity': fo.nights_quantity,
'product': fo.product,
'unit_price': fo.unit_price,
- 'taxes_exception': booking.taxes_exception,
+ 'taxes_exception': bk.taxes_exception,
}]
}
else:
@@ -420,17 +422,17 @@ class Booking(Workflow, ModelSQL, ModelView):
'quantity': fo.nights_quantity,
'product': fo.product,
'unit_price': fo.unit_price,
- 'taxes_exception': booking.taxes_exception,
+ 'taxes_exception': bk.taxes_exception,
})
for charge in charges:
invoice_party_id = charge.invoice_to.id
- unit_price = booking.currency.round(charge.unit_price)
+ unit_price = bk.currency.round(charge.unit_price)
if invoice_party_id != party.id:
if invoice_party_id not in res.keys():
res[invoice_party_id] = {
'party': charge.invoice_to.id,
- 'currency': booking.currency.id,
+ 'currency': bk.currency.id,
'payment_term': None,
'lines': [],
}
@@ -444,7 +446,7 @@ class Booking(Workflow, ModelSQL, ModelView):
'product': charge.product,
'unit_price': unit_price,
'charge': charge,
- 'taxes_exception': booking.taxes_exception,
+ 'taxes_exception': bk.taxes_exception,
})
return res
@@ -454,6 +456,7 @@ class Booking(Workflow, ModelSQL, ModelView):
new_line = {
'type': 'line',
'invoice': invoice.id,
+ 'operation_center': 1,
'unit': product.template.default_uom.id,
'account': product.template.account_category.account_revenue_used.id,
'invoice_type': 'out',
@@ -517,11 +520,14 @@ class Booking(Workflow, ModelSQL, ModelView):
if rec.get('guests_qty') and rec.get('add_default_charges'):
for product in config.default_charges:
if rec['party']:
- taxes_ids = cls.get_taxes(product, rec['party'], invoice.currency)
+ taxes_ids = cls.get_taxes(
+ product, rec['party'], invoice.currency
+ )
new_line = {
'invoice': invoice.id,
'type': 'line',
'unit': product.template.default_uom.id,
+ 'operation_center': 1,
'quantity': rec['guests_qty'],
'unit_price': product.template.list_price,
'product': product.id,
@@ -737,6 +743,7 @@ class SelectRoomsAsk(ModelView):
overbooking = fields.Boolean('Overbooking')
targets = fields.Function(fields.Many2Many('hotel.room', None, None,
'Targets'), 'on_change_with_targets')
+ unit_price = fields.Numeric('Unit Price', digits=(16, 4))
@staticmethod
def default_accommodation():
diff --git a/booking.xml b/booking.xml
index 9c54b72..02a1839 100644
--- a/booking.xml
+++ b/booking.xml
@@ -113,7 +113,7 @@ this repository contains the full copyright notices and license terms. -->
-
diff --git a/channel.py b/channel.py
index 6a06e9c..dad3df7 100644
--- a/channel.py
+++ b/channel.py
@@ -35,10 +35,12 @@ class SaleChannel(ModelSQL, ModelView):
depends=['company', 'type_commission'])
taxes = fields.Many2Many('hotel.channel-account.tax',
'channel', 'tax', 'Channel Taxes',
- domain=[('parent', '=', None), ['OR',
+ domain=[
+ ('parent', '=', None), ['OR',
('group', '=', None),
('group.kind', 'in', ['purchase', 'both'])],
- ])
+ ]
+ )
currency = fields.Many2One('currency.currency', 'Currency',
required=True)
price_list = fields.Many2One('product.price_list', 'Price List')
diff --git a/folio.fodt b/folio.fodt
index e662ac2..20fffa3 100644
Binary files a/folio.fodt and b/folio.fodt differ
diff --git a/folio.py b/folio.py
index 692723f..11ede1b 100644
--- a/folio.py
+++ b/folio.py
@@ -484,9 +484,9 @@ class Folio(ModelSQL, ModelView):
Calculation of sale commission for channel based on booking total amount
"""
res = Decimal(0)
- if self.total_amount and self.booking.party_seller and \
- self.booking.party_seller.party.sale_commission:
- res = self.total_amount * self.booking.party_seller.sale_commission / 100
+ # if self.total_amount and self.booking.party_seller and \
+ # self.booking.party_seller.agent.sale_commission:
+ # res = self.total_amount * self.booking.party_seller.sale_commission / 100
return res
diff --git a/housekeeping.xml b/housekeeping.xml
index 3dfbbc6..b72ec16 100644
--- a/housekeeping.xml
+++ b/housekeeping.xml
@@ -28,7 +28,7 @@ this repository contains the full copyright notices and license terms. -->
-
diff --git a/message.xml b/message.xml
index 9be34c4..16e14a7 100644
--- a/message.xml
+++ b/message.xml
@@ -72,5 +72,8 @@ this repository contains the full copyright notices and license terms. -->
Error, you can not delete folios actives
+
+ The customer is required!
+
diff --git a/party.py b/party.py
index e01abd4..37af18f 100644
--- a/party.py
+++ b/party.py
@@ -36,75 +36,6 @@ class Party(metaclass=PoolMeta):
visa_date = fields.Date('Visa Date')
-# class CreateGuestStart(ModelView):
-# 'Create Party to Guest Start'
-# __name__ = 'hotel.party.guest.start'
-# full_name = fields.Char('Name')
-# first_name = fields.Char('First Name')
-# second_name = fields.Char('Second Name')
-# first_family_name = fields.Char('First Family Name')
-# second_family_name = fields.Char('Second Family Name')
-# type_document = fields.Selection(TYPE_DOCUMENT, 'Type Document')
-# id_number = fields.Char('Id Number')
-# type_document = fields.Selection([
-# ('12', 'Tarjeta de Identidad'),
-# ('13', 'Cedula de Ciudadania'),
-# ('21', 'Tarjeta de Extranjeria'),
-# ('22', 'Cedula de Extranjeria'),
-# ('41', 'Pasaporte'),
-# ], 'Document Type')
-# mobile = fields.Char('Mobile', select=True)
-# email = fields.Char('Email', select=True)
-# birthday = fields.Date('Birthday', select=True)
-# sex = fields.Selection([
-# ('female', 'Female'),
-# ('male', 'Male'),
-# ('', ''),
-# ], 'Sex')
-# type_person = fields.Selection([
-# ('persona_natural', 'Persona Natural'),
-# ('persona_juridica', 'Persona Juridica'),
-# ], 'Type Person')
-#
-# @fields.depends('full_name', 'first_name', 'second_name',
-# 'first_family_name', 'second_family_name','type_person')
-# def on_change_full_name(self):
-# second_family_name = None
-# first_family_name = None
-# second_name = None
-# first_name = None
-# if self.full_name and self.type_person == 'persona_natural':
-# names = self.full_name.split(' ')
-# first_name = names[0]
-# second_family_name = names[-1]
-# if len(names) > 1:
-# first_family_name = names[-2]
-# if len(names) == 2:
-# second_family_name = None
-# first_family_name = names[1]
-# elif len(names) == 5:
-# second_name = names[1] + ' ' + names[2]
-# elif len(names) == 4:
-# second_name = names[1]
-#
-# self.second_family_name = second_family_name
-# self.first_family_name = first_family_name
-# self.second_name = second_name
-# self.first_name = first_name
-#
-# @staticmethod
-# def default_sex():
-# return 'male'
-#
-# @staticmethod
-# def default_type_person():
-# return 'persona_natural'
-#
-# @staticmethod
-# def default_type_document():
-# return '13'
-
-
class CreateGuest(Wizard):
'Create Party to Guest'
__name__ = 'hotel.party.guest'
@@ -134,18 +65,33 @@ class CreateGuest(Wizard):
'type': contact.type, 'value': contact.value
})
- party, = Party.create([{
+ if self.start.type_document == '31':
+ type_person = 'persona_juridica'
+ else:
+ type_person = 'persona_natural'
+
+ to_create = {
'name': self.start.name,
'id_number': self.start.id_number,
'type_document': self.start.type_document,
+ 'type_person': type_person,
'birthday': self.start.birthday,
'sex': self.start.sex,
'first_name': self.start.first_name,
'second_name': self.start.second_name,
'first_family_name': self.start.first_family_name,
'second_family_name': self.start.second_family_name,
- 'contact_mechanisms': [('create', contact_mechanisms)]
- }])
+ 'contact_mechanisms': [('create', contact_mechanisms)],
+ 'addresses': [('create', [{
+ 'street': '',
+ }])]
+ }
+ party, = Party.create([to_create])
party_id = party.id
Booking.write([record], {'party': party_id})
+ if record.lines:
+ for folio in record.lines:
+ if not folio.main_guest:
+ folio.main_guest = party_id
+ folio.save()
return 'end'
diff --git a/service.xml b/service.xml
index 49e3777..e74a7a8 100644
--- a/service.xml
+++ b/service.xml
@@ -40,7 +40,7 @@ this repository contains the full copyright notices and license terms. -->
-
diff --git a/view/booking_folio_form.xml b/view/booking_folio_form.xml
index 4b3307a..a8253d0 100644
--- a/view/booking_folio_form.xml
+++ b/view/booking_folio_form.xml
@@ -22,12 +22,12 @@ this repository contains the full copyright notices and license terms. -->
-
-
+
diff --git a/view/booking_form.xml b/view/booking_form.xml
index 203c487..6cd4440 100644
--- a/view/booking_form.xml
+++ b/view/booking_form.xml
@@ -3,9 +3,9 @@
this repository contains the full copyright notices and license terms. -->