Compare commits
2 Commits
e5849a3ef4
...
b619e84704
Author | SHA1 | Date |
---|---|---|
oscar alvarez | b619e84704 | |
oscar alvarez | 737448d658 |
47
booking.py
47
booking.py
|
@ -997,13 +997,15 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
pool = Pool()
|
||||
Folio = pool.get('hotel.folio')
|
||||
Party = pool.get('party.party')
|
||||
Config = pool.get('hotel.configuration')
|
||||
FolioCharge = pool.get('hotel.folio.charge')
|
||||
Invoice = pool.get('account.invoice')
|
||||
InvoiceLine = pool.get('account.invoice.line')
|
||||
bookings = cls.browse([booking_id])
|
||||
folios = Folio.browse(folios_ids)
|
||||
for folio in folios:
|
||||
folio.add_charge_occupancy(ctx='invoice')
|
||||
invoice = {}
|
||||
invoices = []
|
||||
party = Party(party_id)
|
||||
|
||||
invoice_to_create = cls.get_grouped_invoices(
|
||||
|
@ -1015,7 +1017,7 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
invoice = cls._get_new_invoice(rec)
|
||||
invoice.on_change_invoice_type()
|
||||
invoice.save()
|
||||
|
||||
invoices.append(invoice)
|
||||
for _line in rec['lines']:
|
||||
line, = InvoiceLine.create([
|
||||
cls._get_invoice_line(invoice, _line)
|
||||
|
@ -1023,10 +1025,23 @@ class Booking(Workflow, ModelSQL, ModelView):
|
|||
FolioCharge.write([_line.get('charge')], {
|
||||
'invoice_line': line.id,
|
||||
})
|
||||
|
||||
# ################# only for tests ##################
|
||||
# invoice.invoice_type = 'P'
|
||||
# ###################################################
|
||||
invoice.save()
|
||||
invoice.update_taxes([invoice])
|
||||
Booking.concile_charges(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):
|
||||
transaction = Transaction().context
|
||||
|
@ -2045,7 +2060,6 @@ class UpdateHolder(Wizard):
|
|||
edit = True
|
||||
else:
|
||||
party = booking.party
|
||||
|
||||
if party:
|
||||
if party.addresses:
|
||||
Address.write(list(party.addresses), address)
|
||||
|
@ -2103,6 +2117,7 @@ class UpdateHolder(Wizard):
|
|||
phone=_party.customer_phone,
|
||||
)
|
||||
party, = Party.create([rec_])
|
||||
to_guest = copy.deepcopy(rec)
|
||||
if edit:
|
||||
Party.write([party], rec)
|
||||
if not booking.party:
|
||||
|
@ -2112,21 +2127,27 @@ class UpdateHolder(Wizard):
|
|||
Booking.write([booking], {'party': party.id})
|
||||
|
||||
booking.save()
|
||||
for nofield in ['contact_mechanisms', 'addresses']:
|
||||
_ = to_guest.pop(nofield, None)
|
||||
|
||||
if _party.type_document != '31':
|
||||
for folio in booking.lines:
|
||||
if not folio.main_guest:
|
||||
folio.main_guest = party.id
|
||||
folio.save()
|
||||
_ = rec.pop('contact_mechanisms', None)
|
||||
_ = rec.pop('addresses', None)
|
||||
rec['address'] = address['street']
|
||||
rec['country'] = country_code
|
||||
rec['nationality'] = nationality_id
|
||||
rec['folio'] = folio.id
|
||||
rec['main_guest'] = True
|
||||
rec['email'] = _party.email
|
||||
rec['mobile'] = _party.mobile
|
||||
Guest.create([rec])
|
||||
to_guest['address'] = address['street']
|
||||
to_guest['nationality'] = nationality_id
|
||||
to_guest['folio'] = folio.id
|
||||
to_guest['country'] = country_code
|
||||
if subdivision_code:
|
||||
to_guest['subdivision'] = subdivision_code
|
||||
if city_code:
|
||||
to_guest['city'] = city_code
|
||||
to_guest['main_guest'] = True
|
||||
to_guest['email'] = _party.email
|
||||
to_guest['mobile'] = _party.mobile
|
||||
print("Este rec 2.....", to_guest)
|
||||
Guest.create([to_guest])
|
||||
break
|
||||
|
||||
for folio in booking.lines:
|
||||
|
|
|
@ -100,6 +100,10 @@ class Configuration(ModelSQL, ModelView):
|
|||
('type', '!=', None),
|
||||
], depends=['company'])
|
||||
token_siat = fields.Char('Token Siat')
|
||||
auto_invoice = fields.Selection([
|
||||
('', ''),
|
||||
('validate_send', 'Validate and Send'),
|
||||
], 'Auto Invoice')
|
||||
|
||||
@staticmethod
|
||||
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'),
|
||||
'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
|
||||
def create(cls, vlist):
|
||||
for value in vlist:
|
||||
cls._set_account_defaults(value)
|
||||
if value.get('address'):
|
||||
address = value.pop('address')
|
||||
country = value.pop('country', None)
|
||||
|
@ -60,6 +90,7 @@ class Party(metaclass=PoolMeta):
|
|||
'type': 'mobile', 'value': val
|
||||
}])
|
||||
]
|
||||
|
||||
return super().create(vlist)
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[tryton]
|
||||
version=6.0.125
|
||||
version=6.0.126
|
||||
depends:
|
||||
party
|
||||
company
|
||||
|
|
|
@ -54,6 +54,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="stock_moves" colspan="4"/>
|
||||
</page>
|
||||
<page string="Occupancy" id="folio_occupancy">
|
||||
<button name="load_accommodation" string="Load Accom." colspan="2"/>
|
||||
<newline />
|
||||
<field name="occupancy" colspan="4"/>
|
||||
</page>
|
||||
<page string="Additional Info" id="folio_additional_info">
|
||||
|
|
|
@ -50,6 +50,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<newline />
|
||||
</page>
|
||||
<page string="Occupancy" id="folio_occupancy">
|
||||
<button name="load_accommodation" string="Load Accom." colspan="2"/>
|
||||
<newline />
|
||||
<field name="occupancy" colspan="4"/>
|
||||
</page>
|
||||
<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"/>
|
||||
<label name="price_list"/>
|
||||
<field name="price_list"/>
|
||||
<label name="token_siat"/>
|
||||
<field name="token_siat"/>
|
||||
<label name="auto_invoice"/>
|
||||
<field name="auto_invoice"/>
|
||||
<group col="6" string="Accounting" id="account" colspan="4">
|
||||
<label name="accounting_revenue"/>
|
||||
<field name="accounting_revenue"/>
|
||||
|
@ -56,4 +56,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
</group>
|
||||
<field name="default_charges" colspan="2"/>
|
||||
<field name="children_policies" colspan="2"/>
|
||||
<label name="token_siat"/>
|
||||
<field name="token_siat"/>
|
||||
</form>
|
||||
|
|
|
@ -13,6 +13,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="nationality" widget="selection"/>
|
||||
<label name="email"/>
|
||||
<field name="email"/>
|
||||
<label name="address"/>
|
||||
<field name="address"/>
|
||||
<label name="mobile"/>
|
||||
<field name="mobile"/>
|
||||
<label name="phone"/>
|
||||
|
@ -24,12 +26,6 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<label name="vehicle_plate"/>
|
||||
<field name="vehicle_plate"/>
|
||||
</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">
|
||||
<label name="country"/>
|
||||
<field name="country" widget="selection"/>
|
||||
|
@ -37,8 +33,12 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="subdivision" widget="selection"/>
|
||||
<label name="city"/>
|
||||
<field name="city" widget="selection"/>
|
||||
<label name="address"/>
|
||||
<field name="address"/>
|
||||
</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="4" id="identity_info" string="Identity Info">
|
||||
<label name="visa_number"/>
|
||||
|
|
Loading…
Reference in New Issue