mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD]multi_pms_properties (#66)
* [WIP]pms: models check_pms_property * [WIP][IMP+REF] multi_pms_properties: refactor and added test skeleton * [FIX] inherit create models * [ADD] room multiproperty check * [ADD] room multiproperty check * [IMP] Multiproperty checks in pms models * [IMP] Fix Multiproperty checks in pms models * [IMP] Add multiproperty domain in multi_pms_properties module * [IMP] Fix multiproperty checks in pms tests * [IMP] Fix multiproperty checks logic * [IMP] Auto Domains * [IMP] availability property results, domain preferred_room_id * [IMP] model domain properties * [ADD] pms multiproperty depends * [IMP] models and views multiproperty checks * [FIX] Multiple rebase multiproperty fixes * [ADD] Readme * [ADD] Company - multiproperty checks * [ADD] travis server wide modules multiproperty * [FIX] travis conf load * [FIX] travis conf load2 * [FIX] travis conf load2 Co-authored-by: Eric Antones <eantones@nuobit.com> Co-authored-by: Sara Lago <saralago126@gmail.com>
This commit is contained in:
@@ -18,6 +18,7 @@ class PmsFolio(models.Model):
|
||||
_inherit = ["mail.thread", "mail.activity.mixin", "portal.mixin"]
|
||||
_order = "date_order"
|
||||
_check_company_auto = True
|
||||
_check_pms_properties_auto = True
|
||||
|
||||
# Default Methods ang Gets
|
||||
def name_get(self):
|
||||
@@ -54,6 +55,7 @@ class PmsFolio(models.Model):
|
||||
ondelete="restrict",
|
||||
store=True,
|
||||
readonly=False,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
reservation_ids = fields.One2many(
|
||||
"pms.reservation",
|
||||
@@ -62,6 +64,7 @@ class PmsFolio(models.Model):
|
||||
states={"done": [("readonly", True)]},
|
||||
help="Room reservation detail.",
|
||||
check_company=True,
|
||||
check_pms_properties=True,
|
||||
)
|
||||
number_of_rooms = fields.Integer(
|
||||
"Number of Rooms",
|
||||
@@ -69,7 +72,7 @@ class PmsFolio(models.Model):
|
||||
store="True",
|
||||
)
|
||||
number_of_services = fields.Integer(
|
||||
"Number of Rooms",
|
||||
"Number of Services",
|
||||
compute="_compute_number_of_services",
|
||||
store="True",
|
||||
)
|
||||
@@ -81,9 +84,7 @@ class PmsFolio(models.Model):
|
||||
help="Services detail provide to customer and it will "
|
||||
"include in main Invoice.",
|
||||
check_company=True,
|
||||
domain="['|',"
|
||||
"('pms_property_id','=',pms_property_id),"
|
||||
"('pms_property_id','=',False)]",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
sale_line_ids = fields.One2many(
|
||||
"folio.sale.line",
|
||||
@@ -98,8 +99,8 @@ class PmsFolio(models.Model):
|
||||
company_id = fields.Many2one(
|
||||
"res.company",
|
||||
"Company",
|
||||
required=True,
|
||||
default=lambda self: self.env.company,
|
||||
compute="_compute_company_id",
|
||||
store=True,
|
||||
)
|
||||
move_line_ids = fields.Many2many(
|
||||
"account.move.line",
|
||||
@@ -132,9 +133,7 @@ class PmsFolio(models.Model):
|
||||
store=True,
|
||||
readonly=False,
|
||||
help="Pricelist for current folio.",
|
||||
domain="['|',"
|
||||
"(pms_property_id, 'in', 'pms_property_ids'),"
|
||||
"('pms_property_ids','=',False)]",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
commission = fields.Float(
|
||||
string="Commission",
|
||||
@@ -158,6 +157,7 @@ class PmsFolio(models.Model):
|
||||
string="Agency",
|
||||
ondelete="restrict",
|
||||
domain=[("is_agency", "=", True)],
|
||||
check_pms_properties=True,
|
||||
)
|
||||
channel_type_id = fields.Many2one(
|
||||
"pms.sale.channel",
|
||||
@@ -167,6 +167,7 @@ class PmsFolio(models.Model):
|
||||
string="Direct Sale Channel",
|
||||
ondelete="restrict",
|
||||
domain=[("channel_type", "=", "direct")],
|
||||
check_pms_properties=True,
|
||||
)
|
||||
transaction_ids = fields.Many2many(
|
||||
"payment.transaction",
|
||||
@@ -236,6 +237,7 @@ class PmsFolio(models.Model):
|
||||
store=True,
|
||||
readonly=False,
|
||||
help="Invoice address for current group.",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
# REVIEW THIS
|
||||
# partner_invoice_state_id = fields.Many2one(related="partner_invoice_id.state_id")
|
||||
@@ -247,9 +249,7 @@ class PmsFolio(models.Model):
|
||||
)
|
||||
closure_reason_id = fields.Many2one(
|
||||
"room.closure.reason",
|
||||
domain="['|',"
|
||||
"(pms_property_id, 'in', 'pms_property_ids'),"
|
||||
"('pms_property_ids', '=', False)]",
|
||||
check_pms_properties=True,
|
||||
)
|
||||
segmentation_ids = fields.Many2many(
|
||||
"res.partner.category", string="Segmentation", ondelete="restrict"
|
||||
@@ -472,6 +472,11 @@ class PmsFolio(models.Model):
|
||||
for fsl in folio_sale_lines_to_remove:
|
||||
self.env["folio.sale.line"].browse(fsl).unlink()
|
||||
|
||||
@api.depends("pms_property_id")
|
||||
def _compute_company_id(self):
|
||||
for record in self:
|
||||
record.company_id = record.pms_property_id.company_id
|
||||
|
||||
@api.model
|
||||
def generate_reservation_services_sale_lines(self, folio, reservation):
|
||||
for service in reservation.service_ids:
|
||||
@@ -1396,18 +1401,6 @@ class PmsFolio(models.Model):
|
||||
_("The Sale Channel does not correspond to the agency's")
|
||||
)
|
||||
|
||||
@api.constrains(
|
||||
"closure_reason_id",
|
||||
)
|
||||
def _check_property_integrity(self):
|
||||
for rec in self:
|
||||
if rec.pms_property_id:
|
||||
if (
|
||||
rec.pms_property_id.id
|
||||
not in rec.closure_reason_id.pms_property_ids.ids
|
||||
):
|
||||
raise ValidationError(_("Property not allowed"))
|
||||
|
||||
@api.model
|
||||
def _prepare_down_payment_section_line(self, **optional_values):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user