Fix
This commit is contained in:
parent
1053782dd0
commit
ef6b5d79cf
10
booking.py
10
booking.py
|
@ -757,15 +757,14 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
)
|
||||
|
||||
def update_folio(self, state):
|
||||
Line = Pool().get('hotel.folio')
|
||||
Line.write(list(self.lines), {'registration_state': state})
|
||||
Folio = Pool().get('hotel.folio')
|
||||
Folio.write(list(self.lines), {'registration_state': state})
|
||||
|
||||
def check_rooms(self):
|
||||
pool = Pool()
|
||||
Housekeeping = Pool().get('hotel.housekeeping')
|
||||
rooms_ids = []
|
||||
for line in self.lines:
|
||||
rooms_ids.append(line.room.id)
|
||||
Housekeeping = pool.get('hotel.housekeeping')
|
||||
housekeepings = Housekeeping.search([
|
||||
('state', '!=', 'clean')
|
||||
])
|
||||
|
@ -1333,7 +1332,7 @@ class UpdateHolderStart(ModelView):
|
|||
target_country = fields.Many2One('party.country_code', 'Target Country')
|
||||
|
||||
country = fields.Many2One('party.country_code', 'Country')
|
||||
city = fields.Char('City')
|
||||
city = fields.Many2One('party.country_city', 'City')
|
||||
address = fields.Char('Address')
|
||||
|
||||
type_document = fields.Selection(TYPE_DOCUMENT, 'Tipo de Documento',
|
||||
|
@ -1490,7 +1489,6 @@ class UpdateHolder(Wizard):
|
|||
if edit:
|
||||
Party.write([booking.party], rec)
|
||||
else:
|
||||
print(rec)
|
||||
party, = Party.create([rec])
|
||||
Booking.write([booking], {'party': party.id})
|
||||
booking.save()
|
||||
|
|
13
constants.py
13
constants.py
|
@ -112,3 +112,16 @@ TYPE_DOCUMENT = [
|
|||
('91', 'NUIP'),
|
||||
('', ''),
|
||||
]
|
||||
|
||||
COLOR_BOOKING = {
|
||||
'draft': '#9b9f9f',
|
||||
'check_in': '#e6bd0f',
|
||||
'check_out': '#09a4cd',
|
||||
'done': '#315274',
|
||||
}
|
||||
|
||||
COLOR_MNT = {
|
||||
'draft': '#e87a7a',
|
||||
'confirmed': '#d45757',
|
||||
'done': '#d45757',
|
||||
}
|
||||
|
|
35
folio.py
35
folio.py
|
@ -14,7 +14,8 @@ from trytond.transaction import Transaction
|
|||
from trytond.model.exceptions import AccessError
|
||||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
from .constants import REGISTRATION_STATE, COMPLEMENTARY, INVOICE_STATES
|
||||
from .constants import (REGISTRATION_STATE, COMPLEMENTARY, INVOICE_STATES,
|
||||
COLOR_BOOKING, COLOR_MNT)
|
||||
|
||||
STATES_CHECKIN = {
|
||||
'readonly': Eval('registration_state').in_(
|
||||
|
@ -34,23 +35,7 @@ STATES_OP = {
|
|||
'readonly': Eval('state').in_(['check_out', 'done', 'cancelled'])
|
||||
}
|
||||
|
||||
STATES_MNT = {
|
||||
'readonly': Eval('state') != 'draft',
|
||||
}
|
||||
|
||||
COLOR_BOOKING = {
|
||||
'draft': '#9b9f9f',
|
||||
'check_in': '#e6bd0f',
|
||||
'check_out': '#09a4cd',
|
||||
'done': '#315274',
|
||||
}
|
||||
|
||||
COLOR_MNT = {
|
||||
'draft': '#e87a7a',
|
||||
'confirmed': '#d45757',
|
||||
'done': '#d45757',
|
||||
}
|
||||
|
||||
STATES_MNT = {'readonly': Eval('state') != 'draft'}
|
||||
_ZERO = Decimal('0')
|
||||
|
||||
|
||||
|
@ -217,6 +202,7 @@ class Folio(ModelSQL, ModelView):
|
|||
rec.set_registration_number()
|
||||
rec.booking.check_rooms()
|
||||
rec.add_main_guest()
|
||||
cls.update_room(rec.room, 'dirty')
|
||||
cls.write(records, {'registration_state': 'check_in'})
|
||||
|
||||
@classmethod
|
||||
|
@ -224,6 +210,7 @@ class Folio(ModelSQL, ModelView):
|
|||
def check_out(cls, records):
|
||||
for record in records:
|
||||
cls.write([record], {'registration_state': 'check_out'})
|
||||
cls.update_room(rec.room, 'dirty')
|
||||
|
||||
@classmethod
|
||||
@ModelView.button
|
||||
|
@ -244,6 +231,15 @@ class Folio(ModelSQL, ModelView):
|
|||
def default_registration_state():
|
||||
return 'pending'
|
||||
|
||||
@classmethod
|
||||
def update_room(cls, room, state):
|
||||
Housekeeping = pool.get('hotel.housekeeping')
|
||||
hkrooms = Housekeeping.search([
|
||||
('room', '=', room.id),
|
||||
])
|
||||
method = getattr(cls, state)
|
||||
method([hkrooms])
|
||||
|
||||
def get_invoice_state(self, name=None):
|
||||
if self.invoice_line:
|
||||
return self.invoice_line.invoice.state
|
||||
|
@ -269,8 +265,7 @@ class Folio(ModelSQL, ModelView):
|
|||
self.save()
|
||||
|
||||
def add_main_guest(self):
|
||||
pool = Pool()
|
||||
Guest = pool.get('hotel.folio.guest')
|
||||
Guest = Pool().get('hotel.folio.guest')
|
||||
Guest.create([{
|
||||
'folio': self.id,
|
||||
'party': self.main_guest.id,
|
||||
|
|
|
@ -6,17 +6,10 @@ from trytond.pool import PoolMeta
|
|||
|
||||
class Invoice(metaclass=PoolMeta):
|
||||
__name__ = 'account.invoice'
|
||||
# boxes = fields.Float('Boxes', digits=(6, 2))
|
||||
# packing_qty = fields.Float('Pieces', digits=(6, 2))
|
||||
# quantity = fields.Float('Quantity', digits=(6, 2))
|
||||
# unit_qty = fields.Float('Stems', digits=(6, 2))
|
||||
|
||||
@classmethod
|
||||
def post(cls, invoices):
|
||||
super(Invoice, cls).post(invoices)
|
||||
# qty = self.quantity
|
||||
# if self.purchase.invoice_method != 'manual':
|
||||
# print(' qty ', qty)
|
||||
for invoice in invoices:
|
||||
if invoice.type == 'out':
|
||||
cls.set_advances_from_origin(invoice)
|
||||
|
|
16
party.py
16
party.py
|
@ -8,13 +8,6 @@ from trytond.transaction import Transaction
|
|||
from trytond.exceptions import UserError
|
||||
from trytond.i18n import gettext
|
||||
|
||||
TYPE = [
|
||||
('', ''),
|
||||
('service_acomplished', 'Service Acomplished'),
|
||||
('direct', 'Direct'),
|
||||
('implicit', 'Implicit'),
|
||||
]
|
||||
|
||||
|
||||
class Party(metaclass=PoolMeta):
|
||||
__name__ = 'party.party'
|
||||
|
@ -22,15 +15,6 @@ class Party(metaclass=PoolMeta):
|
|||
Party field and function aditions for channels management. Sales
|
||||
commissions, taxes and price lists.
|
||||
'''
|
||||
sale_commission = fields.Numeric('Sales Commission %', digits=(3, 2),
|
||||
help="Add the percentage of sales commission for this channel.",)
|
||||
# Must be required if party is hotel channel.
|
||||
# states={
|
||||
# 'readonly': ~Eval('active', True),
|
||||
# 'required': Bool(Eval('vat_country')),
|
||||
# },
|
||||
# depends=['active', 'vat_country'], size=12, select=True)
|
||||
sale_commission_type = fields.Selection(TYPE, 'Sales Commission Type')
|
||||
visa_category = fields.Char('Visa Category')
|
||||
visa_number = fields.Char('Visa Number')
|
||||
visa_date = fields.Date('Visa Date')
|
||||
|
|
|
@ -2,12 +2,6 @@
|
|||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<data>
|
||||
<xpath expr="/form/notebook/page[@id='sale']" position="inside">
|
||||
<label name="sale_commission"/>
|
||||
<field name="sale_commission"/>
|
||||
<label name="sale_commission_type"/>
|
||||
<field name="sale_commission_type"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/notebook/page[@id='sale']" position="after">
|
||||
<page string="Hotel" id="hotel">
|
||||
<label name="visa_category"/>
|
||||
|
|
Loading…
Reference in New Issue