mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
14.0 pms service price day (#57)
WIP: compute folio_sale_line without (5,0,0) WIP: boardservices pricelist item sql search * [IMP]pms: Service day with prices * [ADD]pms: New Product price base type: Board Service * [WIP]pms: pricelist item rule board service * [WIP]pms: pricelist boardservice sql * [WIP]pms: pricelist boardservice sql * [IMP] service price per day * [FIX] compute board_service reservation change * [FIX] Views * [IMP]pms: add default user_id on reservation and folio * [IMP]pms: aler change prices reservation * [FIX]pms: recompute reservation services board * [DEL]pms: pricelist field on board_service_room_type * [RFC] sale_line_ids model
This commit is contained in:
@@ -41,12 +41,12 @@ class PmsReservationLine(models.Model):
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
move_line_ids = fields.Many2many(
|
||||
"account.move.line",
|
||||
"reservation_line_move_rel",
|
||||
sale_line_ids = fields.Many2many(
|
||||
"folio.sale.line",
|
||||
"reservation_line_sale_line_rel",
|
||||
"reservation_line_id",
|
||||
"move_line_id",
|
||||
string="Invoice Lines",
|
||||
"sale_line_id",
|
||||
string="Sales Lines",
|
||||
readonly=True,
|
||||
copy=False,
|
||||
)
|
||||
@@ -65,11 +65,6 @@ class PmsReservationLine(models.Model):
|
||||
store=True,
|
||||
readonly=False,
|
||||
)
|
||||
invoiced = fields.Boolean(
|
||||
string="Invoiced",
|
||||
compute="_compute_invoiced",
|
||||
store=True,
|
||||
)
|
||||
cancel_discount = fields.Float(
|
||||
string="Cancelation Discount (%)",
|
||||
digits=("Discount"),
|
||||
@@ -311,31 +306,15 @@ class PmsReservationLine(models.Model):
|
||||
else:
|
||||
line.occupies_availability = True
|
||||
|
||||
@api.depends("move_line_ids", "move_line_ids.move_id.state")
|
||||
def _compute_invoiced(self):
|
||||
for line in self:
|
||||
qty_invoiced = 0
|
||||
for invoice_line in line.move_line_ids:
|
||||
if invoice_line.move_id.state != "cancel":
|
||||
if invoice_line.move_id.move_type == "out_invoice":
|
||||
qty_invoiced += 1
|
||||
elif invoice_line.move_id.move_type == "out_refund":
|
||||
qty_invoiced -= 1
|
||||
line.invoiced = False if qty_invoiced < 1 else True
|
||||
|
||||
# TODO: Refact method and allowed cancelled single days
|
||||
@api.depends("reservation_id.cancelled_reason")
|
||||
def _compute_cancel_discount(self):
|
||||
for line in self:
|
||||
line.cancel_discount = 0
|
||||
# TODO: Review cancel logic
|
||||
# reservation = line.reservation_id
|
||||
# pricelist = reservation.pricelist_id
|
||||
# if reservation.state == "cancelled":
|
||||
# # TODO: Set 0 qty on cancel room services change to compute day_qty
|
||||
# # (view constrain service_line_days)
|
||||
# for service in reservation.service_ids:
|
||||
# service.service_line_ids.write({"day_qty": 0})
|
||||
# service._compute_days_qty()
|
||||
# if (
|
||||
# reservation.cancelled_reason
|
||||
# and pricelist
|
||||
|
||||
Reference in New Issue
Block a user