mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[TMP]pms_api_rest: review input params None/False/''
This commit is contained in:
@@ -508,7 +508,7 @@ class PmsCalendarService(Component):
|
|||||||
reservation_vals.update(
|
reservation_vals.update(
|
||||||
{"board_service_room_id": reservation_lines_changes.boardServiceId}
|
{"board_service_room_id": reservation_lines_changes.boardServiceId}
|
||||||
)
|
)
|
||||||
if reservation_lines_changes.pricelistId is not None:
|
if reservation_lines_changes.pricelistId:
|
||||||
reservation_vals.update(
|
reservation_vals.update(
|
||||||
{"pricelist_id": reservation_lines_changes.pricelistId}
|
{"pricelist_id": reservation_lines_changes.pricelistId}
|
||||||
)
|
)
|
||||||
@@ -518,7 +518,7 @@ class PmsCalendarService(Component):
|
|||||||
reservation_vals.update(
|
reservation_vals.update(
|
||||||
{"children": reservation_lines_changes.children}
|
{"children": reservation_lines_changes.children}
|
||||||
)
|
)
|
||||||
if reservation_lines_changes.segmentationId is not None:
|
if reservation_lines_changes.segmentationId:
|
||||||
reservation_vals.update(
|
reservation_vals.update(
|
||||||
{
|
{
|
||||||
"segmentation_ids": [
|
"segmentation_ids": [
|
||||||
|
|||||||
@@ -33,12 +33,12 @@ class PmsInvoiceService(Component):
|
|||||||
raise UserError(_("You can't update a reversed invoice"))
|
raise UserError(_("You can't update a reversed invoice"))
|
||||||
new_vals = {}
|
new_vals = {}
|
||||||
if (
|
if (
|
||||||
pms_invoice_info.partnerId is not None
|
pms_invoice_info.partnerId
|
||||||
and pms_invoice_info.partnerId != invoice.partner_id.id
|
and pms_invoice_info.partnerId != invoice.partner_id.id
|
||||||
):
|
):
|
||||||
new_vals["partner_id"] = pms_invoice_info.partnerId
|
new_vals["partner_id"] = pms_invoice_info.partnerId
|
||||||
|
|
||||||
if pms_invoice_info.date is not None:
|
if pms_invoice_info.date:
|
||||||
invoice_date_info = fields.Date.from_string(pms_invoice_info.date)
|
invoice_date_info = fields.Date.from_string(pms_invoice_info.date)
|
||||||
if invoice_date_info != invoice.invoice_date:
|
if invoice_date_info != invoice.invoice_date:
|
||||||
new_vals["invoice_date"] = invoice_date_info
|
new_vals["invoice_date"] = invoice_date_info
|
||||||
|
|||||||
@@ -315,8 +315,10 @@ class PmsTransactionService(Component):
|
|||||||
pms_transaction_info.amount, 2
|
pms_transaction_info.amount, 2
|
||||||
) != round(transaction.amount, 2):
|
) != round(transaction.amount, 2):
|
||||||
vals["amount"] = pms_transaction_info.amount
|
vals["amount"] = pms_transaction_info.amount
|
||||||
|
# Review: review all input parameters in all services
|
||||||
|
# to determine the handling of values: False or 0, None, and empty string ''
|
||||||
if (
|
if (
|
||||||
pms_transaction_info.partnerId is not None
|
pms_transaction_info.partnerId
|
||||||
and pms_transaction_info.partnerId != transaction.partner_id.id
|
and pms_transaction_info.partnerId != transaction.partner_id.id
|
||||||
):
|
):
|
||||||
vals["partner_id"] = pms_transaction_info.partnerId
|
vals["partner_id"] = pms_transaction_info.partnerId
|
||||||
|
|||||||
Reference in New Issue
Block a user