Code review (#62)

* [REF] pms: refactor amenity type

* [REF] pms: refactor amenity

* [REF]Refactor amenity views and demo data

* [WIP] master model 2nd day

* [WIP] Master model refactor

* [WIP] Refactor in tests

* [WIP] Add mandatory sequence in pms_property at tests and fix create in folio, reservation and checkin

* [WIP] Test refactor

* [WIP]Refactor pms_room, pms_room_clousure_reason and pms_room_type

* [WIP]review of guidelines in master models

* [WIP]test refactor

* [WIP]review guidelines in master models 2

* [WIP] fixed fields in pms_l10n_es

* [WIP]Refactor product_product, product_template, res_company, res_partner and res_user

* [IMP] Add common.py for tests

* [WIP] Refactor fields in pms.folio and pms.reservation

* [WIP] Review guidelines in pms.reservation, pms.reservation.line and rename availability models

* [WIP] Rename availability models

* [WIP] Refactor availability models

* [WIP] Refactor availity models 2

* [WIP] Pms: add sequences creation in pms_property create

* [WIP] Fix sequence creation in pmp.property

* [REF] Refactor fields in res_partner and rename date_overnight

* [REF] Refactoring master models tests

* [FIX] Fix sequence create in pms.reservation

* [REF] Refactor helps in master and availability models

* [IMP] Extend test coverage in test_pms_reservation

* [REF] Refactor fields in pms_reservation

* [REF] Refactor fields in pms_reservation 2

* [REF] Refactor fields in service flow

* [REF] Refactor pms_reservation

* [REF] Refactor pms_reservation 2

* [REF] draft button removed from view

* [REF] change no_show to arrival_delayed in field state of pms_reservation

* [REF] Add compute_preferred_room_id in pms_reservation

* [REF] Fix cache problem in test_reservation_action_checkout

Co-authored-by: braisab <braisterbutalino@gmail.com>
Co-authored-by: Sara Lago <saralago126@gmail.com>
Co-authored-by: Brais Abeijón <>
This commit is contained in:
Miguel Padin
2021-04-15 01:01:11 +02:00
committed by GitHub
parent eace7de663
commit 0d03152402
79 changed files with 3920 additions and 2480 deletions

View File

@@ -11,35 +11,45 @@ _logger = logging.getLogger(__name__)
class ResPartner(models.Model):
_inherit = "res.partner"
# Fields declaration
main_partner_id = fields.Many2one(
"res.partner", string="Destination Partner fusion"
)
reservations_count = fields.Integer(
"Reservations", compute="_compute_reservations_count"
string="Reservations",
help="Number of reservations of the partner",
compute="_compute_reservations_count",
)
folios_count = fields.Integer(
string="Folios",
help="Number of folios of the partner",
compute="_compute_folios_count",
)
is_agency = fields.Boolean(
string="Is Agency", help="Indicates if the partner is an agency"
)
folios_count = fields.Integer("Folios", compute="_compute_folios_count")
unconfirmed = fields.Boolean("Unconfirmed", default=True)
is_agency = fields.Boolean("Is Agency")
sale_channel_id = fields.Many2one(
"pms.sale.channel",
string="Sale Channel",
ondelete="restrict",
help="The sale channel of the partner",
comodel_name="pms.sale.channel",
domain=[("channel_type", "=", "indirect")],
ondelete="restrict",
)
default_commission = fields.Integer(string="Commission", help="Default commission")
apply_pricelist = fields.Boolean(
string="Apply Pricelist",
help="Indicates if agency pricelist is applied to his reservations",
)
invoice_to_agency = fields.Boolean(
string="Invoice Agency",
help="Indicates if agency invoices partner",
)
default_commission = fields.Integer("Commission")
apply_pricelist = fields.Boolean("Apply Pricelist")
invoice_agency = fields.Boolean("Invoice Agency")
# Compute and Search methods
def _compute_reservations_count(self):
# TODO: recuperar las reservas de los folios del partner
pms_reservation_obj = self.env["pms.reservation"]
for record in self:
record.reservations_count = pms_reservation_obj.search_count(
[
(
"partner_id.id",
"=",
"child_of",
record.id if isinstance(record.id, int) else False,
)
]
@@ -58,7 +68,6 @@ class ResPartner(models.Model):
]
)
# ORM Overrides
@api.model
def name_search(self, name, args=None, operator="ilike", limit=100):
if not args: