Fix
This commit is contained in:
parent
7a9a4c8518
commit
ec530288c8
39
folio.py
39
folio.py
|
@ -174,6 +174,7 @@ class Folio(ModelSQL, ModelView):
|
|||
)}, help="Number of persons in house setted manually.")
|
||||
invoices = fields.Function(fields.Many2Many('account.invoice',
|
||||
None, None, 'Invoices'), 'get_invoices')
|
||||
charges_blocked = fields.Boolean('Charges Blocked')
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -1153,9 +1154,11 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
|
|||
digits=(16, 2)), 'get_amount')
|
||||
taxed_amount = fields.Function(fields.Numeric('Amount with Tax',
|
||||
digits=(16, 2)), 'get_taxed_amount')
|
||||
# Remove for deprecation
|
||||
to_invoice = fields.Boolean('To Invoice', states={
|
||||
'invisible': Bool(Eval('invoice_line')),
|
||||
}, depends=['invoice_line'])
|
||||
####################
|
||||
storage = fields.Many2One('stock.location', 'Storage',
|
||||
domain=[('type', '=', 'storage')], states={
|
||||
'readonly': Bool(Eval('invoice_line')),
|
||||
|
@ -1168,20 +1171,40 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
|
|||
|
||||
@classmethod
|
||||
def delete(cls, records):
|
||||
pass
|
||||
target = []
|
||||
for rec in records:
|
||||
if rec.invoice_line or rec.move:
|
||||
continue
|
||||
target.append(rec)
|
||||
super().delete(target)
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
super(FolioCharge, cls).__setup__()
|
||||
cls._buttons.update({
|
||||
'transfer': {
|
||||
'invisible': True,
|
||||
},
|
||||
# 'transfer': {
|
||||
# 'invisible': True,
|
||||
# },
|
||||
'bill': {
|
||||
'invisible': Eval('invoice_state') is not None,
|
||||
},
|
||||
})
|
||||
|
||||
@classmethod
|
||||
def check_create(cls, vlist):
|
||||
Folio = Pool().get('hotel.folio')
|
||||
for value in vlist:
|
||||
folio_id = value.get('folio', None)
|
||||
if folio_id:
|
||||
folio = Folio(folio_id)
|
||||
if folio.charges_blocked:
|
||||
raise UserError(gettext('hotel.msg_folio_charges_blocked'))
|
||||
|
||||
@classmethod
|
||||
def create(cls, vlist):
|
||||
cls.check_create(vlist)
|
||||
return super().create(vlist)
|
||||
|
||||
@staticmethod
|
||||
def default_quantity():
|
||||
return 1
|
||||
|
@ -1256,10 +1279,10 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
|
|||
def bill(cls, records):
|
||||
cls.create_sales(records)
|
||||
|
||||
@classmethod
|
||||
@ModelView.button_action('hotel.wizard_operation_line_transfer')
|
||||
def transfer(cls, records):
|
||||
pass
|
||||
# @classmethod
|
||||
# @ModelView.button_action('hotel.wizard_operation_line_transfer')
|
||||
# def transfer(cls, records):
|
||||
# pass
|
||||
|
||||
@fields.depends('unit_price', 'folio', 'product', 'description',
|
||||
'_parent_folio.main_guest')
|
||||
|
|
10
message.xml
10
message.xml
|
@ -93,14 +93,14 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<record model="ir.message" id="msg_accommodation_not_paid">
|
||||
<field name="text">The accommodation isn't paid!</field>
|
||||
</record>
|
||||
<!-- <record model="ir.message" id="msg_charges_not_paid">
|
||||
<field name="text">There is charges without payment!</field>
|
||||
</record> -->
|
||||
<record model="ir.message" id="msg_folio_charges_blocked">
|
||||
<field name="text">The folio(s) has the charges blocked!</field>
|
||||
</record>
|
||||
<record model="ir.message" id="msg_cannot_check_in_future">
|
||||
<field name="text">It can not check-in of future dates!</field>
|
||||
</record>
|
||||
<!-- <record model="ir.message" id="msg_missing_guest">
|
||||
<record model="ir.message" id="msg_missing_guest">
|
||||
<field name="text">It missing guest in booking "%(number)s"!</field>
|
||||
</record> -->
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
|
@ -38,3 +38,5 @@ UPDATE account_invoice_line AS ail
|
|||
ON ta.booking_id=fo.booking
|
||||
) AS st
|
||||
WHERE ail.id=st.line_id AND ail.origin ILIKE 'hotel.booking%';
|
||||
|
||||
ALTER TABLE account_invoice_line DROP COLUMN origin2;
|
||||
|
|
|
@ -255,6 +255,11 @@ class ServiceLine(Workflow, ModelSQL, ModelView):
|
|||
|
||||
folio = folios[0]
|
||||
invoice_to = None
|
||||
|
||||
if folio.charges_blocked:
|
||||
raise UserError(
|
||||
gettext('hotel.msg_folio_charges_blocked')
|
||||
)
|
||||
if folio.booking.channel:
|
||||
invoice_to = self.folio.main_guest.id
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="stock_moves" colspan="4"/>
|
||||
</page>
|
||||
<page string="Additional Info" id="folio_additional_info">
|
||||
<label name="charges_blocked"/>
|
||||
<field name="charges_blocked"/>
|
||||
<label name="commission_amount"/>
|
||||
<field name="commission_amount"/>
|
||||
<label name="invoice_line"/>
|
||||
|
|
|
@ -28,10 +28,10 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="reference"/>
|
||||
<label name="estimated_arrival_time"/>
|
||||
<field name="estimated_arrival_time"/>
|
||||
<label name="vehicle_plate"/>
|
||||
<field name="vehicle_plate"/>
|
||||
<label name="pax"/>
|
||||
<field name="pax"/>
|
||||
<label name="vehicle_plate"/>
|
||||
<field name="vehicle_plate"/>
|
||||
<notebook colspan="6">
|
||||
<page string="Charges and Guests" id="hotel_charges">
|
||||
<field name="charges" colspan="4"/>
|
||||
|
@ -50,6 +50,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="invoices" colspan="4"/>
|
||||
</page>
|
||||
<page string="Additional Info" id="folio_additional_info">
|
||||
<label name="charges_blocked"/>
|
||||
<field name="charges_blocked"/>
|
||||
<label name="commission_amount"/>
|
||||
<field name="commission_amount"/>
|
||||
<separator name="notes" colspan="4"/>
|
||||
|
|
|
@ -23,8 +23,8 @@ this repository contains the full copyright notices and license terms. -->
|
|||
<field name="invoice_to"/>
|
||||
<label name="invoice_line"/>
|
||||
<field name="invoice_line"/>
|
||||
<label name="to_invoice"/>
|
||||
<field name="to_invoice"/>
|
||||
<!-- <label name="to_invoice"/>
|
||||
<field name="to_invoice"/> -->
|
||||
<label name="state"/>
|
||||
<field name="state"/>
|
||||
</group>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree editable="1">
|
||||
<field name="to_invoice" expand="0"/>
|
||||
<!-- <field name="to_invoice" expand="0"/> -->
|
||||
<field name="date_service" expand="1"/>
|
||||
<field name="product" expand="1"/>
|
||||
<field name="quantity"/>
|
||||
|
|
Loading…
Reference in New Issue