Fix party guest create
This commit is contained in:
parent
e5849a3ef4
commit
737448d658
28
booking.py
28
booking.py
|
@ -2045,7 +2045,6 @@ class UpdateHolder(Wizard):
|
|||
edit = True
|
||||
else:
|
||||
party = booking.party
|
||||
|
||||
if party:
|
||||
if party.addresses:
|
||||
Address.write(list(party.addresses), address)
|
||||
|
@ -2103,6 +2102,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 +2112,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': # Is Nights
|
||||
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