Add config advance payment

This commit is contained in:
oscar alvarez 2023-11-02 00:38:22 -05:00
parent a712e52d2c
commit 06c03d9d85
5 changed files with 23 additions and 3 deletions

View File

@ -496,6 +496,7 @@ class Booking(Workflow, ModelSQL, ModelView):
def add_payment(cls, args):
pool = Pool()
StatementLine = pool.get('account.statement.line')
Config = pool.get('hotel.configuration')
Folio = pool.get('hotel.folio')
Booking = pool.get('hotel.booking')
Party = pool.get('party.party')
@ -513,8 +514,12 @@ class Booking(Workflow, ModelSQL, ModelView):
party_id = args['party']
party = Party(party_id)
config = Config.get_configuration()
try:
account = party.account_receivable.id
if config.advance_account:
account = config.advance_account.id
else:
account = party.account_receivable.id
except:
raise UserError(gettext('hotel.party_without_account_receivable'))

View File

@ -93,6 +93,11 @@ class Configuration(ModelSQL, ModelView):
('type', '!=', None),
], depends=['company'])
space_booking = fields.Many2One('analytic_account.space', 'Default Space')
advance_account = fields.Many2One('account.account', 'Advance Account',
domain=[
('company', '=', Eval('company')),
('type', '!=', None),
], depends=['company'])
token_siat = fields.Char('Token Siat')
@staticmethod

View File

@ -100,14 +100,22 @@ class Invoice(metaclass=PoolMeta):
if invoice.amount_to_pay == 0 and to_reconcile:
MoveLine.reconcile(to_reconcile)
@classmethod
def do_move_writeoff_advance(cls, invoices):
# Asiento de cancelacion de los anticipos en la reserva
# Para abono de pago en factura
Config = Pool().get('hotel.configuration')
config = Config.get_configuration()
pass
@classmethod
def _post(cls, invoices):
for invoice in invoices:
lines_ids = None
if invoice.type == 'in':
super()._post([invoice])
continue
lines_ids = None
if invoice.type == 'out' and invoice.agent:
lines_ids = cls.process_offset_move(invoice)

View File

@ -54,7 +54,7 @@ class Sale(metaclass=PoolMeta):
'kind': 'product',
'order': number,
'status': 'pending',
'origin': f'sale.sale,{sale_id}',
'origin': f'sale.line,{line.id}',
})
charges_ids = Charge.create(to_create)

View File

@ -42,6 +42,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="accounting_revenue"/>
<label name="recognise_account"/>
<field name="recognise_account"/>
<label name="advance_account"/>
<field name="advance_account"/>
<label name="space_booking"/>
<field name="space_booking"/>
<label name="charge_sequence"/>