Refactory 09
This commit is contained in:
parent
4891c6b78f
commit
a19e3f2e59
|
@ -94,7 +94,9 @@ COMPLEMENTARY = [
|
||||||
]
|
]
|
||||||
|
|
||||||
INVOICE_STATES = [
|
INVOICE_STATES = [
|
||||||
('', 'None'),
|
('draft', 'Draft'),
|
||||||
('invoiced', 'Invoiced'),
|
('validated', 'Validated'),
|
||||||
|
('posted', 'Posted'),
|
||||||
('paid', 'Paid'),
|
('paid', 'Paid'),
|
||||||
|
('cancelled', 'Cancelled'),
|
||||||
]
|
]
|
||||||
|
|
31
folio.py
31
folio.py
|
@ -66,7 +66,7 @@ class Folio(ModelSQL, ModelView):
|
||||||
('template.type', '=', 'service'),
|
('template.type', '=', 'service'),
|
||||||
('template.kind', '=', 'accommodation'),
|
('template.kind', '=', 'accommodation'),
|
||||||
], required=True, states=STATES_CHECKIN)
|
], required=True, states=STATES_CHECKIN)
|
||||||
unit_price = fields.Numeric('Unit Price', digits=(16, 4),
|
unit_price = fields.Numeric('Unit Price', digits=(16, 2),
|
||||||
states={
|
states={
|
||||||
'required': Bool(Eval('product')),
|
'required': Bool(Eval('product')),
|
||||||
'readonly': Eval('registration_state') == 'check_in',
|
'readonly': Eval('registration_state') == 'check_in',
|
||||||
|
@ -113,7 +113,8 @@ class Folio(ModelSQL, ModelView):
|
||||||
invoice_line = fields.Many2One('account.invoice.line', 'Invoice Line')
|
invoice_line = fields.Many2One('account.invoice.line', 'Invoice Line')
|
||||||
invoice = fields.Function(fields.Many2One('account.invoice', 'Invoice',
|
invoice = fields.Function(fields.Many2One('account.invoice', 'Invoice',
|
||||||
depends=['invoice_line']), 'get_invoice')
|
depends=['invoice_line']), 'get_invoice')
|
||||||
invoice_state = fields.Selection(INVOICE_STATES, 'Invoice State', readonly=True)
|
invoice_state = fields.Function(fields.Selection(
|
||||||
|
INVOICE_STATES, 'Invoice State'), 'get_invoice_state')
|
||||||
type_complementary = fields.Selection(COMPLEMENTARY, 'Type Complementary',
|
type_complementary = fields.Selection(COMPLEMENTARY, 'Type Complementary',
|
||||||
states={
|
states={
|
||||||
'invisible': ~Bool(Eval('complementary')),
|
'invisible': ~Bool(Eval('complementary')),
|
||||||
|
@ -143,6 +144,9 @@ class Folio(ModelSQL, ModelView):
|
||||||
},
|
},
|
||||||
'bill': {
|
'bill': {
|
||||||
'invisible': Eval('registration_state') != 'check_out',
|
'invisible': Eval('registration_state') != 'check_out',
|
||||||
|
},
|
||||||
|
'pay': {
|
||||||
|
'invisible': Eval('registration_state') != 'check_out',
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -199,6 +203,15 @@ class Folio(ModelSQL, ModelView):
|
||||||
continue
|
continue
|
||||||
cls.create_invoice(rec)
|
cls.create_invoice(rec)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
@ModelView.button_action('hotel.wizard_booking_advance_voucher')
|
||||||
|
def pay(cls, records):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def get_invoice_state(self, name=None):
|
||||||
|
if self.invoice_line:
|
||||||
|
return self.invoice_line.invoice.state
|
||||||
|
|
||||||
def set_registration_number(self):
|
def set_registration_number(self):
|
||||||
"""
|
"""
|
||||||
Fill the number field for registration card with sequence
|
Fill the number field for registration card with sequence
|
||||||
|
@ -295,7 +308,6 @@ class Folio(ModelSQL, ModelView):
|
||||||
'party': invoice.party.id,
|
'party': invoice.party.id,
|
||||||
'description': line['description'],
|
'description': line['description'],
|
||||||
}
|
}
|
||||||
print(line['taxes_exception'])
|
|
||||||
if not line['taxes_exception']:
|
if not line['taxes_exception']:
|
||||||
taxes_ids = cls.get_taxes(invoice, line['product'], record)
|
taxes_ids = cls.get_taxes(invoice, line['product'], record)
|
||||||
print(taxes_ids)
|
print(taxes_ids)
|
||||||
|
@ -630,7 +642,10 @@ class Folio(ModelSQL, ModelView):
|
||||||
"""
|
"""
|
||||||
res = _ZERO
|
res = _ZERO
|
||||||
if self.nights_quantity and self.unit_price:
|
if self.nights_quantity and self.unit_price:
|
||||||
res = self.nights_quantity * self.unit_price
|
res = self.nights_quantity * self.unit_price_w_tax
|
||||||
|
for charge in self.charges:
|
||||||
|
res += charge.amount
|
||||||
|
res = round(res, Folio.total_amount.digits[1])
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def get_channel_commission(self, name):
|
def get_channel_commission(self, name):
|
||||||
|
@ -841,9 +856,9 @@ class HotelCharge(Workflow, ModelSQL, ModelView):
|
||||||
domain=[('salable', '=', True)], required=True)
|
domain=[('salable', '=', True)], required=True)
|
||||||
quantity = fields.Integer('Quantity', required=True)
|
quantity = fields.Integer('Quantity', required=True)
|
||||||
invoice_to = fields.Many2One('party.party', 'Invoice To', required=True)
|
invoice_to = fields.Many2One('party.party', 'Invoice To', required=True)
|
||||||
unit_price = fields.Numeric('Unit Price', required=True)
|
unit_price = fields.Numeric('Unit Price', required=True, digits=(16, 2))
|
||||||
unit_price_w_tax = fields.Function(fields.Numeric('Unit Price'),
|
unit_price_w_tax = fields.Function(fields.Numeric('Unit Price',
|
||||||
'get_unit_price_w_tax')
|
digits=(16, 2)), 'get_unit_price_w_tax')
|
||||||
order = fields.Char('Order', select=True)
|
order = fields.Char('Order', select=True)
|
||||||
description = fields.Char('Description', select=True)
|
description = fields.Char('Description', select=True)
|
||||||
state = fields.Selection(INVOICE_STATES, 'State', readonly=True)
|
state = fields.Selection(INVOICE_STATES, 'State', readonly=True)
|
||||||
|
@ -877,7 +892,7 @@ class HotelCharge(Workflow, ModelSQL, ModelView):
|
||||||
return today
|
return today
|
||||||
|
|
||||||
def get_amount(self, name=None):
|
def get_amount(self, name=None):
|
||||||
if self.quantity and self.unit_price:
|
if self.quantity and self.unit_price_w_tax:
|
||||||
return self.quantity * self.unit_price_w_tax
|
return self.quantity * self.unit_price_w_tax
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
BIN
service.fods
BIN
service.fods
Binary file not shown.
|
@ -159,14 +159,14 @@ class ServiceLine(Workflow, ModelSQL, ModelView):
|
||||||
states={'readonly': True})
|
states={'readonly': True})
|
||||||
folio = fields.Many2One('hotel.folio', 'Folio', domain=[
|
folio = fields.Many2One('hotel.folio', 'Folio', domain=[
|
||||||
('room', '=', Eval('room')),
|
('room', '=', Eval('room')),
|
||||||
('registration_state', '=', 'check_in')
|
('registration_state', 'in', 'check_in')
|
||||||
])
|
], depends=['room'])
|
||||||
state = fields.Selection([
|
state = fields.Selection([
|
||||||
('draft', 'Draft'),
|
('draft', 'Draft'),
|
||||||
('loaded', 'Loaded'),
|
('loaded', 'Loaded'),
|
||||||
('deleted', 'Deleted'),
|
('deleted', 'Deleted'),
|
||||||
('done', 'Done'),
|
('done', 'Done'),
|
||||||
], 'State')
|
], 'State', readonly=True)
|
||||||
state_string = state.translated('state')
|
state_string = state.translated('state')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -51,18 +51,18 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="notes" colspan="4"/>
|
<field name="notes" colspan="4"/>
|
||||||
</page>
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
<group col="6" colspan="6" id="state_buttons">
|
<group col="8" colspan="6" id="state_buttons">
|
||||||
|
<label name="registration_state"/>
|
||||||
|
<field name="registration_state"/>
|
||||||
|
<label name="total_amount"/>
|
||||||
|
<field name="total_amount"/>
|
||||||
|
<button name="check_in" string="Check In"/>
|
||||||
|
<button name="check_out" string="Check Out"/>
|
||||||
|
<button name="bill" string="Bill"/>
|
||||||
|
<button name="pay" string="Pay"/>
|
||||||
<label name="invoice"/>
|
<label name="invoice"/>
|
||||||
<field name="invoice"/>
|
<field name="invoice"/>
|
||||||
<label name="invoice_state"/>
|
<label name="invoice_state"/>
|
||||||
<field name="invoice_state"/>
|
<field name="invoice_state"/>
|
||||||
<label name="total_amount"/>
|
|
||||||
<field name="total_amount"/>
|
|
||||||
<label name="registration_state"/>
|
|
||||||
<field name="registration_state"/>
|
|
||||||
<button name="check_in" string="Check In"/>
|
|
||||||
<button name="check_out" string="Check Out"/>
|
|
||||||
<button name="bill" string="Bill"/>
|
|
||||||
<!-- <button name="pay" string="Pay"/> -->
|
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -93,7 +93,7 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<button name="offer" string="Offer" icon="tryton-clear"/>
|
<button name="offer" string="Offer" icon="tryton-clear"/>
|
||||||
<button name="confirm" string="Confirm" icon="tryton-forward"/>
|
<button name="confirm" string="Confirm" icon="tryton-forward"/>
|
||||||
</group>
|
</group>
|
||||||
<group col="2" colspan="2" id="amounts">
|
<group col="2" colspan="2" xfill="1" id="amounts">
|
||||||
<label name="untaxed_amount"/>
|
<label name="untaxed_amount"/>
|
||||||
<field name="untaxed_amount"/>
|
<field name="untaxed_amount"/>
|
||||||
<label name="tax_amount"/>
|
<label name="tax_amount"/>
|
||||||
|
|
|
@ -20,8 +20,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="invoice_to"/>
|
<field name="invoice_to"/>
|
||||||
<label name="amount"/>
|
<label name="amount"/>
|
||||||
<field name="amount"/>
|
<field name="amount"/>
|
||||||
<!-- <label name="invoice_line"/>
|
<label name="invoice_line"/>
|
||||||
<field name="invoice_line"/> -->
|
<field name="invoice_line"/>
|
||||||
<label name="state"/>
|
<label name="state"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<!-- <button name="transfer" string="Transfer"/> -->
|
<!-- <button name="transfer" string="Transfer"/> -->
|
||||||
|
|
|
@ -6,16 +6,14 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<field name="room" widget="selection"/>
|
<field name="room" widget="selection"/>
|
||||||
<label name="time_service"/>
|
<label name="time_service"/>
|
||||||
<field name="time_service"/>
|
<field name="time_service"/>
|
||||||
<label name="product"/>
|
|
||||||
<field name="product"/>
|
|
||||||
<label name="folio"/>
|
|
||||||
<field name="folio"/>
|
|
||||||
<label name="guest"/>
|
<label name="guest"/>
|
||||||
<field name="guest"/>
|
<field name="guest"/>
|
||||||
<label name="quantity"/>
|
|
||||||
<field name="quantity"/>
|
|
||||||
<label name="order"/>
|
<label name="order"/>
|
||||||
<field name="order"/>
|
<field name="order"/>
|
||||||
|
<label name="product"/>
|
||||||
|
<field name="product"/>
|
||||||
|
<label name="quantity"/>
|
||||||
|
<field name="quantity"/>
|
||||||
<label name="description"/>
|
<label name="description"/>
|
||||||
<field name="description"/>
|
<field name="description"/>
|
||||||
<label name="folio"/>
|
<label name="folio"/>
|
||||||
|
|
Loading…
Reference in New Issue