Skip to content

Commit

Permalink
[ADD] account_move_line_product_category
Browse files Browse the repository at this point in the history
  • Loading branch information
unaiberis authored and anajuaristi committed Nov 21, 2024
1 parent a4b9c34 commit c340b27
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 0 deletions.
74 changes: 74 additions & 0 deletions account_move_line_product_category/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl-3.0.html
:alt: License: AGPL-3

==================================
Account Move Line Product Category
==================================

Overview
========

The **Account Move Line Product Category** module adds the product category field to invoice lines, allowing users to easily view and filter by product categories in the invoice line pivot views. This provides better insight into sales and accounting data, especially when analyzing performance by product categories.

Features
========

- **Product Category Field**: Adds the product category field to invoice lines, which is automatically related to the product's category.
- **Enhanced Pivot Views**: The product category field is available in pivot views for better reporting and analysis.

Usage
=====

1. **Install the Module**:

- Install the module via Odoo's Apps interface.

2. **Viewing Product Category on Invoice Lines**:

- Navigate to **Accounting > Customers > Invoices**.
- Open an invoice and view the **Product Category** field in the line items.

3. **Reporting**:

- In the pivot view of invoice lines, you can now group or filter data by **Product Category** to analyze sales performance by category.

Configuration
=============

No additional configuration is required. The product category field is automatically populated from the related product's category.

Testing
=======

Test the following scenarios:

- **Product Category on Invoice Lines**:

- Create an invoice with products that belong to different categories.
- Verify that the **Product Category** field is correctly displayed and populated for each product in the invoice lines.

- **Pivot View**:

- Go to the pivot view of invoice lines and confirm that the **Product Category** field is available for grouping and filtering data.

Bug Tracker
===========

If you encounter any issues, please report them on the GitHub repository at `GitHub Issues <https://github.com/avanzosc/odoo-addons/issues>`_.

Credits
=======

Contributors
------------

* Unai Beristain <[email protected]>
* Ana Juaristi <[email protected]>

For module-specific questions, please contact the contributors directly. Support requests should be made through the official channels.

License
=======

This project is licensed under the AGPL-3 License. For more details, please refer to the LICENSE file or visit <https://www.gnu.org/licenses/agpl-3.0.html>.
1 change: 1 addition & 0 deletions account_move_line_product_category/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
18 changes: 18 additions & 0 deletions account_move_line_product_category/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "Account Move Line Product Category>",
"version": "14.0.1.0.0",
"summary": "Adds product category and manufacturer fields"
"to invoice lines pivot views.",
"category": "Accounting",
"author": "Avanzosc",
"website": "https://github.com/avanzosc/odoo-addons",
"license": "AGPL-3",
"depends": [
"account",
"product",
],
"data": [
"views/account_move_line_views.xml",
],
"installable": True,
}
1 change: 1 addition & 0 deletions account_move_line_product_category/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import account_move_line
11 changes: 11 additions & 0 deletions account_move_line_product_category/models/account_move_line.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from odoo import fields, models


class AccountMoveLine(models.Model):
_inherit = "account.move.line"

product_category_id = fields.Many2one(
related="product_id.categ_id",
string="Product Category",
store=True,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_move_line_tree_inherit" model="ir.ui.view">
<field
name="name"
>account.move.line.tree.inherit.product.category.manufacturer</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree" />
<field name="arch" type="xml">
<xpath expr="//tree" position="inside">
<field name="product_category_id" optional="show" />
</xpath>
</field>
</record>
</odoo>
6 changes: 6 additions & 0 deletions setup/account_move_line_product_category/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

0 comments on commit c340b27

Please sign in to comment.