-
-
Notifications
You must be signed in to change notification settings - Fork 794
[ADD] product_abc_classification_finance: Classification by cost and sale price #2002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AJamal13
wants to merge
10
commits into
OCA:16.0
Choose a base branch
from
AJamal13:16.0
base: 16.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8082462
Adding classification by Cost/Sale Price/Sale Margin
AJamal13 46950db
Update __manifest__.py
AJamal13 6b01962
Merge branch 'OCA:16.0' into 16.0
AJamal13 fd51b29
Add demo data and tests for finance ABC classification
AJamal13 0d86ee5
fix checks
AJamal13 5ca0af0
Add tests for finance profile validation and margin exclusion
AJamal13 e1d7e1e
Add tests for finance profile validation and margin exclusion
AJamal13 f77be24
Revert "Add tests for finance profile validation and margin exclusion"
AJamal13 80c175d
Merge branch '16.0' of https://github.com/AJamal13/product-attribute …
AJamal13 9581799
product_abc_classification_finance
AJamal13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import models |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "name": "Product ABC Classification Finance", | ||
| "summary": "Financial ABC analysis for products (cost, sale price, margin)", | ||
| "version": "16.0.1.0.2", | ||
| "category": "Inventory/Inventory", | ||
| "author": "AJamal13,Odoo Community Association (OCA)", | ||
| "license": "AGPL-3", | ||
| "website": "https://github.com/OCA/product-attribute", | ||
| "depends": ["product_abc_classification_sale_stock","sale_margin"], | ||
| "data": [ | ||
| "security/ir.model.access.csv", | ||
| "views/abc_finance_sale_level_history_views.xml", | ||
| "views/abc_classification_product_level_views.xml", | ||
| "views/abc_classification_profile.xml", | ||
| ], | ||
| "installable": True, | ||
| "application": False, | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from . import abc_classification_profile | ||
| from . import abc_classification_product_level | ||
| from . import abc_finance_sale_level_history |
9 changes: 9 additions & 0 deletions
9
product_abc_classification_finance/models/abc_classification_product_level.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from odoo import fields, models | ||
|
|
||
| class AbcClassificationProductLevel(models.Model): | ||
| _inherit = "abc.classification.product.level" | ||
|
|
||
| finance_sale_level_history_ids = fields.One2many( | ||
| comodel_name="abc.finance.sale.level.history", | ||
| inverse_name="product_level_id", | ||
| ) |
391 changes: 391 additions & 0 deletions
391
product_abc_classification_finance/models/abc_classification_profile.py
Large diffs are not rendered by default.
Oops, something went wrong.
80 changes: 80 additions & 0 deletions
80
product_abc_classification_finance/models/abc_finance_sale_level_history.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| from odoo import fields, models | ||
|
|
||
| class AbcFinanceSaleLevelHistory(models.Model): | ||
| """Finance ABC Classification Product Level History""" | ||
| _name = "abc.finance.sale.level.history" | ||
| _description = "Abc Finance Sale Level History" | ||
|
|
||
| computed_level_id = fields.Many2one( | ||
| "abc.classification.level", | ||
| string="Computed classification level", | ||
| readonly=True, | ||
| ondelete="cascade", | ||
| ) | ||
| product_id = fields.Many2one( | ||
| "product.product", | ||
| string="Product", | ||
| index=True, | ||
| required=True, | ||
| readonly=True, | ||
| ondelete="cascade", | ||
| ) | ||
| product_tmpl_id = fields.Many2one( | ||
| "product.template", | ||
| string="Product template", | ||
| related="product_id.product_tmpl_id", | ||
| readonly=True, | ||
| store=True, | ||
| ) | ||
| purchase_price = fields.Float( | ||
| "Purchase price", | ||
| required=True, | ||
| readonly=True, | ||
| ) | ||
| margin = fields.Float( | ||
| "Margin", | ||
| required=True, | ||
| readonly=True, | ||
| ) | ||
| total_cost = fields.Float( | ||
| "Total cost", | ||
| required=True, | ||
| readonly=True, | ||
| ) | ||
| total_sales = fields.Float( | ||
| "Total sales", | ||
| required=True, | ||
| readonly=True, | ||
| ) | ||
| profile_id = fields.Many2one( | ||
| "abc.classification.profile", | ||
| string="Profile", | ||
| required=True, | ||
| readonly=True, | ||
| ondelete="cascade", | ||
| ) | ||
| warehouse_id = fields.Many2one( | ||
| "stock.warehouse", | ||
| string="Warehouse", | ||
| readonly=True, | ||
| ondelete="cascade", | ||
| ) | ||
| ranking = fields.Integer("Ranking", readonly=True) | ||
| percentage = fields.Float("Percentage", readonly=True) | ||
| cumulated_percentage = fields.Float("Cumulated Percentage", readonly=True) | ||
| standard_cost = fields.Float("Standard Cost", readonly=True) | ||
| total_cost = fields.Float("Total Cost", readonly=True) | ||
| total_sales = fields.Float("Total Sales", readonly=True) | ||
| margin = fields.Float("Margin", readonly=True) | ||
| product_level_id = fields.Many2one( | ||
| "abc.classification.product.level", | ||
| string="Product Level", | ||
| readonly=True, | ||
| ondelete="cascade", | ||
| ) | ||
| from_date = fields.Date(readonly=True) | ||
| to_date = fields.Date(readonly=True) | ||
| total_products = fields.Integer(readonly=True) | ||
| percentage_products = fields.Float(readonly=True) | ||
| cumulated_percentage_products = fields.Float(readonly=True) | ||
| sum_cumulated_percentages = fields.Float(readonly=True) |
2 changes: 2 additions & 0 deletions
2
product_abc_classification_finance/security/ir.model.access.csv
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
| access_abc_finance_sale_level_history,abc.finance.sale.level.history,model_abc_finance_sale_level_history,,1,0,0,0 |
30 changes: 30 additions & 0 deletions
30
product_abc_classification_finance/views/abc_classification_product_level_views.xml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <odoo> | ||
| <record id="view_abc_classification_product_level_tree" model="ir.ui.view"> | ||
| <field name="name">abc.classification.product.level.tree</field> | ||
| <field name="model">abc.classification.product.level</field> | ||
| <field name="arch" type="xml"> | ||
| <tree> | ||
| <field name="product_id"/> | ||
| <field name="profile_id"/> | ||
| <field name="computed_level_id"/> | ||
| <field name="finance_sale_level_history_ids"/> | ||
| </tree> | ||
| </field> | ||
| </record> | ||
| <record id="view_abc_classification_product_level_form" model="ir.ui.view"> | ||
| <field name="name">abc.classification.product.level.form</field> | ||
| <field name="model">abc.classification.product.level</field> | ||
| <field name="arch" type="xml"> | ||
| <form> | ||
| <sheet> | ||
| <group> | ||
| <field name="product_id"/> | ||
| <field name="profile_id"/> | ||
| <field name="computed_level_id"/> | ||
| <field name="finance_sale_level_history_ids"/> | ||
| </group> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
| </odoo> |
14 changes: 14 additions & 0 deletions
14
product_abc_classification_finance/views/abc_classification_profile.xml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0" encoding="UTF-8" ?> | ||
| <!-- License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
| <odoo> | ||
| <record id="abc_classification_profile_form_view_finance" model="ir.ui.view"> | ||
| <field name="name">abc.classification.profile.form (finance inherit)</field> | ||
| <field name="model">abc.classification.profile</field> | ||
| <field name="inherit_id" ref="product_abc_classification_sale_stock.abc_classification_profile_form_view"/> | ||
| <field name="arch" type="xml"> | ||
| <xpath expr="//field[@name='warehouse_id']" position="attributes"> | ||
| <attribute name="attrs">{'required': [('profile_type', 'in', ['sale_stock', 'cost', 'sale_price', 'margin'])], 'invisible': []}</attribute> | ||
| </xpath> | ||
| </field> | ||
| </record> | ||
| </odoo> |
61 changes: 61 additions & 0 deletions
61
product_abc_classification_finance/views/abc_finance_sale_level_history_views.xml
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| <odoo> | ||
| <record id="view_abc_finance_sale_level_history_tree" model="ir.ui.view"> | ||
| <field name="name">abc.finance.sale.level.history.tree</field> | ||
| <field name="model">abc.finance.sale.level.history</field> | ||
| <field name="arch" type="xml"> | ||
| <tree> | ||
| <field name="product_id"/> | ||
| <field name="product_tmpl_id"/> | ||
| <field name="profile_id"/> | ||
| <field name="computed_level_id"/> | ||
| <field name="warehouse_id"/> | ||
| <field name="ranking"/> | ||
| <field name="percentage"/> | ||
| <field name="cumulated_percentage"/> | ||
| <field name="standard_cost"/> | ||
| <field name="total_cost"/> | ||
| <field name="total_sales"/> | ||
| <field name="margin"/> | ||
| <field name="product_level_id"/> | ||
| <field name="from_date"/> | ||
| <field name="to_date"/> | ||
| <field name="total_products"/> | ||
| <field name="percentage_products"/> | ||
| <field name="cumulated_percentage_products"/> | ||
| <field name="sum_cumulated_percentages"/> | ||
| </tree> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="view_abc_finance_sale_level_history_form" model="ir.ui.view"> | ||
| <field name="name">abc.finance.sale.level.history.form</field> | ||
| <field name="model">abc.finance.sale.level.history</field> | ||
| <field name="arch" type="xml"> | ||
| <form> | ||
| <sheet> | ||
| <group> | ||
| <field name="product_id"/> | ||
| <field name="product_tmpl_id"/> | ||
| <field name="profile_id"/> | ||
| <field name="computed_level_id"/> | ||
| <field name="warehouse_id"/> | ||
| <field name="ranking"/> | ||
| <field name="percentage"/> | ||
| <field name="cumulated_percentage"/> | ||
| <field name="standard_cost"/> | ||
| <field name="total_cost"/> | ||
| <field name="total_sales"/> | ||
| <field name="margin"/> | ||
| <field name="product_level_id"/> | ||
| <field name="from_date"/> | ||
| <field name="to_date"/> | ||
| <field name="total_products"/> | ||
| <field name="percentage_products"/> | ||
| <field name="cumulated_percentage_products"/> | ||
| <field name="sum_cumulated_percentages"/> | ||
| </group> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
| </odoo> |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AJamal13 you should add yourself as the official maintainers 😏