This commit is contained in:
oscar alvarez 2023-01-14 12:37:48 -05:00
parent e7bc31c7f1
commit 691d45bb68
3 changed files with 10 additions and 4 deletions

View file

@ -1119,10 +1119,12 @@ class Booking(Workflow, ModelSQL, ModelView):
if self.total_amount:
print('total_amount...', self.total_amount, self.total_advances)
res = self.total_amount - (self.total_advances or 0)
if res > -1 and res < 1:
res = 0
elif name == 'pending_acco':
res = [fol.pending_accommodation for fol in self.lines]
res = sum(fol.pending_accommodation for fol in self.lines)
elif name == 'pending_charges':
res = [fol.pending_charges for fol in self.lines]
res = sum(fol.pending_charges for fol in self.lines)
return res
def get_collect_amount(self, name):

View file

@ -259,7 +259,7 @@ class Folio(ModelSQL, ModelView):
res = 0
if name == 'pending_accommodation':
# if self.payment_status != 'paid':
res = self.get_total_accommodation()
res = self.get_total_accommodation()
if name == 'pending_charges':
total_charges = self.get_total_products()
charge_paid = 0
@ -362,7 +362,8 @@ class Folio(ModelSQL, ModelView):
def _check_accommodation(folio):
for charge in folio.charges:
if charge.status != 'paid':
raise UserError(gettext('hotel.msg_accommodation_not_paid'))
raise UserError(
gettext('hotel.msg_accommodation_not_paid'))
def _check_charges(folio):
for charge in folio.charges:

View file

@ -111,5 +111,8 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.message" id="msg_can_not_change_departure">
<field name="text">It can not change departure date because, it has charges of room in the new dates!</field>
</record>
<record model="ir.message" id="msg_charges_not_paid">
<field name="text">There is charges not paid!</field>
</record>
</data>
</tryton>