[MIG] sale_margin_percentage: Migration to 19.0 T#98917#1728
Open
JesusValdez96 wants to merge 17 commits intoVauxoo:19.0from
Open
[MIG] sale_margin_percentage: Migration to 19.0 T#98917#1728JesusValdez96 wants to merge 17 commits intoVauxoo:19.0from
JesusValdez96 wants to merge 17 commits intoVauxoo:19.0from
Conversation
By this way, the sale order gross margin percentage is calculated by the sum all the margin lines between the inverse sum of all subtotals. Module features: - Field to configure Margin Threshold on sale settings. - Colors in sale order lines to point the margin threshold. - Fix to 100 margin percentage when purchase price is not set. - Fix to -100 margin percentage when price unit is not set. Fix to 0 margin percentage when product quatity is 0.
The sale.config.settings view was changed completely after v10.0, in this fix we have moved margin_threshold field from old sale settings view to the new one.
The following is performed: - Added group for managing sales percentages. - Updated translations and test modifications. - Modifications made for test execution. - Added the 'for' attribute inside the labels.
Migration process from v12.0 to v15.0
So calculations work correctly.
To follow our good practices each model should be in its own file with the same name as the model.
… of native one The field margin_percentage is no longer needed since native module sale_margin have the field margin_percent that serve the same propose. Also the field margin_threshold must be updated since it was used as a percentage but the native field margin_percent is a ration so we must follow the same pattern.
There's a migration script to recompute sales marging on sale order lines, which was raising memory errors with databases that contain many lines. The following optimizations are applied: - Don't call compute method directly but mark the field to be computed. This avoids one write per record and makes the ORM to take care of batches. - Read currency directly from the line, instead of from the pricelist which in turn requires reading the order. - Don't read currency if quantity is zero as it won't be used anyway
This module was originally created in v11 for a specific customer, and the purchase price needed to be non-editable for some reason. Now the purchase price does not need to be non-editable. If it is needed, it should be managed in the view because the field is natively editable.
This commit migrates the sale_margin_percentage module to Odoo 19.0 with the following changes: - Adapt settings and sales views to the 19.0 architecture, replacing deprecated settings markup and updating order line list. - Add a stored margin alert helper to keep line decorations without relying on the restricted margin percent field in the view. - Update security and test definitions to match the newer API changes. - Remove the obsolete post-migration script and bump the module version to 19.0.1.0.0. Related to T#98917
f1302a3 to
2f72027
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 commit migrates the sale_margin_percentage module to version 19.0 with the following changes:
version to 19.0.1.0.0.
Related to T#98917