This commit is contained in:
oscar alvarez 2022-03-25 10:03:19 -05:00
parent 1053782dd0
commit ef6b5d79cf
6 changed files with 32 additions and 55 deletions

View File

@ -757,15 +757,14 @@ class Booking(Workflow, ModelSQL, ModelView):
) )
def update_folio(self, state): def update_folio(self, state):
Line = Pool().get('hotel.folio') Folio = Pool().get('hotel.folio')
Line.write(list(self.lines), {'registration_state': state}) Folio.write(list(self.lines), {'registration_state': state})
def check_rooms(self): def check_rooms(self):
pool = Pool() Housekeeping = Pool().get('hotel.housekeeping')
rooms_ids = [] rooms_ids = []
for line in self.lines: for line in self.lines:
rooms_ids.append(line.room.id) rooms_ids.append(line.room.id)
Housekeeping = pool.get('hotel.housekeeping')
housekeepings = Housekeeping.search([ housekeepings = Housekeeping.search([
('state', '!=', 'clean') ('state', '!=', 'clean')
]) ])
@ -1333,7 +1332,7 @@ class UpdateHolderStart(ModelView):
target_country = fields.Many2One('party.country_code', 'Target Country') target_country = fields.Many2One('party.country_code', 'Target Country')
country = fields.Many2One('party.country_code', 'Country') country = fields.Many2One('party.country_code', 'Country')
city = fields.Char('City') city = fields.Many2One('party.country_city', 'City')
address = fields.Char('Address') address = fields.Char('Address')
type_document = fields.Selection(TYPE_DOCUMENT, 'Tipo de Documento', type_document = fields.Selection(TYPE_DOCUMENT, 'Tipo de Documento',
@ -1490,7 +1489,6 @@ class UpdateHolder(Wizard):
if edit: if edit:
Party.write([booking.party], rec) Party.write([booking.party], rec)
else: else:
print(rec)
party, = Party.create([rec]) party, = Party.create([rec])
Booking.write([booking], {'party': party.id}) Booking.write([booking], {'party': party.id})
booking.save() booking.save()

View File

@ -112,3 +112,16 @@ TYPE_DOCUMENT = [
('91', 'NUIP'), ('91', 'NUIP'),
('', ''), ('', ''),
] ]
COLOR_BOOKING = {
'draft': '#9b9f9f',
'check_in': '#e6bd0f',
'check_out': '#09a4cd',
'done': '#315274',
}
COLOR_MNT = {
'draft': '#e87a7a',
'confirmed': '#d45757',
'done': '#d45757',
}

View File

@ -14,7 +14,8 @@ from trytond.transaction import Transaction
from trytond.model.exceptions import AccessError from trytond.model.exceptions import AccessError
from trytond.exceptions import UserError from trytond.exceptions import UserError
from trytond.i18n import gettext 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 = { STATES_CHECKIN = {
'readonly': Eval('registration_state').in_( 'readonly': Eval('registration_state').in_(
@ -34,23 +35,7 @@ STATES_OP = {
'readonly': Eval('state').in_(['check_out', 'done', 'cancelled']) 'readonly': Eval('state').in_(['check_out', 'done', 'cancelled'])
} }
STATES_MNT = { STATES_MNT = {'readonly': Eval('state') != 'draft'}
'readonly': Eval('state') != 'draft',
}
COLOR_BOOKING = {
'draft': '#9b9f9f',
'check_in': '#e6bd0f',
'check_out': '#09a4cd',
'done': '#315274',
}
COLOR_MNT = {
'draft': '#e87a7a',
'confirmed': '#d45757',
'done': '#d45757',
}
_ZERO = Decimal('0') _ZERO = Decimal('0')
@ -217,6 +202,7 @@ class Folio(ModelSQL, ModelView):
rec.set_registration_number() rec.set_registration_number()
rec.booking.check_rooms() rec.booking.check_rooms()
rec.add_main_guest() rec.add_main_guest()
cls.update_room(rec.room, 'dirty')
cls.write(records, {'registration_state': 'check_in'}) cls.write(records, {'registration_state': 'check_in'})
@classmethod @classmethod
@ -224,6 +210,7 @@ class Folio(ModelSQL, ModelView):
def check_out(cls, records): def check_out(cls, records):
for record in records: for record in records:
cls.write([record], {'registration_state': 'check_out'}) cls.write([record], {'registration_state': 'check_out'})
cls.update_room(rec.room, 'dirty')
@classmethod @classmethod
@ModelView.button @ModelView.button
@ -244,6 +231,15 @@ class Folio(ModelSQL, ModelView):
def default_registration_state(): def default_registration_state():
return 'pending' 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): def get_invoice_state(self, name=None):
if self.invoice_line: if self.invoice_line:
return self.invoice_line.invoice.state return self.invoice_line.invoice.state
@ -269,8 +265,7 @@ class Folio(ModelSQL, ModelView):
self.save() self.save()
def add_main_guest(self): def add_main_guest(self):
pool = Pool() Guest = Pool().get('hotel.folio.guest')
Guest = pool.get('hotel.folio.guest')
Guest.create([{ Guest.create([{
'folio': self.id, 'folio': self.id,
'party': self.main_guest.id, 'party': self.main_guest.id,

View File

@ -6,17 +6,10 @@ from trytond.pool import PoolMeta
class Invoice(metaclass=PoolMeta): class Invoice(metaclass=PoolMeta):
__name__ = 'account.invoice' __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 @classmethod
def post(cls, invoices): def post(cls, invoices):
super(Invoice, cls).post(invoices) super(Invoice, cls).post(invoices)
# qty = self.quantity
# if self.purchase.invoice_method != 'manual':
# print(' qty ', qty)
for invoice in invoices: for invoice in invoices:
if invoice.type == 'out': if invoice.type == 'out':
cls.set_advances_from_origin(invoice) cls.set_advances_from_origin(invoice)

View File

@ -8,13 +8,6 @@ from trytond.transaction import Transaction
from trytond.exceptions import UserError from trytond.exceptions import UserError
from trytond.i18n import gettext from trytond.i18n import gettext
TYPE = [
('', ''),
('service_acomplished', 'Service Acomplished'),
('direct', 'Direct'),
('implicit', 'Implicit'),
]
class Party(metaclass=PoolMeta): class Party(metaclass=PoolMeta):
__name__ = 'party.party' __name__ = 'party.party'
@ -22,15 +15,6 @@ class Party(metaclass=PoolMeta):
Party field and function aditions for channels management. Sales Party field and function aditions for channels management. Sales
commissions, taxes and price lists. 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_category = fields.Char('Visa Category')
visa_number = fields.Char('Visa Number') visa_number = fields.Char('Visa Number')
visa_date = fields.Date('Visa Date') visa_date = fields.Date('Visa Date')

View File

@ -2,12 +2,6 @@
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of <!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. --> this repository contains the full copyright notices and license terms. -->
<data> <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"> <xpath expr="/form/notebook/page[@id='sale']" position="after">
<page string="Hotel" id="hotel"> <page string="Hotel" id="hotel">
<label name="visa_category"/> <label name="visa_category"/>