Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DarioLodeiros
Copy link
Member

This pull request standardizes the handling of monetary fields throughout the PMS (Property Management System) models and views. The main change is replacing all fields.Float definitions for monetary values with fields.Monetary in the models, and ensuring the corresponding widgets in the views use the monetary widget. This improves currency handling, display formatting, and consistency across the application.

Model changes: Monetary field standardization

  • Replaced all fields.Float fields representing monetary values (such as commission, commission_amount, price_tax, discount, services_discount, price, price_day_total, price_unit, price_day_tax) with fields.Monetary in PmsFolio, PmsReservation, PmsReservationLine, PmsService, and PmsServiceLine models. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]

View changes: Consistent monetary display

  • Updated all relevant fields in XML views to use the monetary widget, ensuring proper currency formatting in the UI for fields such as amount_untaxed, amount_tax, commission, price_unit, amount, price, price_day_total, price_subtotal, price_tax, discount, price_total, commission_amount, and folio_pending_amount. [1] [2] [3] [4] [5] [6] [7]

Currency context improvements

  • Added hidden currency_id fields where needed in tree and form views to ensure that the correct currency context is available for monetary fields. [1] [2]

Cleanup of widget options

  • Removed redundant options="{'currency_field': 'currency_id'}" from XML field definitions, as the monetary widget now automatically handles currency context when currency_id is present. [1] [2] [3]

Minor UI enhancements

  • Added a separator for "Nights" in the reservation detail page and set the date field in service lines to use the date widget for improved readability. [1] [2]

These changes collectively improve the accuracy, consistency, and user experience of monetary data throughout the PMS application.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request standardizes monetary field handling across the PMS (Property Management System) by replacing fields.Float with fields.Monetary for all money-related fields and updating corresponding view widgets to use the monetary widget for proper currency formatting.

  • Replaces all monetary fields.Float definitions with fields.Monetary across PMS models
  • Updates XML views to use monetary widget for consistent currency display formatting
  • Adds hidden currency_id fields to views and removes redundant currency options

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pms/models/pms_folio.py Updates commission field from Float to Monetary
pms/models/pms_reservation.py Converts commission_amount, price_tax, discount, and services_discount to Monetary fields
pms/models/pms_reservation_line.py Changes price and price_day_total fields to Monetary type
pms/models/pms_service.py Updates price_tax and discount fields to use Monetary type
pms/models/pms_service_line.py Converts price_unit and price_day_tax to Monetary fields
pms/views/pms_folio_views.xml Adds monetary widgets and removes redundant currency options from folio views
pms/views/pms_reservation_views.xml Updates reservation views with monetary widgets, adds currency context, and improves UI formatting

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

<group
class="oe_subtotal_footer oe_right oe_inline"
name="folio_total"
widget="monetary"
Copy link

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The widget="monetary" attribute is incorrectly placed on a <group> element. The monetary widget should only be applied to individual field elements, not group containers.

Suggested change
widget="monetary"

Copilot uses AI. Check for mistakes.
Copy link
Member

@jesusVMayor jesusVMayor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The widget monetary its not needed in the views if the field is defined as monetary.

Also remove the widget in pending_amount in folio and folio_pending_amount in reservation

>
<tree name="Days">
<field name="date" />
<field name="date" widget="date" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants