From dcb1bb909b76d01f6df4635e4adff3584f9cab12 Mon Sep 17 00:00:00 2001 From: Unai Beristain Date: Tue, 30 Jul 2024 11:29:52 +0200 Subject: [PATCH] [ADD] account_move_line_product_category --- account_move_line_product_category/README.rst | 42 +++++++++++++++++++ .../__init__.py | 1 + .../__manifest__.py | 18 ++++++++ .../models/__init__.py | 1 + .../models/account_move_line.py | 11 +++++ .../views/account_move_line_views.xml | 15 +++++++ .../addons/account_move_line_product_category | 1 + .../setup.py | 6 +++ 8 files changed, 95 insertions(+) create mode 100644 account_move_line_product_category/README.rst create mode 100644 account_move_line_product_category/__init__.py create mode 100644 account_move_line_product_category/__manifest__.py create mode 100644 account_move_line_product_category/models/__init__.py create mode 100644 account_move_line_product_category/models/account_move_line.py create mode 100644 account_move_line_product_category/views/account_move_line_views.xml create mode 120000 setup/account_move_line_product_category/odoo/addons/account_move_line_product_category create mode 100644 setup/account_move_line_product_category/setup.py diff --git a/account_move_line_product_category/README.rst b/account_move_line_product_category/README.rst new file mode 100644 index 0000000000..093275e0fa --- /dev/null +++ b/account_move_line_product_category/README.rst @@ -0,0 +1,42 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +============================= +Account Move Product Category +============================= + +This module extends the invoice and sale order line models to include fields for the product's category and manufacturer. It also modifies the pivot views and tree views to show these fields. + +Features +-------- + +- Adds `Product Category` and `Manufacturer` fields to the Account Move Line model. +- Updates the Invoice Line pivot view to include `Product Category` and `Manufacturer` fields. +- Updates the Invoice Line tree view to display `Product Category` and `Manufacturer` fields. + +Usage +----- + +- Go to Accounting -> Invoices -> Invoice Lines in the backend. +- You will see `Product Category` and `Manufacturer` columns in the invoice line view. + +License +------- + +This module is licensed under the AGPL-3 License. See `License Information `_ + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ +* Ana Juaristi +* Unai Beristain + +Do not contact contributors directly about support or help with technical issues. diff --git a/account_move_line_product_category/__init__.py b/account_move_line_product_category/__init__.py new file mode 100644 index 0000000000..0650744f6b --- /dev/null +++ b/account_move_line_product_category/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/account_move_line_product_category/__manifest__.py b/account_move_line_product_category/__manifest__.py new file mode 100644 index 0000000000..95bdda578d --- /dev/null +++ b/account_move_line_product_category/__manifest__.py @@ -0,0 +1,18 @@ +{ + "name": "Account Move 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, +} diff --git a/account_move_line_product_category/models/__init__.py b/account_move_line_product_category/models/__init__.py new file mode 100644 index 0000000000..8795b3bea6 --- /dev/null +++ b/account_move_line_product_category/models/__init__.py @@ -0,0 +1 @@ +from . import account_move_line diff --git a/account_move_line_product_category/models/account_move_line.py b/account_move_line_product_category/models/account_move_line.py new file mode 100644 index 0000000000..f2a482a81a --- /dev/null +++ b/account_move_line_product_category/models/account_move_line.py @@ -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, + ) diff --git a/account_move_line_product_category/views/account_move_line_views.xml b/account_move_line_product_category/views/account_move_line_views.xml new file mode 100644 index 0000000000..5b82b7c92f --- /dev/null +++ b/account_move_line_product_category/views/account_move_line_views.xml @@ -0,0 +1,15 @@ + + + + account.move.line.tree.inherit.product.category.manufacturer + account.move.line + + + + + + + + diff --git a/setup/account_move_line_product_category/odoo/addons/account_move_line_product_category b/setup/account_move_line_product_category/odoo/addons/account_move_line_product_category new file mode 120000 index 0000000000..c9f36d195f --- /dev/null +++ b/setup/account_move_line_product_category/odoo/addons/account_move_line_product_category @@ -0,0 +1 @@ +../../../../account_move_line_product_category \ No newline at end of file diff --git a/setup/account_move_line_product_category/setup.py b/setup/account_move_line_product_category/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/account_move_line_product_category/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)