Stock Analytic Rule
stock_analytic_rule · OCA/account-analytic
-
Security25/25No findings
-
Activity25/25Last human commit 1 month ago
-
Required by5/250 modules depend on it
-
Maturity5/25In 1 Odoo series since 17.0
Heuristic over the facts below, not an audit · How it's computed
Migration considerations
view_stock_analytic_rule_tree— Migrating to 18.0: the `tree` view type was renamed to `list` (`<list>` roots, `view_mode`). migration-view-tree-tag · source
Migration review checklist, not a compatibility verdict. "Migrating to X.0" applies once you upgrade to that version; "Since X.0" means this version already ignores or rejects that code. Methodology
Description
This module extends the stock and analytic accounting capabilities by automatically creating analytic lines from stock based on configurable rules.
Key features:
- Define stock movement rules by source and destination locations.
- Compute analytic line amounts using either:
- Product list price.
- Category-based formula:
(avg_price * (avg_weight * qty)) + ((avg_weight * qty) * supplement)
- Support for positive and negative analytic distributions.
- Handles partial distributions and multi-account combinations.
- Supports return pickings and reversal analytic lines.
- Fully compatible with analytic plans and multidimensional analytic accounting.
The module is useful for organizations needing precise analytic accounting for inventory movements, such as manufacturing, logistics, or services.
Dependencies
Code analysis
Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.
Views touched 5
| XML ID | Name | Model | Type | Status |
|---|---|---|---|---|
product_category_form_inherit |
product.category.form.inherit | product.category | form | Inherits product.product_category_form_view |
view_account_analytic_line_form_inherit |
view.account.analytic.line.form.inherit | account.analytic.line | form | Inherits analytic.view_account_analytic_line_form |
view_stock_analytic_rule_form |
stock.analytic.rule.form | stock.analytic.rule | form | New |
view_stock_analytic_rule_search |
stock.analytic.rule.search | stock.analytic.rule | search | New |
view_stock_analytic_rule_tree |
stock.analytic.rule.tree | stock.analytic.rule | tree | New |
HTTP endpoints 0
No HTTP endpoints found for this module.
Models touched 4
-
stock_move_idMany2one → stock.moveondelete='cascade'string='Stock Move' args: 'stock.move'
No public methods.
-
avg_priceFloatdigits=(16, 2)help='This field is used to store the average price of the products'string='Average Price' -
avg_price_for_internal_movesFloatdigits=(16, 2)help='This field is used to store the average price of\n the products for internal moves'string='Average Price for Internal Moves' -
avg_weightFloatdigits=(16, 2)help='This field is used to store the average weight of the products'string='Average Weight' -
avg_weight_for_internal_movesFloatdigits=(16, 2)help='This field is used to store the average weight of\n the products for internal moves'string='Average Weight for Internal Moves' -
custom_computation_for_internal_movesBooleanhelp='If checked, the average price and weight for\n internal moves will be used instead of the standard ones'string='Custom Computation for Internal Moves' -
supplementFloatdigits=(16, 2)help='This field is used to supplement the cost of the product'
No public methods.
-
activeBooleandefault=True -
amount_compute_typeSelectiondefault='category'help="\n Category: The amount is computed based on the product's\n category avg price, avg weight, and supplement.\n Product: The amount is computed based on the product's price.\n "required=Truestring='Compute amount by' args: [('category', _('Category')), ('product', _('Product'))] -
analytic_distribution_negativeJsoncompute='_compute_analytic_distribution'copy=Truereadonly=Falsestore=True args: 'Negative Analytic Distribution' -
applicable_category_idsMany2many → product.categorycolumn1='rule_id'column2='category_id'comodel_name='product.category'help='If set, the rule will only be applied to products of these categories.'relation='stock_analytic_rule_category_rel'string='Applicable Categories' -
company_idMany2one → res.companydefault=<expr>required=True args: 'res.company' -
financial_account_idMany2one → account.accountdomain=[('deprecated', '=', False)]help='Financial account to use for the analytic lines.'string='Financial Account' args: 'account.account' -
include_taxesBooleandefault=Falsehelp='If checked, the amount will include taxes when computed by product.' -
location_dest_idsMany2many → stock.locationstring='To' args: 'stock.location', 'stock_analytic_model_location_dest_rel', 'model_id', 'location_id' -
location_from_idsMany2many → stock.locationstring='From' args: 'stock.location', 'stock_analytic_model_location_from_rel', 'model_id', 'location_id' -
mandatoryBooleanhelp="If checked, couldn't validate a stock move if it doesn't generate analytic lines." -
nameChar
-
action_open_form(self) -
copy(self, default=None) -
generate_analytic_lines(self, stock_move)@api.modelGenerates analytic lines based on matching stock analytic rules. -
write(self, vals)
No new fields.
Public methods (2)-
create(self, vals_list)@api.model_create_multi -
write(self, vals)