mirror of
https://bitbucket.org/presik/trytonpsk-hotel.git
synced 2023-12-14 07:52:52 +01:00
Compare commits
2 commits
e5849a3ef4
...
b619e84704
Author | SHA1 | Date | |
---|---|---|---|
|
b619e84704 | ||
|
737448d658 |
8 changed files with 86 additions and 24 deletions
47
booking.py
47
booking.py
|
@ -997,13 +997,15 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
pool = Pool()
|
pool = Pool()
|
||||||
Folio = pool.get('hotel.folio')
|
Folio = pool.get('hotel.folio')
|
||||||
Party = pool.get('party.party')
|
Party = pool.get('party.party')
|
||||||
|
Config = pool.get('hotel.configuration')
|
||||||
FolioCharge = pool.get('hotel.folio.charge')
|
FolioCharge = pool.get('hotel.folio.charge')
|
||||||
|
Invoice = pool.get('account.invoice')
|
||||||
InvoiceLine = pool.get('account.invoice.line')
|
InvoiceLine = pool.get('account.invoice.line')
|
||||||
bookings = cls.browse([booking_id])
|
bookings = cls.browse([booking_id])
|
||||||
folios = Folio.browse(folios_ids)
|
folios = Folio.browse(folios_ids)
|
||||||
for folio in folios:
|
for folio in folios:
|
||||||
folio.add_charge_occupancy(ctx='invoice')
|
folio.add_charge_occupancy(ctx='invoice')
|
||||||
invoice = {}
|
invoices = []
|
||||||
party = Party(party_id)
|
party = Party(party_id)
|
||||||
|
|
||||||
invoice_to_create = cls.get_grouped_invoices(
|
invoice_to_create = cls.get_grouped_invoices(
|
||||||
|
@ -1015,7 +1017,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
invoice = cls._get_new_invoice(rec)
|
invoice = cls._get_new_invoice(rec)
|
||||||
invoice.on_change_invoice_type()
|
invoice.on_change_invoice_type()
|
||||||
invoice.save()
|
invoice.save()
|
||||||
|
invoices.append(invoice)
|
||||||
for _line in rec['lines']:
|
for _line in rec['lines']:
|
||||||
line, = InvoiceLine.create([
|
line, = InvoiceLine.create([
|
||||||
cls._get_invoice_line(invoice, _line)
|
cls._get_invoice_line(invoice, _line)
|
||||||
|
@ -1023,10 +1025,23 @@ class Booking(Workflow, ModelSQL, ModelView):
|
||||||
FolioCharge.write([_line.get('charge')], {
|
FolioCharge.write([_line.get('charge')], {
|
||||||
'invoice_line': line.id,
|
'invoice_line': line.id,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
# ################# only for tests ##################
|
||||||
|
# invoice.invoice_type = 'P'
|
||||||
|
# ###################################################
|
||||||
invoice.save()
|
invoice.save()
|
||||||
invoice.update_taxes([invoice])
|
invoice.update_taxes([invoice])
|
||||||
Booking.concile_charges(bookings)
|
Booking.concile_charges(bookings)
|
||||||
Booking.check_finished(bookings)
|
Booking.check_finished(bookings)
|
||||||
|
config = Config.get_configuration()
|
||||||
|
if config.auto_invoice == 'validate_send':
|
||||||
|
Invoice.validate_invoice(invoices)
|
||||||
|
for invoice in invoices:
|
||||||
|
if invoice.invoice_type == 'P':
|
||||||
|
# Invoice.post([invoice])
|
||||||
|
pass
|
||||||
|
elif invoice.invoice_type == '1':
|
||||||
|
Invoice.submit([invoice])
|
||||||
|
|
||||||
def get_link_web_checkin(self, name=None):
|
def get_link_web_checkin(self, name=None):
|
||||||
transaction = Transaction().context
|
transaction = Transaction().context
|
||||||
|
@ -2045,7 +2060,6 @@ class UpdateHolder(Wizard):
|
||||||
edit = True
|
edit = True
|
||||||
else:
|
else:
|
||||||
party = booking.party
|
party = booking.party
|
||||||
|
|
||||||
if party:
|
if party:
|
||||||
if party.addresses:
|
if party.addresses:
|
||||||
Address.write(list(party.addresses), address)
|
Address.write(list(party.addresses), address)
|
||||||
|
@ -2103,6 +2117,7 @@ class UpdateHolder(Wizard):
|
||||||
phone=_party.customer_phone,
|
phone=_party.customer_phone,
|
||||||
)
|
)
|
||||||
party, = Party.create([rec_])
|
party, = Party.create([rec_])
|
||||||
|
to_guest = copy.deepcopy(rec)
|
||||||
if edit:
|
if edit:
|
||||||
Party.write([party], rec)
|
Party.write([party], rec)
|
||||||
if not booking.party:
|
if not booking.party:
|
||||||
|
@ -2112,21 +2127,27 @@ class UpdateHolder(Wizard):
|
||||||
Booking.write([booking], {'party': party.id})
|
Booking.write([booking], {'party': party.id})
|
||||||
|
|
||||||
booking.save()
|
booking.save()
|
||||||
|
for nofield in ['contact_mechanisms', 'addresses']:
|
||||||
|
_ = to_guest.pop(nofield, None)
|
||||||
|
|
||||||
if _party.type_document != '31':
|
if _party.type_document != '31':
|
||||||
for folio in booking.lines:
|
for folio in booking.lines:
|
||||||
if not folio.main_guest:
|
if not folio.main_guest:
|
||||||
folio.main_guest = party.id
|
folio.main_guest = party.id
|
||||||
folio.save()
|
folio.save()
|
||||||
_ = rec.pop('contact_mechanisms', None)
|
to_guest['address'] = address['street']
|
||||||
_ = rec.pop('addresses', None)
|
to_guest['nationality'] = nationality_id
|
||||||
rec['address'] = address['street']
|
to_guest['folio'] = folio.id
|
||||||
rec['country'] = country_code
|
to_guest['country'] = country_code
|
||||||
rec['nationality'] = nationality_id
|
if subdivision_code:
|
||||||
rec['folio'] = folio.id
|
to_guest['subdivision'] = subdivision_code
|
||||||
rec['main_guest'] = True
|
if city_code:
|
||||||
rec['email'] = _party.email
|
to_guest['city'] = city_code
|
||||||
rec['mobile'] = _party.mobile
|
to_guest['main_guest'] = True
|
||||||
Guest.create([rec])
|
to_guest['email'] = _party.email
|
||||||
|
to_guest['mobile'] = _party.mobile
|
||||||
|
print("Este rec 2.....", to_guest)
|
||||||
|
Guest.create([to_guest])
|
||||||
break
|
break
|
||||||
|
|
||||||
for folio in booking.lines:
|
for folio in booking.lines:
|
||||||
|
|
|
@ -100,6 +100,10 @@ class Configuration(ModelSQL, ModelView):
|
||||||
('type', '!=', None),
|
('type', '!=', None),
|
||||||
], depends=['company'])
|
], depends=['company'])
|
||||||
token_siat = fields.Char('Token Siat')
|
token_siat = fields.Char('Token Siat')
|
||||||
|
auto_invoice = fields.Selection([
|
||||||
|
('', ''),
|
||||||
|
('validate_send', 'Validate and Send'),
|
||||||
|
], 'Auto Invoice')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def default_company():
|
def default_company():
|
||||||
|
|
31
party.py
31
party.py
|
@ -26,9 +26,39 @@ class Party(metaclass=PoolMeta):
|
||||||
city = fields.Function(fields.Many2One('party.city_code', 'City'),
|
city = fields.Function(fields.Many2One('party.city_code', 'City'),
|
||||||
'get_city', 'set_city')
|
'get_city', 'set_city')
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _set_account_defaults(cls, value):
|
||||||
|
ObligationFiscal = Pool().get('party.obligation_fiscal')
|
||||||
|
type_document = value.get('type_document')
|
||||||
|
if type_document == '31':
|
||||||
|
regime_tax = 'regimen_responsable'
|
||||||
|
type_person = 'persona_juridica'
|
||||||
|
fiscal_regimen = '48'
|
||||||
|
obligation_tax = 'O-48'
|
||||||
|
else:
|
||||||
|
regime_tax = 'regimen_no_responsable'
|
||||||
|
type_person = 'persona_natural'
|
||||||
|
fiscal_regimen = '49'
|
||||||
|
obligation_tax = 'R-99-PN'
|
||||||
|
|
||||||
|
if not value.get('regime_tax'):
|
||||||
|
value['regime_tax'] = regime_tax
|
||||||
|
if not value.get('type_person'):
|
||||||
|
value['type_person'] = type_person
|
||||||
|
if not value.get('fiscal_regimen'):
|
||||||
|
value['fiscal_regimen'] = fiscal_regimen
|
||||||
|
if not value.get('party_obligation_tax'):
|
||||||
|
obligations = ObligationFiscal.search(
|
||||||
|
[('code', '=', obligation_tax)]
|
||||||
|
)
|
||||||
|
value['party_obligation_tax'] = [
|
||||||
|
('add', [ob.id for ob in obligations])
|
||||||
|
]
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def create(cls, vlist):
|
def create(cls, vlist):
|
||||||
for value in vlist:
|
for value in vlist:
|
||||||
|
cls._set_account_defaults(value)
|
||||||
if value.get('address'):
|
if value.get('address'):
|
||||||
address = value.pop('address')
|
address = value.pop('address')
|
||||||
country = value.pop('country', None)
|
country = value.pop('country', None)
|
||||||
|
@ -60,6 +90,7 @@ class Party(metaclass=PoolMeta):
|
||||||
'type': 'mobile', 'value': val
|
'type': 'mobile', 'value': val
|
||||||
}])
|
}])
|
||||||
]
|
]
|
||||||
|
|
||||||
return super().create(vlist)
|
return super().create(vlist)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[tryton]
|
[tryton]
|
||||||
version=6.0.125
|
version=6.0.126
|
||||||
depends:
|
depends:
|
||||||
party
|
party
|
||||||
company
|
company
|
||||||
|
|
|
@ -54,6 +54,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="stock_moves" colspan="4"/>
|
<field name="stock_moves" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Occupancy" id="folio_occupancy">
|
<page string="Occupancy" id="folio_occupancy">
|
||||||
|
<button name="load_accommodation" string="Load Accom." colspan="2"/>
|
||||||
|
<newline />
|
||||||
<field name="occupancy" colspan="4"/>
|
<field name="occupancy" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Additional Info" id="folio_additional_info">
|
<page string="Additional Info" id="folio_additional_info">
|
||||||
|
|
|
@ -50,6 +50,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<newline />
|
<newline />
|
||||||
</page>
|
</page>
|
||||||
<page string="Occupancy" id="folio_occupancy">
|
<page string="Occupancy" id="folio_occupancy">
|
||||||
|
<button name="load_accommodation" string="Load Accom." colspan="2"/>
|
||||||
|
<newline />
|
||||||
<field name="occupancy" colspan="4"/>
|
<field name="occupancy" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
<page string="Additional Info" id="folio_additional_info">
|
<page string="Additional Info" id="folio_additional_info">
|
||||||
|
|
|
@ -44,8 +44,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="offset_journal"/>
|
<field name="offset_journal"/>
|
||||||
<label name="price_list"/>
|
<label name="price_list"/>
|
||||||
<field name="price_list"/>
|
<field name="price_list"/>
|
||||||
<label name="token_siat"/>
|
<label name="auto_invoice"/>
|
||||||
<field name="token_siat"/>
|
<field name="auto_invoice"/>
|
||||||
<group col="6" string="Accounting" id="account" colspan="4">
|
<group col="6" string="Accounting" id="account" colspan="4">
|
||||||
<label name="accounting_revenue"/>
|
<label name="accounting_revenue"/>
|
||||||
<field name="accounting_revenue"/>
|
<field name="accounting_revenue"/>
|
||||||
|
@ -56,4 +56,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
</group>
|
</group>
|
||||||
<field name="default_charges" colspan="2"/>
|
<field name="default_charges" colspan="2"/>
|
||||||
<field name="children_policies" colspan="2"/>
|
<field name="children_policies" colspan="2"/>
|
||||||
|
<label name="token_siat"/>
|
||||||
|
<field name="token_siat"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -13,6 +13,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="nationality" widget="selection"/>
|
<field name="nationality" widget="selection"/>
|
||||||
<label name="email"/>
|
<label name="email"/>
|
||||||
<field name="email"/>
|
<field name="email"/>
|
||||||
|
<label name="address"/>
|
||||||
|
<field name="address"/>
|
||||||
<label name="mobile"/>
|
<label name="mobile"/>
|
||||||
<field name="mobile"/>
|
<field name="mobile"/>
|
||||||
<label name="phone"/>
|
<label name="phone"/>
|
||||||
|
@ -24,12 +26,6 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<label name="vehicle_plate"/>
|
<label name="vehicle_plate"/>
|
||||||
<field name="vehicle_plate"/>
|
<field name="vehicle_plate"/>
|
||||||
</group>
|
</group>
|
||||||
<group colspan="4" col="4" id="travel_info" string="Travel Info">
|
|
||||||
<label name="origin_country"/>
|
|
||||||
<field name="origin_country" widget="selection"/>
|
|
||||||
<label name="target_country"/>
|
|
||||||
<field name="target_country" widget="selection"/>
|
|
||||||
</group>
|
|
||||||
<group colspan="4" col="6" id="address_information" string="Address Info">
|
<group colspan="4" col="6" id="address_information" string="Address Info">
|
||||||
<label name="country"/>
|
<label name="country"/>
|
||||||
<field name="country" widget="selection"/>
|
<field name="country" widget="selection"/>
|
||||||
|
@ -37,8 +33,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="subdivision" widget="selection"/>
|
<field name="subdivision" widget="selection"/>
|
||||||
<label name="city"/>
|
<label name="city"/>
|
||||||
<field name="city" widget="selection"/>
|
<field name="city" widget="selection"/>
|
||||||
<label name="address"/>
|
</group>
|
||||||
<field name="address"/>
|
<group colspan="4" col="4" id="travel_info" string="Travel Info">
|
||||||
|
<label name="origin_country"/>
|
||||||
|
<field name="origin_country" widget="selection"/>
|
||||||
|
<label name="target_country"/>
|
||||||
|
<field name="target_country" widget="selection"/>
|
||||||
</group>
|
</group>
|
||||||
<group colspan="4" col="4" id="identity_info" string="Identity Info">
|
<group colspan="4" col="4" id="identity_info" string="Identity Info">
|
||||||
<label name="visa_number"/>
|
<label name="visa_number"/>
|
||||||
|
|
Loading…
Reference in a new issue