[MIG] V13 conventions

This commit is contained in:
Darío Lodeiros
2020-07-09 18:15:40 +02:00
parent 15f222bcbf
commit 2c6b17b32b
34 changed files with 263 additions and 254 deletions

View File

@@ -209,7 +209,7 @@ class GlassofExporterWizard(models.TransientModel):
worksheet.write(nrow, 21, 'S')
worksheet.write(nrow, 22, '')
if inv.type == 'out_refund':
worksheet.write(nrow, 23, inv.origin)
worksheet.write(nrow, 23, inv.invoice_origin)
else:
worksheet.write(nrow, 23, '')
worksheet.write(nrow, 24, '')

View File

@@ -6,8 +6,6 @@ from odoo.exceptions import UserError
from odoo.addons.queue_job.job import job
from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if
from odoo.addons import decimal_precision as dp
class ChannelHotelReservation(models.Model):
_name = 'channel.hotel.reservation'
@@ -34,7 +32,7 @@ class ChannelHotelReservation(models.Model):
default=False)
channel_total_amount = fields.Monetary(string='Channel Total Amount',
readonly=True, digits=dp.get_precision('Product Price'))
readonly=True, digits=('Product Price'))
# Inherit binding constrain becouse two reservations can have
# the same external_id

View File

@@ -3,7 +3,6 @@
from odoo import api, models, fields, _
from odoo.exceptions import ValidationError
from odoo.addons import decimal_precision as dp
from odoo.addons.queue_job.job import job
from odoo.addons.component.core import Component
from odoo.addons.component_event import skip_if
@@ -45,9 +44,9 @@ class ChannelHotelRoomType(models.Model):
"the maximum simultaneous availability and "
"the total room count for the given room type.")
min_price = fields.Float('Min. Price', default=5.0, digits=dp.get_precision('Product Price'),
min_price = fields.Float('Min. Price', default=5.0, digits=('Product Price'),
help="Setup the min price to prevent incidents while editing your prices.")
max_price = fields.Float('Max. Price', default=200.0, digits=dp.get_precision('Product Price'),
max_price = fields.Float('Max. Price', default=200.0, digits=('Product Price'),
help="Setup the max price to prevent incidents while editing your prices.")
@api.constrains('default_quota', 'default_max_avail', 'total_rooms_count')

View File

@@ -20,7 +20,9 @@
'mail',
'account_payment_return',
'partner_firstname',
'email_template_qweb'
'email_template_qweb',
'sales_team',
'sale'
],
'data': [
'security/pms_security.xml',

View File

@@ -3,17 +3,6 @@
<data noupdate="0">
<!-- Scheduler For To Inform Guest About Reservation Before 24 Hours -->
<record model="ir.cron" id="Guest_reservation_reminder_24hrs">
<field name="name">Inform Guest About Reservation Before 24 Hours</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False" />
<field name="model_id" ref="model_pms_reservation" />
<field name="code">model.reservation_reminder_24hrs()</field>
</record>
<!-- Scheduler For To Inform Guest About Reservation Before 24 Hours -->
<record model="ir.cron" id="autocheckout_reservations">
<field name="name">Automatic Checkout on past reservations</field>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<menuitem id="pms_management_menu" name="pms Management"
<menuitem id="pms_management_menu" name="PMS Management"
sequence="8" web_icon="pms,static/description/icon.png"
groups="pms.group_pms_user,pms.group_pms_call"/>

View File

@@ -430,7 +430,7 @@
<!-- pms.room.type -->
<record id="demo_pms_room_type_0" model="pms.room.type">
<field name="pms_id" ref="pms.demo_pms_property"/>
<field name="pms_property_id" ref="pms.demo_pms_property"/>
<field name="name">Economic</field>
<field name="code_type">ECO</field>
<field name="list_price">21.00</field>
@@ -440,7 +440,7 @@
</record>
<record id="demo_pms_room_type_1" model="pms.room.type">
<field name="pms_id" ref="pms.demo_pms_property"/>
<field name="pms_property_id" ref="pms.demo_pms_property"/>
<field name="name">Single</field>
<field name="code_type">SNG</field>
<field name="list_price">20.00</field>

View File

@@ -28,6 +28,7 @@ class IrHttp(models.AbstractModel):
user.company_id = user.pms_property_id.company_id
res['company_id'] = user.pms_property_id.company_id.id
else:
return res #TODO Review method
raise MissingError(
_("Wrong property and company access settings for this user. "
"Please review property and company for user %s") % user.name)

View File

@@ -1,7 +1,6 @@
# Copyright 2017 Dario Lodeiros
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, models, fields
from odoo.addons import decimal_precision as dp
class PmsBoardService(models.Model):
@@ -9,40 +8,31 @@ class PmsBoardService(models.Model):
_description = "Board Services"
# Fields declaration
name = fields.Char(
'Board Name',
translate=True,
size=64,
required=True,
index=True)
name = fields.Char("Board Name", translate=True, size=64, required=True, index=True)
board_service_line_ids = fields.One2many(
'pms.board.service.line',
'pms_board_service_id')
"pms.board.service.line", "pms_board_service_id"
)
pms_property_ids = fields.Many2many(
'pms.property',
string='Properties',
required=False,
ondelete='restrict')
"pms.property", string="Properties", required=False, ondelete="restrict"
)
pms_board_service_room_type_ids = fields.One2many(
'pms.board.service.room.type',
'pms_board_service_id')
price_type = fields.Selection([
('fixed', 'Fixed'),
('percent', 'Percent')],
string='Type',
default='fixed',
required=True)
"pms.board.service.room.type", "pms_board_service_id"
)
price_type = fields.Selection(
[("fixed", "Fixed"), ("percent", "Percent")],
string="Type",
default="fixed",
required=True,
)
amount = fields.Float(
'Amount',
digits=dp.get_precision('Product Price'),
compute='_compute_board_amount',
store=True)
"Amount", digits=("Product Price"), compute="_compute_board_amount", store=True
)
# Compute and Search methods
@api.depends('board_service_line_ids.amount')
@api.depends("board_service_line_ids.amount")
def _compute_board_amount(self):
for record in self:
total = 0
for service in record.board_service_line_ids:
total += service.amount
record.update({'amount': total})
record.update({"amount": total})

