[14.0][FIX+REF] prorrate error on date conversion#757
Conversation
…rate context structure
…e prorate context structure
…d reusable prorate context structure
…context structure
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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.
| ) | ||
| } | ||
|
|
||
| def get_non_deductible_percent(self, date, company, is_refund): |
There was a problem hiding this comment.
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.
| 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. | |
| """ |
No description provided.