mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] Security Views
This commit is contained in:
@@ -7,6 +7,7 @@ from odoo.tools import (
|
|||||||
float_compare,
|
float_compare,
|
||||||
DEFAULT_SERVER_DATE_FORMAT)
|
DEFAULT_SERVER_DATE_FORMAT)
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.addons import decimal_precision as dp
|
from odoo.addons import decimal_precision as dp
|
||||||
import logging
|
import logging
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
@@ -37,6 +38,7 @@ class HotelService(models.Model):
|
|||||||
result.append((res.id, name))
|
result.append((res.id, name))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def _default_ser_room_line(self):
|
def _default_ser_room_line(self):
|
||||||
if self.env.context.get('room_lines'):
|
if self.env.context.get('room_lines'):
|
||||||
@@ -117,13 +119,13 @@ class HotelService(models.Model):
|
|||||||
default=_default_folio_id)
|
default=_default_folio_id)
|
||||||
ser_room_line = fields.Many2one('hotel.reservation', 'Room',
|
ser_room_line = fields.Many2one('hotel.reservation', 'Room',
|
||||||
default=_default_ser_room_line)
|
default=_default_ser_room_line)
|
||||||
per_day = fields.Boolean(related='product_id.per_day')
|
per_day = fields.Boolean(related='product_id.per_day', related_sudo=True)
|
||||||
service_line_ids = fields.One2many('hotel.service.line', 'service_id')
|
service_line_ids = fields.One2many('hotel.service.line', 'service_id')
|
||||||
product_qty = fields.Integer('Quantity')
|
product_qty = fields.Integer('Quantity')
|
||||||
days_qty = fields.Integer(compute="_compute_days_qty", store=True)
|
days_qty = fields.Integer(compute="_compute_days_qty", store=True)
|
||||||
is_board_service = fields.Boolean()
|
is_board_service = fields.Boolean()
|
||||||
# Non-stored related field to allow portal user to see the image of the product he has ordered
|
# Non-stored related field to allow portal user to see the image of the product he has ordered
|
||||||
product_image = fields.Binary('Product Image', related="product_id.image", store=False)
|
product_image = fields.Binary('Product Image', related="product_id.image", store=False, related_sudo=True)
|
||||||
company_id = fields.Many2one(related='folio_id.company_id', string='Company', store=True, readonly=True)
|
company_id = fields.Many2one(related='folio_id.company_id', string='Company', store=True, readonly=True)
|
||||||
invoice_status = fields.Selection([
|
invoice_status = fields.Selection([
|
||||||
('invoiced', 'Fully Invoiced'),
|
('invoiced', 'Fully Invoiced'),
|
||||||
|
|||||||
@@ -248,7 +248,7 @@
|
|||||||
icon="fa fa-1x fa-bed"
|
icon="fa fa-1x fa-bed"
|
||||||
name="open_service_lines"
|
name="open_service_lines"
|
||||||
attrs="{'invisible':[('is_board_service','=', False)]}" />
|
attrs="{'invisible':[('is_board_service','=', False)]}" />
|
||||||
<field name="per_day" invisible="1"/>
|
<field name="per_day" invisible="1" readonly="1"/>
|
||||||
<field name="folio_id" invisible="1"/>
|
<field name="folio_id" invisible="1"/>
|
||||||
<field name="ser_room_line" invisible="1"
|
<field name="ser_room_line" invisible="1"
|
||||||
attrs = "{'required': [('per_day','=',True)]}" />
|
attrs = "{'required': [('per_day','=',True)]}" />
|
||||||
@@ -428,6 +428,7 @@
|
|||||||
decoration-success="folio_pending_amount == 0 and checkout <= current_date and not overbooking"
|
decoration-success="folio_pending_amount == 0 and checkout <= current_date and not overbooking"
|
||||||
decoration-warning="overbooking">
|
decoration-warning="overbooking">
|
||||||
<field name="splitted" invisible="1" />
|
<field name="splitted" invisible="1" />
|
||||||
|
<field name="pricelist_id" invisible="1" />
|
||||||
<button icon="fa fa-1x fa-chain-broken"
|
<button icon="fa fa-1x fa-chain-broken"
|
||||||
type="object"
|
type="object"
|
||||||
class="oe_stat_button"
|
class="oe_stat_button"
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
icon="fa fa-1x fa-bed"
|
icon="fa fa-1x fa-bed"
|
||||||
name="open_service_lines"
|
name="open_service_lines"
|
||||||
attrs="{'invisible':[('is_board_service','=', False)]}" />
|
attrs="{'invisible':[('is_board_service','=', False)]}" />
|
||||||
<field name="per_day" invisible="1"/>
|
<field name="per_day" invisible="1" readonly="1"/>
|
||||||
<field name="folio_id" invisible="1"/>
|
<field name="folio_id" invisible="1"/>
|
||||||
<field name="ser_room_line"
|
<field name="ser_room_line"
|
||||||
attrs = "{'required': [('per_day','=',True)]}" />
|
attrs = "{'required': [('per_day','=',True)]}" />
|
||||||
|
|||||||
Reference in New Issue
Block a user