View File

@@ -1,12 +1,11 @@
# Copyright 2017 Dario Lodeiros
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
from odoo.addons import decimal_precision as dp
class PmsBoardServiceLine(models.Model):
_name = 'pms.board.service.line'
_description = 'Services on Board Service included'
_name = "pms.board.service.line"
_description = "Services on Board Service included"
# Default methods
def _get_default_price(self):
@@ -15,24 +14,18 @@ class PmsBoardServiceLine(models.Model):
# Fields declaration
pms_board_service_id = fields.Many2one(
'pms.board.service',
'Board Service',
ondelete='cascade',
required=True)
product_id = fields.Many2one(
'product.product',
string='Product',
required=True)
"pms.board.service", "Board Service", ondelete="cascade", required=True
)
product_id = fields.Many2one("product.product", string="Product", required=True)
pms_property_ids = fields.Many2many(
'pms.property',
related='pms_board_service_id.pms_property_ids')
"pms.property", related="pms_board_service_id.pms_property_ids"
)
amount = fields.Float(
'Amount',
digits=dp.get_precision('Product Price'),
default=_get_default_price)
"Amount", digits=("Product Price"), default=_get_default_price
)
# Constraints and onchanges
@api.onchange('product_id')
@api.onchange("product_id")
def onchange_product_id(self):
if self.product_id:
self.update({'amount': self.product_id.list_price})
self.update({"amount": self.product_id.list_price})

View File

@@ -1,7 +1,6 @@
# Copyright 2017 Dario
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError
@@ -58,7 +57,7 @@ class PmsBoardServiceRoomType(models.Model):
required=True)
amount = fields.Float(
'Amount',
digits=dp.get_precision('Product Price'),
digits=('Product Price'),
compute='_compute_board_amount',
store=True)

View File

@@ -1,8 +1,6 @@
# Copyright 2017 Dario Lodeiros
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
from odoo.addons import decimal_precision as dp
class PmsBoardServiceRoomTypeLine(models.Model):
_name = 'pms.board.service.room.type.line'
@@ -20,5 +18,4 @@ class PmsBoardServiceRoomTypeLine(models.Model):
required=True,
readonly=True)
# TODO def default_amount "amount of service"
amount = fields.Float('Amount', digits=dp.get_precision(
'Product Price'), default=0.0)
amount = fields.Float('Amount', digits=('Product Price'), default=0.0)

View File

