From ae57fc807d4c5285162102a5eec23a4c9d9ef95d Mon Sep 17 00:00:00 2001 From: shsak-odoo Date: Fri, 9 Jan 2026 18:18:57 +0530 Subject: [PATCH] [ADD] product_as_kit: create new module to add new type to the product - inherits product.template model to add isKit and sub_products fields - inherits product template form view to show kit fields in ui --- .gitignore | 7 +++++++ product_as_kit/__init__.py | 1 + product_as_kit/__manifest__.py | 14 ++++++++++++++ product_as_kit/models/__init__.py | 1 + product_as_kit/models/product_template.py | 8 ++++++++ product_as_kit/views/product_template_views.xml | 13 +++++++++++++ 6 files changed, 44 insertions(+) create mode 100644 product_as_kit/__init__.py create mode 100644 product_as_kit/__manifest__.py create mode 100644 product_as_kit/models/__init__.py create mode 100644 product_as_kit/models/product_template.py create mode 100644 product_as_kit/views/product_template_views.xml diff --git a/.gitignore b/.gitignore index b6e47617de1..f79670dfc2e 100644 --- a/.gitignore +++ b/.gitignore @@ -127,3 +127,10 @@ dmypy.json # Pyre type checker .pyre/ + +node_modules +.eslintignore +.eslintrc.json +jsconfig.json +package-lock.json +package.json diff --git a/product_as_kit/__init__.py b/product_as_kit/__init__.py new file mode 100644 index 00000000000..0650744f6bc --- /dev/null +++ b/product_as_kit/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/product_as_kit/__manifest__.py b/product_as_kit/__manifest__.py new file mode 100644 index 00000000000..d59130db264 --- /dev/null +++ b/product_as_kit/__manifest__.py @@ -0,0 +1,14 @@ +{ + "name": "Product as Kit", + "version": "1.0", + "depends": ["product", "sale_management"], + "author": "Shivam Saksham(shsak)", + "category": "Sales", + "description": """ + An module to let the product be sold as kit. + """, + "license": "LGPL-3", + "data": [ + "views/product_template_views.xml", + ], +} diff --git a/product_as_kit/models/__init__.py b/product_as_kit/models/__init__.py new file mode 100644 index 00000000000..e8fa8f6bf1e --- /dev/null +++ b/product_as_kit/models/__init__.py @@ -0,0 +1 @@ +from . import product_template diff --git a/product_as_kit/models/product_template.py b/product_as_kit/models/product_template.py new file mode 100644 index 00000000000..2b65ee246c5 --- /dev/null +++ b/product_as_kit/models/product_template.py @@ -0,0 +1,8 @@ +from odoo import fields, models + + +class ProductTemplate(models.Model): + _inherit = 'product.template' + + isKit = fields.Boolean(default=False) + sub_products = fields.Many2many('product.product') diff --git a/product_as_kit/views/product_template_views.xml b/product_as_kit/views/product_template_views.xml new file mode 100644 index 00000000000..10d98e771d0 --- /dev/null +++ b/product_as_kit/views/product_template_views.xml @@ -0,0 +1,13 @@ + + + product.template.form.inherit.product.as.kit + product.template + + + + + + + + +