Skip to content

[14.0][FIX+REF] prorrate error on date conversion#757

Merged
eantones merged 4 commits into14.0from
14.0-fix-prorrate-error_on_date_conversion
Oct 15, 2025
Merged

[14.0][FIX+REF] prorrate error on date conversion#757
eantones merged 4 commits into14.0from
14.0-fix-prorrate-error_on_date_conversion

Conversation

@eantones
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings October 15, 2025 21:33
Copy link
Copy Markdown

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 PR addresses a date conversion error in the Spanish special prorate functionality by refactoring and centralizing the prorate context handling. The changes consolidate duplicated prorate context logic into a single method on the account.tax model and fix parameter type mismatches.

  • Centralized prorate context handling into a single method with proper date validation
  • Removed duplicate prorate_context functions across multiple modules
  • Fixed parameter type consistency (company_id integer to company object)

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
l10n_es_special_prorate/models/account_tax.py Added centralized prorate_context method with date validation and removed duplicate function
l10n_es_aeat_vat_special_prorrate_purchase/models/purchase_order.py Removed duplicate prorate_context function and updated calls to use centralized method
l10n_es_aeat_vat_special_prorrate/models/account_move.py Removed duplicate prorate_context function and updated calls to use centralized method
account_asset_non_deductible/models/account_move.py Updated parameter from company_id integer to company object for consistency

@@ -1,19 +1,13 @@
# Copyright NuoBiT - Eric Antones <eantones@nuobit.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
import datetime
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

There should be exactly 2 blank lines between the imports and the start of the code, but there's only 1 blank line after the import statement.

Copilot generated this review using guidance from repository custom instructions.
)
}

def get_non_deductible_percent(self, date, company, is_refund):
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

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

The method signature change from company_id to company should be documented or have a docstring explaining the expected parameter type, especially since this appears to be a public API method.

Suggested change
def get_non_deductible_percent(self, date, company, is_refund):
def get_non_deductible_percent(self, date, company, is_refund):
"""
Calculate the non-deductible percent for the given tax record(s).
Args:
date (datetime.date or datetime.datetime): The date for the calculation.
company (res.company recordset): The company for which to calculate. Should be a single record.
is_refund (bool): Whether the calculation is for a refund.
Returns:
float: The non-deductible percent value.
"""

Copilot uses AI. Check for mistakes.
@eantones eantones merged commit bda03c6 into 14.0 Oct 15, 2025
11 checks passed
@eantones eantones deleted the 14.0-fix-prorrate-error_on_date_conversion branch October 15, 2025 21:46
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