This commit is contained in:
oscar alvarez 2022-03-22 23:53:55 -05:00
parent fc32146abc
commit fa5e9aaa01
4 changed files with 32 additions and 31 deletions

View File

@ -315,5 +315,17 @@ this repository contains the full copyright notices and license terms. -->
<field name="name">create_guest_form</field>
</record>
<record model="ir.model.button" id="booking_bill_button">
<field name="name">bill</field>
<field name="string">Bill</field>
<field name="confirm">Are you sure you want to bill the booking?</field>
<field name="model" search="[('model', '=', 'hotel.booking')]"/>
</record>
<record model="ir.model.button-res.group"
id="booking_bill_button_group_hotel">
<field name="button" ref="booking_bill_button"/>
<field name="group" ref="hotel.group_hotel"/>
</record>
</data>
</tryton>

View File

@ -735,13 +735,17 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
product = fields.Many2One('product.product', 'Product',
domain=[('salable', '=', True)], 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=False,
context={
'folio': Eval('_parent_folio', {}).get('main_guest'),
})
unit_price = fields.Numeric('Unit Price', digits=(16, 4),
required=True)
unit_price_w_tax = fields.Function(fields.Numeric('Unit Price'),
'get_unit_price_w_tax')
order = fields.Char('Order', select=True)
description = fields.Char('Description', select=True)
description = fields.Char('Description', select=True, depends=['product'])
state = fields.Selection(INVOICE_STATES, 'State', readonly=True)
state_string = state.translated('state')
invoice_line = fields.Many2One('account.invoice.line', 'Invoice Line',
@ -799,23 +803,6 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
if self.quantity and self.unit_price:
return self.quantity * self.unit_price
# def get_sale(self, name=None):
# if self.sale_line:
# return self.sale_line.sale.id
# def compute_amount_with_tax(line):
# tax_amount = _ZERO
# amount = _ZERO
# if line.taxes:
# tax_list = Tax.compute(line.taxes, line.unit_price or _ZERO,
# line.quantity or 0.0)
#
# tax_amount = sum([t['amount'] for t in tax_list], _ZERO)
#
# if line.unit_price:
# amount = line.unit_price * Decimal(line.quantity)
# return amount + tax_amount
@classmethod
@ModelView.button
def bill(cls, records):
@ -826,11 +813,16 @@ class FolioCharge(Workflow, ModelSQL, ModelView):
def transfer(cls, records):
pass
@fields.depends('unit_price', 'product')
@fields.depends('unit_price', 'folio', 'product', 'description',
'invoice_to', '_parent_folio.main_guest')
def on_change_product(self):
if self.product:
self.unit_price = self.product.template.list_price
self.description = self.product.description
self.description = self.product.template.name
if self.folio:
self.invoice_to = self.folio.main_guest.id
class OpenMigrationStart(ModelView):

View File

@ -28,7 +28,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="view" ref="housekeeping_view_form"/>
<field name="act_window" ref="act_housekeeping_form"/>
</record>
<menuitem parent="menu_hotel" sequence="30"
<menuitem parent="menu_hotel" sequence="30" icon="hotel-housekeeping"
action="act_housekeeping_form" id="menu_housekeeping_form"/>
<!-- Model Access -->

View File

@ -2,18 +2,15 @@
<!-- 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="date_service"/>
<field name="to_invoice"/>
<field name="product"/>
<field name="description"/>
<field name="to_invoice" expand="0"/>
<field name="date_service" expand="1"/>
<field name="product" expand="1"/>
<field name="quantity"/>
<field name="unit_price"/>
<field name="unit_price" expand="1"/>
<field name="unit_price_w_tax"/>
<field name="amount" expand="1"/>
<field name="order"/>
<field name="invoice_to"/>
<field name="amount"/>
<field name="state"/>
<field name="state" expand="1"/>
<field name="invoice_line"/>
<!-- <field name="invoice"/> -->
<!-- <button name="transfer" string="Transfer"/> -->
</tree>