[19.0][MIG] sale_commission_oca_product_criteria: Migration to 19.0 - #683
Open
AungKoKoLin1997 wants to merge 29 commits into
Open
[19.0][MIG] sale_commission_oca_product_criteria: Migration to 19.0#683AungKoKoLin1997 wants to merge 29 commits into
AungKoKoLin1997 wants to merge 29 commits into
Conversation
Currently translated at 100.0% (65 of 65 strings) Translation: commission-16.0/commission-16.0-sale_commission_product_criteria Translate-URL: https://translation.odoo-community.org/projects/commission-16-0/commission-16-0-sale_commission_product_criteria/it/
Currently translated at 100.0% (63 of 63 strings) Translation: commission-18.0/commission-18.0-sale_commission_oca_product_criteria Translate-URL: https://translation.odoo-community.org/projects/commission-18-0/commission-18-0-sale_commission_oca_product_criteria/it/
Currently translated at 100.0% (63 of 63 strings) Translation: commission-18.0/commission-18.0-sale_commission_oca_product_criteria Translate-URL: https://translation.odoo-community.org/projects/commission-18-0/commission-18-0-sale_commission_oca_product_criteria/pt_BR/
AungKoKoLin1997
force-pushed
the
19.0-mig-sale_commission_oca_product_criteria
branch
from
July 23, 2026 09:16
2acae6b to
695dc85
Compare
yostashiro
reviewed
Jul 24, 2026
yostashiro
left a comment
Member
There was a problem hiding this comment.
@AungKoKoLin1997 Not migration issues, but can you take this chance to fix these points.
AungKoKoLin1997
force-pushed
the
19.0-mig-sale_commission_oca_product_criteria
branch
2 times, most recently
from
July 28, 2026 08:23
ca3e2ad to
640cf3c
Compare
kanda999
reviewed
Jul 28, 2026
AungKoKoLin1997
force-pushed
the
19.0-mig-sale_commission_oca_product_criteria
branch
2 times, most recently
from
July 28, 2026 09:47
43ca06e to
2c42a64
Compare
AungKoKoLin1997
force-pushed
the
19.0-mig-sale_commission_oca_product_criteria
branch
4 times, most recently
from
July 30, 2026 03:17
9c56b5d to
d4b5d0e
Compare
AungKoKoLin1997
force-pushed
the
19.0-mig-sale_commission_oca_product_criteria
branch
from
August 14, 2026 07:20
d4b5d0e to
5a14621
Compare
… validity Add optional conditions to commission items, following the same pattern as pricelist items: - per_unit: when checked on a fixed-amount rule, the amount is multiplied by the line quantity instead of being a flat fee. The displayed value gets a "/ unit" suffix so it can be told apart from a flat fee in the item list and on the settlement report. - min_qty: minimum quantity threshold; a rule without minimum quantity always applies, and when several rules match at the same level, the highest applicable minimum quantity wins (min_qty is part of _order, as it is on pricelist items). - date_start / date_end: restrict a rule to a validity period, displayed as a daterange widget. Both quantities are expressed in the reference UoM of the product, as pricelist item quantities are, so a line sold in a different UoM is converted before being compared or multiplied. This also makes the net amount base subtract the product cost per reference unit. Lines without a product, which get an agent line as well, keep their own quantity. Fixed amounts are set in the currency of the company of the item, so they are converted into the currency of the document at the date the item is matched against. The mismatch was already there for a flat fee, but a per unit amount multiplies it by the quantity. All the conditions are part of the item domain, so the best matching item is still fetched as a single row ordered by the model. The date it is matched against is the invoice date, or the order date converted in the company timezone so that the stored amount doesn't depend on the timezone of the user recomputing it. Both dates are declared in the amount dependencies, to recompute the stored amount once they are set. Commission items are also restricted to the companies of the user with a record rule, as the model already carries a company.
… its access Several defects of the module, none of them introduced by the port: - The applied commission item and commission were only stored once a matching item had been found, so a line kept showing the item that was applied before it stopped matching (expired validity, quantity below the minimum) or before its commission was changed to another type, while its amount was already recomputed to 0. Store them through _set_applied_commission() for every agent line, before the early return. - _get_single_commission_amount had no equivalent of the commission free check the base _get_commission_amount starts with, so a commission free product still earned on the product criteria path. The sale side amount did not depend on product_id.commission_free either, the way the invoice side already did, so it was not even recomputed. - The type change protection was an onchange, so it only ran in the form view and a write coming from RPC, from an import or from an automation silently orphaned the applied items. Check it on write instead, on the records whose type the write really changes: a constraint would also reject an import or a data file rewriting the type with the value it already holds. The searches are sudoed, as an applied commission has to block the change even when the documents it is applied on belong to another company. - _check_product_consistency did not watch applied_on, so it only ran because validate_values happens to inject one of the product fields in every one of its branches. - _get_single_commission_amount returned None for a commission type it does not know, which would be stored as the amount of the line, and the displayed value of the item was left unassigned for it, which raises instead of simply displaying no value. - The settlement report prints the fields of the applied item, and they are read as the user printing it, not as superuser the way the stored amount is. An invoicing or commission user without a sale group could therefore not print a settlement at all. - Drop commission_item_action, which no menu, no binding and no code refers to: the menu uses commission_item_action_tree.
AungKoKoLin1997
force-pushed
the
19.0-mig-sale_commission_oca_product_criteria
branch
from
August 14, 2026 07:28
5a14621 to
1a5ec57
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR includes:
Standard migration
Minor fixes
Add optional conditions to commission items, following the same pattern
as pricelist items:
multiplied by the line quantity instead of being a flat fee.
the same level, the highest applicable minimum quantity wins.
displayed as a daterange widget.
@qrtl QT7017