@@ -11,6 +11,7 @@ from odoo.tools import (
class PmsCheckinPartner(models.Model):
_name = 'pms.checkin.partner'
_description = 'Partner Checkins'
# Default Methods ang Gets
def _default_reservation_id(self):

View File

@@ -282,7 +282,7 @@ class PmsFolio(models.Model):
move_ids = folio.reservation_ids.mapped('move_line_ids').\
mapped('move_id').filtered(lambda r: r.type in [
'out_invoice', 'out_refund'])
invoice_ids |= folio.service_ids.mapped('move_line_ids').mapped(
invoice_ids = folio.service_ids.mapped('move_line_ids').mapped(
'move_id').filtered(lambda r: r.type in [
'out_invoice', 'out_refund'])
# TODO: Search for invoices which have been 'cancelled'
@@ -290,7 +290,7 @@ class PmsFolio(models.Model):
# use like as origin may contains multiple references
# (e.g. 'SO01, SO02')
refunds = invoice_ids.search([
('origin', 'like', folio.name),
('invoice_origin', 'like', folio.name),
('company_id', '=', folio.company_id.id)]).filtered(
lambda r: r.type in ['out_invoice', 'out_refund'])
invoice_ids |= refunds.filtered(
@@ -301,8 +301,8 @@ class PmsFolio(models.Model):
for inv in invoice_ids:
refund_ids += refund_ids.search([
('type', '=', 'out_refund'),
('origin', '=', inv.number),
('origin', '!=', False),
('invoice_origin', '=', inv.number),
('invoice_origin', '!=', False),
('journal_id', '=', inv.journal_id.id)])
# Ignore the status of the deposit product
deposit_product_id = self.env['sale.advance.payment.inv'].\
@@ -331,7 +331,7 @@ class PmsFolio(models.Model):
folio.update({
'invoice_count': len(set(move_ids.ids + refund_ids.ids)),
'invoice_ids': move_ids.ids + refund_ids.ids,
'move_ids': move_ids.ids + refund_ids.ids,
'invoice_status': invoice_status
})
@@ -484,7 +484,7 @@ class PmsFolio(models.Model):
})
return
addr = self.partner_id.address_get(['move'])
addr = self.partner_id.address_get(['invoice'])
pricelist = self.partner_id.property_product_pricelist and \
self.partner_id.property_product_pricelist.id or \
self.env.user.pms_property_id.default_pricelist_id.id

View File

@@ -11,7 +11,6 @@ from odoo.tools import (
DEFAULT_SERVER_DATE_FORMAT,
DEFAULT_SERVER_DATETIME_FORMAT)
from odoo import models, fields, api, _
from odoo.addons import decimal_precision as dp
import logging
_logger = logging.getLogger(__name__)
@@ -301,24 +300,24 @@ class PmsReservation(models.Model):
string='To Invoice',
store=True,
readonly=True,
digits=dp.get_precision('Product Unit of Measure'))
digits=('Product Unit of Measure'))
qty_invoiced = fields.Float(
compute='_get_invoice_qty',
string='Invoiced',
store=True,
readonly=True,
digits=dp.get_precision('Product Unit of Measure'))
digits=('Product Unit of Measure'))
price_subtotal = fields.Monetary(
string='Subtotal',
readonly=True,
store=True,
digits=dp.get_precision('Product Price'),
digits=('Product Price'),
compute='_compute_amount_reservation')
price_total = fields.Monetary(
string='Total',
readonly=True,
store=True,
digits=dp.get_precision('Product Price'),
digits=('Product Price'),
compute='_compute_amount_reservation')
price_tax = fields.Float(
string='Taxes',
@@ -329,17 +328,17 @@ class PmsReservation(models.Model):
string='Services Total',
readonly=True,
store=True,
digits=dp.get_precision('Product Price'),
digits=('Product Price'),
compute='_compute_amount_room_services')
price_room_services_set = fields.Monetary(
string='Room Services Total',
readonly=True,
store=True,
digits=dp.get_precision('Product Price'),
digits=('Product Price'),
compute='_compute_amount_set')
discount = fields.Float(
string='Discount (€)',
digits=dp.get_precision('Discount'),
digits=('Discount'),
compute='_compute_discount',
store=True)
@@ -419,10 +418,11 @@ class PmsReservation(models.Model):
def _compute_localizator(self):
for record in self:
if record.folio_id:
#TODO: Review Datetime type no char v13
localizator = re.sub("[^0-9]", "", record.folio_id.name)
checkout = int(re.sub("[^0-9]", "", record.checkout))
checkin = int(re.sub("[^0-9]", "", record.checkin))
localizator += str((checkin + checkout) % 99)
# checkout = int(re.sub("[^0-9]", "", record.checkout))
# checkin = int(re.sub("[^0-9]", "", record.checkin))
# localizator += str((checkin + checkout) % 99)
record.localizator = localizator
@api.depends('service_ids.price_total')

View File

@@ -2,12 +2,12 @@
# Copyright 2017 Dario Lodeiros
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields, api, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import ValidationError
class PmsReservationLine(models.Model):
_name = "pms.reservation.line"
_description = "Reservations by day"
_order = "date"
# Default Methods ang Gets
@@ -44,13 +44,13 @@ class PmsReservationLine(models.Model):
state = fields.Selection(related='reservation_id.state')
price = fields.Float(
string='Price',
digits=dp.get_precision('Product Price'))
digits=('Product Price'))
cancel_discount = fields.Float(
string='Cancel Discount (%)',
digits=dp.get_precision('Discount'), default=0.0)
digits=('Discount'), default=0.0)
discount = fields.Float(
string='Discount (%)',
digits=dp.get_precision('Discount'), default=0.0)
digits=('Discount'), default=0.0)
# Constraints and onchanges
@api.constrains('date')

