Skip to content
Open
1 change: 1 addition & 0 deletions product_abc_classification_finance/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions product_abc_classification_finance/__manifest__.py
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,
Copy link
Contributor

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 😏

}
3 changes: 3 additions & 0 deletions product_abc_classification_finance/models/__init__.py
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
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",
)

Large diffs are not rendered by default.

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)
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
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>
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>
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>
Loading