mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: index m2o fields: https://github.com/odoo/odoo/pull/39332
This commit is contained in:
@@ -12,6 +12,7 @@ class AccountAnalyticLine(models.Model):
|
||||
store=True,
|
||||
readonly=False,
|
||||
check_pms_properties=True,
|
||||
index=True,
|
||||
)
|
||||
|
||||
@api.depends("move_id")
|
||||
@@ -30,4 +31,5 @@ class AccountAnalyticDistribution(models.Model):
|
||||
name="Property",
|
||||
comodel_name="pms.property",
|
||||
check_pms_properties=True,
|
||||
index=True,
|
||||
)
|
||||
|
||||
@@ -13,6 +13,7 @@ class AccountBankStatement(models.Model):
|
||||
compute="_compute_pms_property_id",
|
||||
store=True,
|
||||
copy=False,
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
journal_id = fields.Many2one(check_pms_properties=True)
|
||||
|
||||
@@ -29,6 +29,7 @@ class AccountMove(models.Model):
|
||||
compute="_compute_pms_property_id",
|
||||
store=True,
|
||||
readonly=False,
|
||||
index=True,
|
||||
# check_pms_properties=True,
|
||||
)
|
||||
# journal_id = fields.Many2one(check_pms_properties=True)
|
||||
@@ -44,6 +45,7 @@ class AccountMove(models.Model):
|
||||
domain="[('is_agency', '=', True)]",
|
||||
compute="_compute_origin_agency_id",
|
||||
store=True,
|
||||
index=True,
|
||||
readonly=False,
|
||||
)
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ class AccountMoveLine(models.Model):
|
||||
compute="_compute_pms_property_id",
|
||||
store=True,
|
||||
readonly=False,
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
origin_agency_id = fields.Many2one(
|
||||
@@ -53,6 +54,7 @@ class AccountMoveLine(models.Model):
|
||||
domain="[('is_agency', '=', True)]",
|
||||
compute="_compute_origin_agency_id",
|
||||
store=True,
|
||||
index=True,
|
||||
readonly=False,
|
||||
)
|
||||
move_id = fields.Many2one(check_pms_properties=True)
|
||||
|
||||
@@ -27,6 +27,7 @@ class AccountPayment(models.Model):
|
||||
domain="[('is_agency', '=', True)]",
|
||||
compute="_compute_origin_agency_id",
|
||||
store=True,
|
||||
index=True,
|
||||
readonly=True,
|
||||
)
|
||||
origin_reference = fields.Char(
|
||||
|
||||
@@ -54,6 +54,7 @@ class FolioSaleLine(models.Model):
|
||||
store=True,
|
||||
comodel_name="pms.property",
|
||||
related="folio_id.pms_property_id",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
is_board_service = fields.Boolean(
|
||||
@@ -185,6 +186,7 @@ class FolioSaleLine(models.Model):
|
||||
('company_id', '=', company_id)]",
|
||||
ondelete="restrict",
|
||||
compute="_compute_product_id",
|
||||
index=True,
|
||||
check_company=True,
|
||||
change_default=True,
|
||||
)
|
||||
@@ -200,6 +202,7 @@ class FolioSaleLine(models.Model):
|
||||
string="Unit of Measure",
|
||||
help="",
|
||||
comodel_name="uom.uom",
|
||||
index=True,
|
||||
domain="[('category_id', '=', product_uom_category_id)]",
|
||||
)
|
||||
product_uom_category_id = fields.Many2one(
|
||||
@@ -277,6 +280,7 @@ class FolioSaleLine(models.Model):
|
||||
domain="[('is_agency', '=', True)]",
|
||||
compute="_compute_origin_agency_id",
|
||||
store=True,
|
||||
index=True,
|
||||
readonly=False,
|
||||
)
|
||||
analytic_tag_ids = fields.Many2many(
|
||||
@@ -316,6 +320,7 @@ class FolioSaleLine(models.Model):
|
||||
help="The section of the folio sale line",
|
||||
comodel_name="folio.sale.line",
|
||||
compute="_compute_section_id",
|
||||
index=True,
|
||||
)
|
||||
|
||||
service_order = fields.Integer(
|
||||
@@ -348,6 +353,7 @@ class FolioSaleLine(models.Model):
|
||||
a guest or the generic contact will be used instead""",
|
||||
comodel_name="res.partner",
|
||||
ondelete="restrict",
|
||||
index=True,
|
||||
)
|
||||
autoinvoice_date = fields.Date(
|
||||
string="Autoinvoice Date",
|
||||
|
||||
@@ -5,10 +5,17 @@ class IrPmsProperty(models.Model):
|
||||
_name = "ir.pms.property"
|
||||
_description = "IrPmsProperty"
|
||||
pms_property_id = fields.Many2one(
|
||||
string="Properties", help="", comodel_name="pms.property"
|
||||
string="Properties",
|
||||
help="",
|
||||
comodel_name="pms.property",
|
||||
index=True,
|
||||
)
|
||||
model_id = fields.Many2one(string="Model", comodel_name="ir.model", index=True)
|
||||
field_id = fields.Many2one(
|
||||
string="Field",
|
||||
comodel_name="ir.model.fields",
|
||||
index=True,
|
||||
)
|
||||
model_id = fields.Many2one(string="Model", comodel_name="ir.model")
|
||||
field_id = fields.Many2one(string="Field", comodel_name="ir.model.fields")
|
||||
record = fields.Integer(string="Record Id")
|
||||
|
||||
value_integer = fields.Integer(string="Integer Field Value")
|
||||
|
||||
@@ -35,6 +35,7 @@ class PmsRoomAmenity(models.Model):
|
||||
string="Amenity Category",
|
||||
help="Segment the amenities by categories (multimedia, comfort, etc ...)",
|
||||
comodel_name="pms.amenity.type",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
default_code = fields.Char(
|
||||
|
||||
@@ -16,6 +16,7 @@ class PmsAvailability(models.Model):
|
||||
help="Room type for which availability is indicated",
|
||||
readonly=True,
|
||||
required=True,
|
||||
index=True,
|
||||
comodel_name="pms.room.type",
|
||||
ondelete="cascade",
|
||||
check_pms_properties=True,
|
||||
@@ -31,6 +32,7 @@ class PmsAvailability(models.Model):
|
||||
help="Property to which the availability is directed",
|
||||
readonly=True,
|
||||
required=True,
|
||||
index=True,
|
||||
comodel_name="pms.property",
|
||||
ondelete="restrict",
|
||||
check_pms_properties=True,
|
||||
@@ -64,6 +66,7 @@ class PmsAvailability(models.Model):
|
||||
ondelete="restrict",
|
||||
compute="_compute_parent_avail_id",
|
||||
store=True,
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
child_avail_ids = fields.One2many(
|
||||
|
||||
@@ -21,6 +21,7 @@ class PmsAvailabilityPlanRule(models.Model):
|
||||
string="Room Type",
|
||||
help="Room type for which availability rule is applied",
|
||||
required=True,
|
||||
index=True,
|
||||
comodel_name="pms.room.type",
|
||||
ondelete="cascade",
|
||||
check_pms_properties=True,
|
||||
@@ -84,6 +85,7 @@ class PmsAvailabilityPlanRule(models.Model):
|
||||
help="Properties with access to the element",
|
||||
ondelete="restrict",
|
||||
required=True,
|
||||
index=True,
|
||||
comodel_name="pms.property",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
@@ -93,6 +95,7 @@ class PmsAvailabilityPlanRule(models.Model):
|
||||
compute="_compute_avail_id",
|
||||
store=True,
|
||||
readonly=False,
|
||||
index=True,
|
||||
ondelete="restrict",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
|
||||
@@ -12,6 +12,7 @@ class PmsBoardServiceLine(models.Model):
|
||||
string="Board Service",
|
||||
help="Board Service in which this line is included",
|
||||
required=True,
|
||||
index=True,
|
||||
comodel_name="pms.board.service",
|
||||
ondelete="cascade",
|
||||
check_pms_properties=True,
|
||||
@@ -20,6 +21,7 @@ class PmsBoardServiceLine(models.Model):
|
||||
string="Product",
|
||||
help="Product associated with this board service line",
|
||||
required=True,
|
||||
index=True,
|
||||
comodel_name="product.product",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
|
||||
@@ -26,6 +26,7 @@ class PmsBoardServiceRoomType(models.Model):
|
||||
help="Property with access to the element;"
|
||||
" if not set, all property can access",
|
||||
required=False,
|
||||
index=True,
|
||||
ondelete="restrict",
|
||||
comodel_name="pms.property",
|
||||
check_pms_properties=True,
|
||||
|
||||
@@ -13,6 +13,7 @@ class PmsBoardServiceRoomTypeLine(models.Model):
|
||||
string="Board Service Room",
|
||||
help="Board Service Room Type in which this line is included",
|
||||
required=True,
|
||||
index=True,
|
||||
comodel_name="pms.board.service.room.type",
|
||||
ondelete="cascade",
|
||||
)
|
||||
@@ -28,6 +29,7 @@ class PmsBoardServiceRoomTypeLine(models.Model):
|
||||
string="Product",
|
||||
help="Product associated with this board service room type line",
|
||||
comodel_name="product.product",
|
||||
index=True,
|
||||
readonly=True,
|
||||
check_pms_properties=True,
|
||||
domain="[('is_pms_available', '=', True)]",
|
||||
|
||||
@@ -30,6 +30,7 @@ class PmsCheckinPartner(models.Model):
|
||||
string="Partner",
|
||||
help="Partner associated with checkin partner",
|
||||
readonly=False,
|
||||
index=True,
|
||||
store=True,
|
||||
comodel_name="res.partner",
|
||||
domain="[('is_company', '=', False)]",
|
||||
@@ -38,12 +39,14 @@ class PmsCheckinPartner(models.Model):
|
||||
reservation_id = fields.Many2one(
|
||||
string="Reservation",
|
||||
help="Reservation to which checkin partners belong",
|
||||
index=True,
|
||||
comodel_name="pms.reservation",
|
||||
)
|
||||
folio_id = fields.Many2one(
|
||||
string="Folio",
|
||||
help="Folio to which reservation of checkin partner belongs",
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="pms.folio",
|
||||
related="reservation_id.folio_id",
|
||||
)
|
||||
@@ -52,6 +55,7 @@ class PmsCheckinPartner(models.Model):
|
||||
help="Property to which the folio associated belongs",
|
||||
readonly=True,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="pms.property",
|
||||
related="reservation_id.pms_property_id",
|
||||
)
|
||||
@@ -137,6 +141,7 @@ class PmsCheckinPartner(models.Model):
|
||||
help="host nationality",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_nationality_id",
|
||||
comodel_name="res.country",
|
||||
)
|
||||
@@ -174,6 +179,7 @@ class PmsCheckinPartner(models.Model):
|
||||
help="Country of the guest's residence",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_residence_country_id",
|
||||
comodel_name="res.country",
|
||||
)
|
||||
@@ -182,6 +188,7 @@ class PmsCheckinPartner(models.Model):
|
||||
help="State of the guest's residence",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_residence_state_id",
|
||||
comodel_name="res.country.state",
|
||||
)
|
||||
@@ -226,6 +233,7 @@ class PmsCheckinPartner(models.Model):
|
||||
help="Select a valid document type",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="res.partner.id_category",
|
||||
compute="_compute_document_type",
|
||||
)
|
||||
@@ -242,6 +250,7 @@ class PmsCheckinPartner(models.Model):
|
||||
help="Technical field",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="res.partner.id_number",
|
||||
compute="_compute_document_id",
|
||||
ondelete="restrict",
|
||||
|
||||
@@ -42,6 +42,7 @@ class PmsFolio(models.Model):
|
||||
help="The property for folios",
|
||||
comodel_name="pms.property",
|
||||
required=True,
|
||||
index=True,
|
||||
default=lambda self: self.env.user.get_active_property_ids()[0],
|
||||
check_pms_properties=True,
|
||||
)
|
||||
@@ -51,6 +52,7 @@ class PmsFolio(models.Model):
|
||||
readonly=False,
|
||||
store=True,
|
||||
tracking=True,
|
||||
index=True,
|
||||
compute="_compute_partner_id",
|
||||
comodel_name="res.partner",
|
||||
ondelete="restrict",
|
||||
@@ -114,6 +116,7 @@ class PmsFolio(models.Model):
|
||||
string="Company",
|
||||
help="The company for folio",
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="res.company",
|
||||
compute="_compute_company_id",
|
||||
)
|
||||
@@ -121,6 +124,7 @@ class PmsFolio(models.Model):
|
||||
string="Analytic Account",
|
||||
help="The analytic account related to a folio.",
|
||||
readonly=True,
|
||||
index=True,
|
||||
states={"draft": [("readonly", False)], "sent": [("readonly", False)]},
|
||||
copy=False,
|
||||
comodel_name="account.analytic.account",
|
||||
@@ -130,6 +134,7 @@ class PmsFolio(models.Model):
|
||||
help="The currency of the property location",
|
||||
readonly=True,
|
||||
required=True,
|
||||
index=True,
|
||||
related="pricelist_id.currency_id",
|
||||
ondelete="restrict",
|
||||
)
|
||||
@@ -138,6 +143,7 @@ class PmsFolio(models.Model):
|
||||
help="Pricelist for current folio.",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="product.pricelist",
|
||||
ondelete="restrict",
|
||||
check_pms_properties=True,
|
||||
@@ -199,6 +205,7 @@ class PmsFolio(models.Model):
|
||||
comodel_name="res.partner",
|
||||
domain=[("is_agency", "=", True)],
|
||||
ondelete="restrict",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
sale_channel_ids = fields.Many2many(
|
||||
@@ -212,6 +219,7 @@ class PmsFolio(models.Model):
|
||||
string="Sale Channel Origin",
|
||||
help="Sale Channel through which folio was created, the original",
|
||||
comodel_name="pms.sale.channel",
|
||||
index=True,
|
||||
)
|
||||
|
||||
transaction_ids = fields.Many2many(
|
||||
@@ -249,6 +257,7 @@ class PmsFolio(models.Model):
|
||||
help="Payment terms for current folio.",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="account.payment.term",
|
||||
ondelete="restrict",
|
||||
compute="_compute_payment_term_id",
|
||||
@@ -329,11 +338,13 @@ class PmsFolio(models.Model):
|
||||
string="Fiscal Position",
|
||||
help="The fiscal position depends on the location of the client",
|
||||
comodel_name="account.fiscal.position",
|
||||
index=True,
|
||||
)
|
||||
closure_reason_id = fields.Many2one(
|
||||
string="Closure Reason",
|
||||
help="The closure reason for a closure room",
|
||||
comodel_name="room.closure.reason",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
out_service_description = fields.Text(
|
||||
|
||||
@@ -35,6 +35,7 @@ class PmsProperty(models.Model):
|
||||
help="Current property",
|
||||
comodel_name="res.partner",
|
||||
required=True,
|
||||
index=True,
|
||||
ondelete="restrict",
|
||||
)
|
||||
pms_property_code = fields.Char(
|
||||
@@ -45,6 +46,7 @@ class PmsProperty(models.Model):
|
||||
string="Company",
|
||||
help="The company that owns or operates this property.",
|
||||
comodel_name="res.company",
|
||||
index=True,
|
||||
required=True,
|
||||
)
|
||||
user_ids = fields.Many2many(
|
||||
@@ -66,6 +68,7 @@ class PmsProperty(models.Model):
|
||||
help="The default pricelist used in this property.",
|
||||
comodel_name="product.pricelist",
|
||||
required=True,
|
||||
index=True,
|
||||
domain="[('is_pms_available', '=', True)]",
|
||||
default=lambda self: self.env.ref("product.list0").id,
|
||||
)
|
||||
@@ -80,6 +83,7 @@ class PmsProperty(models.Model):
|
||||
help="The sequence that formed the name of the folio.",
|
||||
check_company=True,
|
||||
copy=False,
|
||||
index=True,
|
||||
comodel_name="ir.sequence",
|
||||
)
|
||||
checkin_sequence_id = fields.Many2one(
|
||||
@@ -87,6 +91,7 @@ class PmsProperty(models.Model):
|
||||
help="Field used to create the name of the checkin partner",
|
||||
check_company=True,
|
||||
copy=False,
|
||||
index=True,
|
||||
comodel_name="ir.sequence",
|
||||
)
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ class PmsReservation(models.Model):
|
||||
priority = fields.Integer(
|
||||
string="Priority",
|
||||
help="Priority of a reservation",
|
||||
index=True,
|
||||
store="True",
|
||||
compute="_compute_priority",
|
||||
)
|
||||
@@ -52,6 +51,7 @@ class PmsReservation(models.Model):
|
||||
copy=False,
|
||||
comodel_name="pms.room",
|
||||
ondelete="restrict",
|
||||
index=True,
|
||||
domain="["
|
||||
"('id', 'in', allowed_room_ids),"
|
||||
"('pms_property_id', '=', pms_property_id),"
|
||||
@@ -69,6 +69,7 @@ class PmsReservation(models.Model):
|
||||
string="Folio",
|
||||
help="The folio where the reservations are included",
|
||||
copy=False,
|
||||
index=True,
|
||||
comodel_name="pms.folio",
|
||||
ondelete="restrict",
|
||||
tracking=True,
|
||||
@@ -87,6 +88,7 @@ class PmsReservation(models.Model):
|
||||
store=True,
|
||||
comodel_name="pms.board.service.room.type",
|
||||
compute="_compute_board_service_room_id",
|
||||
index=True,
|
||||
tracking=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
@@ -98,6 +100,7 @@ class PmsReservation(models.Model):
|
||||
readonly=False,
|
||||
copy=False,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="pms.room.type",
|
||||
ondelete="restrict",
|
||||
compute="_compute_room_type_id",
|
||||
@@ -109,6 +112,7 @@ class PmsReservation(models.Model):
|
||||
help="Name of who made the reservation",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="res.partner",
|
||||
ondelete="restrict",
|
||||
compute="_compute_partner_id",
|
||||
@@ -120,6 +124,7 @@ class PmsReservation(models.Model):
|
||||
help="Agency that made the reservation",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
related="folio_id.agency_id",
|
||||
depends=["folio_id.agency_id"],
|
||||
tracking=True,
|
||||
@@ -136,6 +141,7 @@ class PmsReservation(models.Model):
|
||||
help="Sale Channel through which reservation was created, the original",
|
||||
default=lambda self: self._get_default_sale_channel_origin(),
|
||||
comodel_name="pms.sale.channel",
|
||||
index=True,
|
||||
)
|
||||
force_update_origin = fields.Boolean(
|
||||
string="Update Sale Channel Origin",
|
||||
@@ -171,6 +177,7 @@ class PmsReservation(models.Model):
|
||||
readonly=True,
|
||||
store=True,
|
||||
related="folio_id.company_id",
|
||||
index=True,
|
||||
)
|
||||
pms_property_id = fields.Many2one(
|
||||
string="Pms Property",
|
||||
@@ -180,6 +187,7 @@ class PmsReservation(models.Model):
|
||||
default=lambda self: self.env.user.get_active_property_ids()[0],
|
||||
related="folio_id.pms_property_id",
|
||||
comodel_name="pms.property",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
reservation_line_ids = fields.One2many(
|
||||
@@ -215,6 +223,7 @@ class PmsReservation(models.Model):
|
||||
compute="_compute_pricelist_id",
|
||||
tracking=True,
|
||||
check_pms_properties=True,
|
||||
index=True,
|
||||
domain="[('is_pms_available', '=', True)]",
|
||||
)
|
||||
user_id = fields.Many2one(
|
||||
@@ -324,6 +333,7 @@ class PmsReservation(models.Model):
|
||||
help="The currency used in relation to the pricelist",
|
||||
readonly=True,
|
||||
store=True,
|
||||
index=True,
|
||||
related="pricelist_id.currency_id",
|
||||
depends=["pricelist_id"],
|
||||
)
|
||||
|
||||
@@ -30,6 +30,7 @@ class PmsReservationLine(models.Model):
|
||||
string="Room",
|
||||
help="The room of a reservation. ",
|
||||
readonly=False,
|
||||
index=True,
|
||||
store=True,
|
||||
compute="_compute_room_id",
|
||||
comodel_name="pms.room",
|
||||
@@ -51,6 +52,7 @@ class PmsReservationLine(models.Model):
|
||||
store=True,
|
||||
comodel_name="pms.property",
|
||||
related="reservation_id.pms_property_id",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
date = fields.Date(
|
||||
@@ -87,6 +89,7 @@ class PmsReservationLine(models.Model):
|
||||
comodel_name="pms.availability",
|
||||
ondelete="restrict",
|
||||
compute="_compute_avail_id",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
discount = fields.Float(
|
||||
@@ -122,6 +125,7 @@ class PmsReservationLine(models.Model):
|
||||
string="Sale Channel",
|
||||
help="Sale Channel through which reservation line was created",
|
||||
comodel_name="pms.sale.channel",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
default_invoice_to = fields.Many2one(
|
||||
@@ -133,6 +137,7 @@ class PmsReservationLine(models.Model):
|
||||
store=True,
|
||||
compute="_compute_default_invoice_to",
|
||||
comodel_name="res.partner",
|
||||
index=True,
|
||||
ondelete="restrict",
|
||||
)
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ class PmsRoom(models.Model):
|
||||
required=True,
|
||||
default=lambda self: self.env.user.get_active_property_ids()[0],
|
||||
comodel_name="pms.property",
|
||||
index=True,
|
||||
ondelete="restrict",
|
||||
)
|
||||
room_type_id = fields.Many2one(
|
||||
@@ -46,6 +47,7 @@ class PmsRoom(models.Model):
|
||||
required=True,
|
||||
comodel_name="pms.room.type",
|
||||
ondelete="restrict",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
parent_id = fields.Many2one(
|
||||
@@ -53,6 +55,7 @@ class PmsRoom(models.Model):
|
||||
help="Indicates that this room is a child of another room",
|
||||
comodel_name="pms.room",
|
||||
ondelete="restrict",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
child_ids = fields.One2many(
|
||||
@@ -66,6 +69,7 @@ class PmsRoom(models.Model):
|
||||
string="Ubication",
|
||||
help="At which ubication the room is located.",
|
||||
comodel_name="pms.ubication",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
capacity = fields.Integer(
|
||||
|
||||
@@ -30,6 +30,7 @@ class PmsRoomType(models.Model):
|
||||
comodel_name="product.product",
|
||||
required=True,
|
||||
delegate=True,
|
||||
index=True,
|
||||
ondelete="cascade",
|
||||
)
|
||||
room_ids = fields.One2many(
|
||||
@@ -44,6 +45,7 @@ class PmsRoomType(models.Model):
|
||||
help="Class to which the room type belongs",
|
||||
comodel_name="pms.room.type.class",
|
||||
required=True,
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
board_service_room_type_ids = fields.One2many(
|
||||
|
||||
@@ -23,6 +23,7 @@ class PmsService(models.Model):
|
||||
string="Service",
|
||||
help="Product associated with this service",
|
||||
required=True,
|
||||
index=True,
|
||||
comodel_name="product.product",
|
||||
ondelete="restrict",
|
||||
check_pms_properties=True,
|
||||
@@ -33,6 +34,7 @@ class PmsService(models.Model):
|
||||
help="Folio in which the service is included",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="pms.folio",
|
||||
compute="_compute_folio_id",
|
||||
check_pms_properties=True,
|
||||
@@ -51,6 +53,7 @@ class PmsService(models.Model):
|
||||
default=lambda self: self._default_reservation_id(),
|
||||
comodel_name="pms.reservation",
|
||||
ondelete="cascade",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
service_line_ids = fields.One2many(
|
||||
@@ -68,6 +71,7 @@ class PmsService(models.Model):
|
||||
help="Company to which the service belongs",
|
||||
readonly=True,
|
||||
store=True,
|
||||
index=True,
|
||||
related="folio_id.company_id",
|
||||
)
|
||||
pms_property_id = fields.Many2one(
|
||||
@@ -75,6 +79,7 @@ class PmsService(models.Model):
|
||||
help="Property to which the service belongs",
|
||||
readonly=True,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="pms.property",
|
||||
related="folio_id.pms_property_id",
|
||||
check_pms_properties=True,
|
||||
@@ -98,6 +103,7 @@ class PmsService(models.Model):
|
||||
help="The currency used in relation to the folio",
|
||||
readonly=True,
|
||||
store=True,
|
||||
index=True,
|
||||
related="folio_id.currency_id",
|
||||
)
|
||||
sequence = fields.Integer(string="Sequence", help="", default=10)
|
||||
@@ -152,6 +158,7 @@ class PmsService(models.Model):
|
||||
help="Sale Channel through which service was created, the original",
|
||||
comodel_name="pms.sale.channel",
|
||||
check_pms_properties=True,
|
||||
index=True,
|
||||
)
|
||||
price_subtotal = fields.Monetary(
|
||||
string="Subtotal",
|
||||
@@ -199,6 +206,7 @@ class PmsService(models.Model):
|
||||
a guest or the generic contact will be used instead""",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_default_invoice_to",
|
||||
comodel_name="res.partner",
|
||||
ondelete="restrict",
|
||||
@@ -315,6 +323,7 @@ class PmsService(models.Model):
|
||||
"reservation_id.adults",
|
||||
"product_qty",
|
||||
)
|
||||
# flake8:noqa=C901
|
||||
def _compute_service_line_ids(self):
|
||||
for service in self:
|
||||
if service.no_auto_add_lines:
|
||||
@@ -403,10 +412,11 @@ class PmsService(models.Model):
|
||||
},
|
||||
)
|
||||
]
|
||||
# if service lines has only one line, set its day_qty to service product_qty
|
||||
# if service lines has only one line,
|
||||
# set its day_qty to service product_qty
|
||||
elif len(service.service_line_ids) == 1 and self.product_qty:
|
||||
service.service_line_ids.day_qty = self.product_qty
|
||||
|
||||
|
||||
else:
|
||||
if not service.service_line_ids:
|
||||
price_unit = service._get_price_unit_line()
|
||||
|
||||
@@ -22,6 +22,7 @@ class PmsServiceLine(models.Model):
|
||||
help="Service identifier",
|
||||
required=True,
|
||||
copy=False,
|
||||
index=True,
|
||||
comodel_name="pms.service",
|
||||
ondelete="cascade",
|
||||
)
|
||||
@@ -35,6 +36,7 @@ class PmsServiceLine(models.Model):
|
||||
string="Product",
|
||||
help="Product associated with this service line",
|
||||
store=True,
|
||||
index=True,
|
||||
related="service_id.product_id",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
@@ -50,6 +52,7 @@ class PmsServiceLine(models.Model):
|
||||
help="Property to which the service belongs",
|
||||
readonly=True,
|
||||
store=True,
|
||||
index=True,
|
||||
comodel_name="pms.property",
|
||||
related="service_id.pms_property_id",
|
||||
check_pms_properties=True,
|
||||
@@ -100,6 +103,7 @@ class PmsServiceLine(models.Model):
|
||||
help="The currency used in relation to the service where it's included",
|
||||
readonly=True,
|
||||
store=True,
|
||||
index=True,
|
||||
related="service_id.currency_id",
|
||||
)
|
||||
reservation_id = fields.Many2one(
|
||||
@@ -107,6 +111,7 @@ class PmsServiceLine(models.Model):
|
||||
help="Room to which the services will be applied",
|
||||
readonly=True,
|
||||
store=True,
|
||||
index=True,
|
||||
related="service_id.reservation_id",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
@@ -140,6 +145,7 @@ class PmsServiceLine(models.Model):
|
||||
a guest or the generic contact will be used instead""",
|
||||
comodel_name="res.partner",
|
||||
store=True,
|
||||
index=True,
|
||||
related="service_id.default_invoice_to",
|
||||
ondelete="restrict",
|
||||
)
|
||||
|
||||
@@ -22,6 +22,7 @@ class PmsTeamMember(models.Model):
|
||||
string="Property",
|
||||
comodel_name="pms.property",
|
||||
store=True,
|
||||
index=True,
|
||||
ondelete="restrict",
|
||||
)
|
||||
user_id = fields.Many2one(
|
||||
@@ -29,6 +30,7 @@ class PmsTeamMember(models.Model):
|
||||
copy=False,
|
||||
comodel_name="res.users",
|
||||
ondelete="restrict",
|
||||
index=True,
|
||||
)
|
||||
pms_role = fields.Selection(
|
||||
string="PMS Role",
|
||||
|
||||
@@ -33,11 +33,13 @@ class ProductPricelist(models.Model):
|
||||
company_id = fields.Many2one(
|
||||
string="Company",
|
||||
help="Company to which the pricelist belongs",
|
||||
index=True,
|
||||
)
|
||||
cancelation_rule_id = fields.Many2one(
|
||||
string="Cancelation Policy",
|
||||
help="Cancelation Policy included in the room",
|
||||
comodel_name="pms.cancelation.rule",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
pricelist_type = fields.Selection(
|
||||
@@ -57,6 +59,7 @@ class ProductPricelist(models.Model):
|
||||
help="Availability Plan for which the pricelist is included",
|
||||
comodel_name="pms.availability.plan",
|
||||
ondelete="restrict",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
item_ids = fields.One2many(
|
||||
|
||||
@@ -30,21 +30,25 @@ class ProductPricelistItem(models.Model):
|
||||
string="Board Service",
|
||||
help="Specify a Board services on Room Types.",
|
||||
comodel_name="pms.board.service.room.type",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
pricelist_id = fields.Many2one(
|
||||
string="Pricelist",
|
||||
help="Pricelist in which this item is included",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
product_id = fields.Many2one(
|
||||
string="Product",
|
||||
help="Product associated with the item",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
product_tmpl_id = fields.Many2one(
|
||||
string="Product Template",
|
||||
help="Product template associated with the item",
|
||||
index=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
allowed_board_service_product_ids = fields.Many2many(
|
||||
|
||||
@@ -55,5 +55,6 @@ class ResCompany(models.Model):
|
||||
string="Cancel penalty product",
|
||||
help="Product used to calculate the cancel penalty",
|
||||
comodel_name="product.product",
|
||||
index=True,
|
||||
ondelete="restrict",
|
||||
)
|
||||
|
||||
@@ -31,6 +31,7 @@ class ResPartner(models.Model):
|
||||
comodel_name="pms.sale.channel",
|
||||
domain=[("channel_type", "=", "indirect")],
|
||||
ondelete="restrict",
|
||||
index=True,
|
||||
)
|
||||
default_commission = fields.Integer(string="Commission", help="Default commission")
|
||||
apply_pricelist = fields.Boolean(
|
||||
@@ -91,6 +92,7 @@ class ResPartner(models.Model):
|
||||
nationality_id = fields.Many2one(
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_nationality_id",
|
||||
)
|
||||
email = fields.Char(
|
||||
@@ -127,11 +129,13 @@ class ResPartner(models.Model):
|
||||
country_id = fields.Many2one(
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_country_id",
|
||||
)
|
||||
state_id = fields.Many2one(
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_state_id",
|
||||
)
|
||||
city = fields.Char(
|
||||
@@ -221,6 +225,7 @@ class ResPartner(models.Model):
|
||||
help="Partner country of residence",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_residence_country_id",
|
||||
comodel_name="res.country",
|
||||
)
|
||||
@@ -229,6 +234,7 @@ class ResPartner(models.Model):
|
||||
help="Partner state of residence",
|
||||
readonly=False,
|
||||
store=True,
|
||||
index=True,
|
||||
compute="_compute_residence_state_id",
|
||||
comodel_name="res.country.state",
|
||||
)
|
||||
|
||||
@@ -14,6 +14,7 @@ class ResUsers(models.Model):
|
||||
comodel_name="pms.property",
|
||||
domain="[('id','in',pms_property_ids)]",
|
||||
context={"user_preference": True},
|
||||
index=True,
|
||||
)
|
||||
pms_property_ids = fields.Many2many(
|
||||
string="Properties",
|
||||
|
||||
Reference in New Issue
Block a user