View File

@@ -7,6 +7,7 @@ class PmsRoomTypeRestriction(models.Model):
""" The room type restriction is used as a daily restriction plan for room types
and therefore is related only with one property. """
_name = 'pms.room.type.restriction'
_description = 'Reservation restriction plan'
# Default methods
@api.model

View File

@@ -6,6 +6,7 @@ from odoo.exceptions import ValidationError
class PmsRoomTypeRestrictionItem(models.Model):
_name = 'pms.room.type.restriction.item'
_description = 'Reservation restriction by day'
# Field Declarations
restriction_id = fields.Many2one('pms.room.type.restriction',

View File

@@ -7,7 +7,6 @@ from odoo.tools import (
float_compare,
DEFAULT_SERVER_DATE_FORMAT)
from datetime import timedelta
from odoo.addons import decimal_precision as dp
import logging
_logger = logging.getLogger(__name__)
@@ -123,22 +122,22 @@ class PmsService(models.Model):
price_unit = fields.Float(
'Unit Price',
required=True,
digits=dp.get_precision('Product Price'), default=0.0)
digits=('Product Price'), default=0.0)
discount = fields.Float(
string='Discount (%)',
digits=dp.get_precision('Discount'), default=0.0)
digits=('Discount'), default=0.0)
qty_to_invoice = fields.Float(
compute='_get_to_invoice_qty',
string='To Invoice',
store=True,
readonly=True,
digits=dp.get_precision('Product Unit of Measure'))
digits=('Product Unit of Measure'))
qty_invoiced = fields.Float(
compute='_get_invoice_qty',
string='Invoiced',
store=True,
readonly=True,
digits=dp.get_precision('Product Unit of Measure'))
digits=('Product Unit of Measure'))
price_subtotal = fields.Monetary(
string='Subtotal',
readonly=True,

View File

@@ -7,6 +7,7 @@ from odoo.exceptions import ValidationError
class PmsServiceLine(models.Model):
_name = "pms.service.line"
_description = "Service by day"
_order = "date"
# Fields declaration

View File

@@ -22,6 +22,8 @@ user_access_pms_board_service_line,user_access_pms_board_service_line,model_pms_
user_access_account_partial_reconcile,user_access_account_partial_reconcile,account.model_account_partial_reconcile,pms.group_pms_user,1,1,1,1
user_access_pms_cancelation_rule,user_access_pms_cancelation_rule,model_pms_cancelation_rule,pms.group_pms_user,1,0,0,0
user_access_account_full_reconcile,user_access_account_full_reconcile,account.model_account_full_reconcile,pms.group_pms_user,1,1,1,1
call_access_pms_cancelation_rule,call_access_pms_cancelation_rule,model_pms_cancelation_rule,base.group_user,1,0,0,0
user_access_property,user_access_property,model_pms_property,pms.group_pms_user,1,0,0,0
manager_access_pms_floor,manager_access_pms_floor,model_pms_floor,pms.group_pms_manager,1,1,1,1
manager_access_pms_amenity,manager_access_pms_amenity,model_pms_amenity,pms.group_pms_manager,1,1,1,1
manager_access_pms_amenity_type,manager_access_pms_amenity_type,model_pms_amenity_type,pms.group_pms_manager,1,1,1,1
@@ -42,6 +44,7 @@ manager_access_pms_room_type,manager_access_pms_room_type,model_pms_room_type,pm
manager_access_pms_board_service_room_type,manager_access_pms_board_service_room_type,model_pms_board_service_room_type,pms.group_pms_manager,1,1,1,1
manager_access_pms_board_service_room_type_line,manager_access_pms_board_service_room_type_line,model_pms_board_service_room_type_line,pms.group_pms_manager,1,1,1,1
manager_access_pms_board_service_line,manager_access_pms_board_service_line,model_pms_board_service_line,pms.group_pms_manager,1,1,1,1
manager_access_property,manager_access_property,model_pms_property,pms.group_pms_manager,1,1,1,1
manager_access_pms_cancelation_rule,manager_access_pms_cancelation_rule,model_pms_cancelation_rule,base.group_user,1,1,1,1
call_access_pms_floor,call_access_pms_floor,model_pms_floor,pms.group_pms_call,1,0,0,0
call_access_pms_amenity,call_access_pms_amenity,model_pms_amenity,pms.group_pms_call,1,0,0,0
@@ -63,4 +66,4 @@ call_access_pms_room_type,call_access_pms_room_type,model_pms_room_type,pms.grou
call_access_pms_board_service_room_type,call_access_pms_board_service_room_type,model_pms_board_service_room_type,pms.group_pms_call,1,0,0,0
call_access_pms_board_service_room_type_line,call_access_pms_board_service_room_type_line,model_pms_board_service_room_type_line,pms.group_pms_call,1,0,0,0
call_access_pms_board_service_line,call_access_pms_board_service_line,model_pms_board_service_line,pms.group_pms_call,1,0,0,0
call_access_pms_cancelation_rule,call_access_pms_cancelation_rule,model_pms_cancelation_rule,base.group_user,1,0,0,0
call_access_property,call_access_property,model_pms_property,pms.group_pms_call,1,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
22 user_access_account_partial_reconcile user_access_account_partial_reconcile account.model_account_partial_reconcile pms.group_pms_user 1 1 1 1
23 user_access_pms_cancelation_rule user_access_pms_cancelation_rule model_pms_cancelation_rule pms.group_pms_user 1 0 0 0
24 user_access_account_full_reconcile user_access_account_full_reconcile account.model_account_full_reconcile pms.group_pms_user 1 1 1 1
25 call_access_pms_cancelation_rule call_access_pms_cancelation_rule model_pms_cancelation_rule base.group_user 1 0 0 0
26 user_access_property user_access_property model_pms_property pms.group_pms_user 1 0 0 0
27 manager_access_pms_floor manager_access_pms_floor model_pms_floor pms.group_pms_manager 1 1 1 1
28 manager_access_pms_amenity manager_access_pms_amenity model_pms_amenity pms.group_pms_manager 1 1 1 1
29 manager_access_pms_amenity_type manager_access_pms_amenity_type model_pms_amenity_type pms.group_pms_manager 1 1 1 1
44 manager_access_pms_board_service_room_type manager_access_pms_board_service_room_type model_pms_board_service_room_type pms.group_pms_manager 1 1 1 1
45 manager_access_pms_board_service_room_type_line manager_access_pms_board_service_room_type_line model_pms_board_service_room_type_line pms.group_pms_manager 1 1 1 1
46 manager_access_pms_board_service_line manager_access_pms_board_service_line model_pms_board_service_line pms.group_pms_manager 1 1 1 1
47 manager_access_property manager_access_property model_pms_property pms.group_pms_manager 1 1 1 1
48 manager_access_pms_cancelation_rule manager_access_pms_cancelation_rule model_pms_cancelation_rule base.group_user 1 1 1 1
49 call_access_pms_floor call_access_pms_floor model_pms_floor pms.group_pms_call 1 0 0 0
50 call_access_pms_amenity call_access_pms_amenity model_pms_amenity pms.group_pms_call 1 0 0 0
66 call_access_pms_board_service_room_type call_access_pms_board_service_room_type model_pms_board_service_room_type pms.group_pms_call 1 0 0 0
67 call_access_pms_board_service_room_type_line call_access_pms_board_service_room_type_line model_pms_board_service_room_type_line pms.group_pms_call 1 0 0 0
68 call_access_pms_board_service_line call_access_pms_board_service_line model_pms_board_service_line pms.group_pms_call 1 0 0 0
69 call_access_pms_cancelation_rule call_access_property call_access_pms_cancelation_rule call_access_property model_pms_cancelation_rule model_pms_property base.group_user pms.group_pms_call 1 0 0 0

View File

@@ -30,7 +30,7 @@
attrs="{'invisible': [('state','=','draft')]}"/>
<button string="Delete" name="delete" type="object" class="oe_read_only btn-primary"
attrs="{'invisible': [('state','=','draft')]}"/>
<button string="Cancel" class="oe_read_only btn-default" special="cancel"/>
<button string="Cancel" name="cancel" class="oe_read_only btn-default" special="cancel"/>
<field name="state" widget="statusbar" statusbar_visible="draft,posted,reconciled,cancelled"/>
</header>
<sheet>
@@ -55,26 +55,45 @@
</div>
<group>
<group>
<field name="company_id" invisible="1" />
<field name="payment_type" invisible="1" />
<field name="save_amount" invisible="1" />
<field name="save_date" invisible="1" />
<field name="save_journal_id" invisible="1" />
<field name="partner_type" widget="selection" invisible="1"/>
<field name="partner_id" attrs="{'required': [('state', '=', 'draft'), ('payment_type', 'in', ('inbound', 'outbound'))], 'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))]}" context="{'default_is_company': True, 'default_supplier': payment_type == 'outbound', 'default_customer': payment_type == 'inbound'}"/>
<field name="partner_id" attrs="{
'required': [('state', '=', 'draft'), ('payment_type', 'in', ('inbound', 'outbound'))],
'invisible': [('payment_type', 'not in', ('inbound', 'outbound'))]
}"
context="{
'default_is_company': True,
'default_supplier': payment_type == 'outbound',
'default_customer': payment_type == 'inbound'
}"/>
<label for="amount"/>
<div name="amount_div" class="o_row">
<field name="amount" />
<field name="currency_id" options="{'no_create': True, 'no_open': True}" groups="base.group_multi_currency" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="currency_id"
options="{'no_create': True, 'no_open': True}"
groups="base.group_multi_currency"
attrs="{'readonly': [('state', '!=', 'draft')]}"/>
</div>
<field name="journal_id" widget="selection" />
<field name="destination_journal_id" widget="selection" attrs="{'required': [('payment_type', '=', 'transfer')], 'invisible': [('payment_type', '!=', 'transfer')], 'readonly': [('state', '!=', 'draft')]}"/>
<field name="destination_journal_id"
widget="selection"
attrs="{
'required': [('payment_type', '=', 'transfer')],
'invisible': [('payment_type', '!=', 'transfer')],
'readonly': [('state', '!=', 'draft')]}"/>
<field name="hide_payment_method" invisible="1"/>
<field name="payment_method_id" string=" " widget="radio" attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
<field name="payment_method_id" string=" " widget="radio"
attrs="{'invisible': [('hide_payment_method', '=', True)]}"/>
<field name="payment_method_code" invisible="1"/>
</group>
<group>
<field name="payment_date" />
<field name="communication" attrs="{'invisible': [('state', '!=', 'draft'), ('communication', '=', False)]}"/>
<field name="communication"
attrs="{'invisible': [('state', '!=', 'draft'), ('communication', '=', False)]}"/>
<field name="folio_id" readonly="1" force_save="1"/>
</group>
</group>

View File

@@ -33,6 +33,7 @@
</xpath>
<xpath expr="//field[@name='user_id']" position="after">
<field name="company_type" invisible="1" />
<field name="is_tour_operator" attrs="{'invisible': [('company_type','!=','company')]}"/>
</xpath>

View File

@@ -8,7 +8,7 @@
<form string="Room Amenities">
<sheet>
<h1>
<label string="Amenity" />
<label for="name" string="Amenity" />
<field name="name" select="1" />
</h1>
<group>

View File

@@ -60,13 +60,15 @@
<!-- actions -->
<record id="pms_property_action" model="ir.actions.act_window">
<field name="name">pmss</field>
<field name="name">Properties</field>
<field name="res_model">pms.property</field>
<field name="view_mode">tree,form</field>
</record>
<!-- menus -->
<menuitem action="pms_property_action" id="pms_property_menu" parent="base.menu_users" sequence="10"/>
<menuitem action="pms_property_action" id="pms_property_menu"
parent="base.menu_users" sequence="10"
name = "Properties"/>
</odoo>

View File

@@ -74,12 +74,14 @@
<bold><button class="alert-link" type="object" name="open_folio" string="Folio Form"/></bold>
</div>
<field name="shared_folio" invisible="1"/>
<div class="oe_button_box" attrs="{'invisible': [('folio_id','=',False)]}">
<div class="oe_button_box" name="button_box" attrs="{'invisible': [('folio_id','=',False)]}">
<button type="object" class="oe_stat_button"
icon="fa-file"
name="open_folio">
<div class="o_form_field o_stat_info">
<span class="o_stat_text"><field name="folio_id" readonly="1" nolabel="1"/></span>
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">
<field name="folio_id" readonly="1" nolabel="1"/>
</span>
</div>
</button>
<button type="action" class="oe_stat_button"
@@ -87,7 +89,7 @@
attrs="{'invisible': ['|', ('partner_id','=',False), ('reservation_type','in',('out'))]}"
name="%(open_pms_reservation_form_tree_all)d"
context="{'search_default_partner_id': partner_id}">
<div class="o_form_field o_stat_info">
<div class="o_field_widget o_stat_info">
<span class="o_stat_text">Books</span>
</div>
</button>
@@ -96,7 +98,7 @@
icon="fa-money"
name="action_pay_folio"
attrs="{'invisible': ['|',('folio_pending_amount','&lt;=',0)]}">
<div class="o_form_field o_stat_info">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="folio_pending_amount" nolabel="1"
widget="monetary" options="{'currency_field': 'currency_id'}"/>
@@ -107,7 +109,7 @@
<button type="object" class="oe_stat_button" id="invoice_button"
icon="fa-pencil-square-o" name="open_invoices_reservation"
attrs="{'invisible': [('invoice_count','&lt;=',0)]}">
<div class="o_form_field o_stat_info">
<div class="o_field_widget o_stat_info">
<span class="o_stat_value">
<field name="invoice_count"/>
</span>
@@ -118,7 +120,7 @@
icon="fa-chain-broken"
name="open_master"
attrs="{'invisible':[('splitted','=',False)]}">
<div class="o_form_field o_stat_info">
<div class="o_field_widget o_stat_info">
<span><field name="parent_reservation"
nolabel="1" readonly="1"/></span>
<span class="o_stat_text">Splitted!</span>
@@ -160,11 +162,13 @@
attrs="{'invisible': [('reservation_type','not in',('out'))]}"/>
</h1>
<h3>
From <span class="fa fa-sign-in" style="margin: 5px;"/>
<field name="checkin" style="margin-right: 10px;"/>
to
<span class="fa fa-sign-out" style="margin-right: 5px;"/>
<field name="checkout" />
<group>
<div class="o_row">
<field name="checkin" widget="daterange" nolabel="1" class="oe_inline" options="{'related_end_date': 'checkout'}"/>
<i class="fa fa-long-arrow-right mx-2" aria-label="Arrow icon" title="Arrow"/>
<field name="checkout" widget="daterange" nolabel="1" class="oe_inline" options="{'related_start_date': 'checkin'}"/>
</div>
</group>
</h3>
<field name="out_service_description" placeholder="Out service description"
attrs="{'invisible':[('reservation_type','not in',('out'))]}"/>

View File

@@ -58,12 +58,15 @@
<search string="Services By Day">
<field name="service_id" />
<filter string="Today"
name="today"
domain="[('date', '=', context_today().strftime('%Y-%m-%d'))]"
help="Current Booking" />
<filter string="Tomorrow"
name="tomorrow"
domain="[('date', '=', (context_today()+datetime.timedelta(days=1)).strftime('%Y-%m-%d'))]"
/>
<filter string="Next 7 days"
name="next_7_days"
domain="[('date', '&gt;', context_today().strftime('%Y-%m-%d')),
('date', '&lt;', (context_today()+datetime.timedelta(days=7)).strftime('%Y-%m-%d'))]"
/>

View File

@@ -3,7 +3,6 @@
import time
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
from odoo import api, fields, models, _
import odoo.addons.decimal_precision as dp
from odoo.exceptions import UserError, ValidationError
from datetime import timedelta
@@ -85,7 +84,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
product_id = fields.Many2one('product.product', string="Product",
domain=[('type', '=', 'service')], default=_default_product_id)
amount = fields.Float('Down Payment Amount',
digits=dp.get_precision('Account'),
digits=('Account'),
help="The amount to be invoiced in advance, taxes excluded.")
deposit_account_id = fields.Many2one("account.account", string="Income Account",
domain=[('deprecated', '=', False)],
@@ -142,7 +141,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
invoice = inv_obj.create({
'name': folio.client_order_ref or folio.name,
'origin': folio.name,
'invoice_origin': folio.name,
'type': 'out_invoice',
'reference': False,
'folio_ids': [(6, 0, [folio.id])], #REVIEW: Folio_ids is a computed field, Why need this value?
@@ -150,7 +149,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
'partner_id': folio.partner_invoice_id.id,
'invoice_line_ids': [(0, 0, {
'name': name,
'origin': folio.name,
'invoice_origin': folio.name,
'account_id': account_id,
'price_unit': amount,
'quantity': 1.0,
@@ -172,7 +171,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
invoice.compute_taxes()
invoice.message_post_with_view(
'mail.message_origin_link',
values={'self': invoice, 'origin': folio},
values={'self': invoice, 'invoice_origin': folio},
subtype_id=self.env.ref('mail.mt_note').id)
return invoice
@@ -270,7 +269,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
invoice.compute_taxes()
self._validate_invoices(invoice)
invoice.message_post_with_view('mail.message_origin_link',
values={'self': invoice, 'origin': folios},
values={'self': invoice, 'invoice_origin': folios},
subtype_id=self.env.ref('mail.mt_note').id)
if self._context.get('open_invoices', False):
return folios.open_invoices_folio()
@@ -394,7 +393,7 @@ class FolioAdvancePaymentInv(models.TransientModel):
# raise UserError(_('All Folios must hace the same pricelist'))
invoice_vals = {
'name': self.folio_ids[0].client_order_ref or '',
'origin': origin,
'invoice_origin': origin,
'type': 'out_invoice',
'account_id': self.partner_invoice_id.property_account_receivable_id.id,
'partner_id': self.partner_invoice_id.id,
@@ -427,7 +426,7 @@ class LineAdvancePaymentInv(models.TransientModel):
price_room = fields.Float(compute='_compute_price_room')
discount = fields.Float(
string='Discount (%)',
digits=dp.get_precision('Discount'), default=0.0)
digits=('Discount'), default=0.0)
to_invoice = fields.Boolean('To Invoice')
description = fields.Text('Description')
description_dates = fields.Text('Range')
@@ -496,7 +495,7 @@ class LineAdvancePaymentInv(models.TransientModel):
account = fpos.map_account(account)
vals = {
'sequence': origin.sequence,
'origin': origin.name,
'invoice_origin': origin.name,
'account_id': account.id,
'price_unit': self.price_unit,
'quantity': self.qty,

View File

@@ -18,7 +18,7 @@
<div attrs="{'invisible': [('advance_payment_method', 'not in', ('fixed','percentage'))]}">
<field name="amount"
attrs="{'required': [('advance_payment_method', 'in', ('fixed','percentage'))]}" class="oe_inline" widget="monetary"/>
<label string="%%"
<label for="" string="%%"
attrs="{'invisible': [('advance_payment_method', '!=', 'percentage')]}" class="oe_inline"/>
</div>
<field name="deposit_account_id" class="oe_inline"
@@ -93,7 +93,7 @@
<field name="res_model">folio.advance.payment.inv</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="groups_id" eval="[(4,ref('sales_team.group_sale_salesman'))]"/>
<field name="groups_id" eval="[(4,ref('pms.group_pms_user'))]"/>
</record>
</odoo>

View File

@@ -8,6 +8,7 @@ from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
class MassiveChangesWizard(models.TransientModel):
_name = 'pms.wizard.massive.changes'
_description = 'Massive Changes'
# Default methods
@api.model

View File

@@ -5,6 +5,7 @@ from openerp import models, fields, api
class MassivePriceChangeWizard(models.TransientModel):
_name = 'pms.wizard.massive.price.reservation.days'
_description = 'Massive Price Changes'
new_price = fields.Float('New Price', default=1, min=1)
change_price = fields.Boolean('Change Prices', default=False)

View File

@@ -7,6 +7,7 @@ from odoo.tools import (
class ServiceOnDay(models.TransientModel):
_name = 'service.on.day'
_description = 'Set service for today'
def _get_default_date(self):
tz_property = self.env.user.pms_property_id.tz

View File

@@ -10,6 +10,7 @@ from openerp.tools import (
class SplitReservationWizard(models.TransientModel):
_name = 'pms.wizard.split.reservation'
_description = 'Split Reservation'
nights = fields.Integer('Nights', default=1, min=1)

View File

@@ -9,12 +9,12 @@ from odoo.tools import (
DEFAULT_SERVER_DATE_FORMAT,
DEFAULT_SERVER_DATETIME_FORMAT)
from odoo import models, fields, api, _
import odoo.addons.decimal_precision as dp
_logger = logging.getLogger(__name__)
class FolioWizard(models.TransientModel):
_name = 'pms.folio.wizard'
_description = 'Wizard for reservation groups'
@api.model
def _get_default_center_user(self):
@@ -275,6 +275,7 @@ class FolioWizard(models.TransientModel):
class PmsRoomTypeWizards(models.TransientModel):
_name = 'pms.room.type.wizard'
_description = 'Virtual Room Type to Reserve Groups'
def _get_default_checkin(self):
@@ -434,6 +435,7 @@ class PmsRoomTypeWizards(models.TransientModel):
class ReservationWizard(models.TransientModel):
_name = 'pms.reservation.wizard'
_description = 'Virtual Reservation to Groups'
_rec_name = 'room_id'
room_id = fields.Many2one('pms.room',
@@ -574,6 +576,7 @@ class ReservationWizard(models.TransientModel):
class ServiceWizard(models.TransientModel):
_name = 'pms.service.wizard'
_description = 'Virtual Service for Groups'
product_id = fields.Many2one('product.product',
string="Service")
@@ -581,7 +584,7 @@ class ServiceWizard(models.TransientModel):
folio_wizard_id = fields.Many2one('pms.folio.wizard')
discount = fields.Float('discount')
price_unit = fields.Float('Unit Price', required=True,
digits=dp.get_precision('Product Price'),
digits=('Product Price'),
default=0.0)
price_total = fields.Float(compute='_compute_amount', string='Total',
readonly=True, store=True)
@@ -589,7 +592,7 @@ class ServiceWizard(models.TransientModel):
domain=['|', ('active', '=', False),
('active', '=', True)])
product_uom_qty = fields.Float(string='Quantity',
digits=dp.get_precision('Product Unit of Measure'),
digits=('Product Unit of Measure'),
required=True,
default=1.0)