diff --git a/new_product_type/__init__.py b/new_product_type/__init__.py
new file mode 100644
index 00000000000..9b4296142f4
--- /dev/null
+++ b/new_product_type/__init__.py
@@ -0,0 +1,2 @@
+from . import models
+from . import wizard
diff --git a/new_product_type/__manifest__.py b/new_product_type/__manifest__.py
new file mode 100644
index 00000000000..4689913dddf
--- /dev/null
+++ b/new_product_type/__manifest__.py
@@ -0,0 +1,20 @@
+{
+ 'name': 'New Product Type',
+ 'author': 'Aditi Pawar(adpaw)',
+ 'license': 'LGPL-3',
+ 'summary': 'Sell products as kits without Manufacturing or BoM',
+ 'depends': [
+ "sale", "product", "account"
+ ],
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'views/product_views.xml',
+ 'views/sale_order_line_views.xml',
+ 'views/sale_kit_wizard_views.xml',
+ 'report/invoice_report.xml',
+ 'report/sale_order_portal_report.xml',
+ 'report/sale_order_report.xml'
+ ],
+ 'installable': True,
+ 'auto_install': True
+}
diff --git a/new_product_type/models/__init__.py b/new_product_type/models/__init__.py
new file mode 100644
index 00000000000..8f2f8c0cbc1
--- /dev/null
+++ b/new_product_type/models/__init__.py
@@ -0,0 +1,3 @@
+from . import product_template
+from . import sale_order_line
+from . import sale_order
diff --git a/new_product_type/models/product_template.py b/new_product_type/models/product_template.py
new file mode 100644
index 00000000000..3375fc94ee2
--- /dev/null
+++ b/new_product_type/models/product_template.py
@@ -0,0 +1,15 @@
+from odoo import models, fields, api
+from odoo.exceptions import ValidationError
+
+
+class ProductTemplate(models.Model):
+ _inherit = 'product.template'
+
+ is_kit = fields.Boolean(string='Is Kit', default=False)
+ sub_product_ids = fields.Many2many('product.product', 'product_template_kit_component_rel')
+
+ @api.constrains("sub_product_ids")
+ def _check_no_self_product_reference(self):
+ for record in self:
+ if record.product_variant_ids in record.sub_product_ids:
+ raise ValidationError("A product cannot be added as a sub-product in its own kit.")
diff --git a/new_product_type/models/sale_order.py b/new_product_type/models/sale_order.py
new file mode 100644
index 00000000000..353818e35b6
--- /dev/null
+++ b/new_product_type/models/sale_order.py
@@ -0,0 +1,20 @@
+from odoo import models, fields, api
+
+
+class SaleOrder(models.Model):
+ _inherit = 'sale.order'
+
+ has_kit_products = fields.Boolean(
+ compute='_compute_has_kit_products',
+ store=False
+ )
+
+ print_kit_in_report = fields.Boolean(
+ string="Print Kit Components in Report",
+ default=False
+ )
+
+ @api.depends('order_line.is_kit_line')
+ def _compute_has_kit_products(self):
+ for order in self:
+ order.has_kit_products = any(line.is_kit_line for line in order.order_line)
diff --git a/new_product_type/models/sale_order_line.py b/new_product_type/models/sale_order_line.py
new file mode 100644
index 00000000000..b635b41b884
--- /dev/null
+++ b/new_product_type/models/sale_order_line.py
@@ -0,0 +1,33 @@
+from odoo import models, fields, api
+from odoo.exceptions import UserError
+
+
+class SaleOrderLine(models.Model):
+ _inherit = 'sale.order.line'
+
+ is_kit_line = fields.Boolean(related='product_id.product_tmpl_id.is_kit', store=True)
+ is_kit_sub_line = fields.Boolean(default=False)
+ kit_main_line_id = fields.Many2one('sale.order.line', string='Kit Main Line', ondelete='cascade')
+ kit_unit_price = fields.Float(default=0.0)
+
+ @api.ondelete(at_uninstall=False)
+ def _check_sub_kit_product(self):
+ for line in self:
+ if line.is_kit_sub_line:
+ raise UserError(
+ "You cannot delete a kit sub-product line directly. "
+ "Delete the main kit product line instead."
+ )
+
+ def action_open_kit_wizard(self):
+ self.ensure_one()
+ return {
+ 'type': 'ir.actions.act_window',
+ 'name': 'Kit Sub Products',
+ 'res_model': 'sale.kit.wizard',
+ 'view_mode': 'form',
+ 'target': 'new',
+ 'context': {
+ 'default_order_line_id': self.id,
+ },
+ }
diff --git a/new_product_type/report/invoice_report.xml b/new_product_type/report/invoice_report.xml
new file mode 100644
index 00000000000..5affdddc46a
--- /dev/null
+++ b/new_product_type/report/invoice_report.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+ o._get_move_lines_to_report().filtered(
+ lambda l: not any(sl.is_kit_sub_line for sl in l.sale_line_ids)
+ or any(sl.order_id.print_kit_in_report for sl in l.sale_line_ids)
+ )
+
+
+
+
diff --git a/new_product_type/report/sale_order_portal_report.xml b/new_product_type/report/sale_order_portal_report.xml
new file mode 100644
index 00000000000..650a1e906d9
--- /dev/null
+++ b/new_product_type/report/sale_order_portal_report.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ sale_order._get_order_lines_to_report().filtered(
+ lambda l: not l.is_kit_sub_line or sale_order.print_kit_in_report
+ )
+
+
+
+
\ No newline at end of file
diff --git a/new_product_type/report/sale_order_report.xml b/new_product_type/report/sale_order_report.xml
new file mode 100644
index 00000000000..38294cd59c4
--- /dev/null
+++ b/new_product_type/report/sale_order_report.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ doc._get_order_lines_to_report().filtered(
+ lambda l: not l.is_kit_sub_line or doc.print_kit_in_report
+ )
+
+
+
+
\ No newline at end of file
diff --git a/new_product_type/security/ir.model.access.csv b/new_product_type/security/ir.model.access.csv
new file mode 100644
index 00000000000..1e3cd7337d6
--- /dev/null
+++ b/new_product_type/security/ir.model.access.csv
@@ -0,0 +1,3 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_sale_kit_wizard,sale.kit.wizard,model_sale_kit_wizard,base.group_user,1,1,1,1
+access_sale_kit_wizard_line,sale.kit.wizard.line,model_sale_kit_wizard_line,base.group_user,1,1,1,1
diff --git a/new_product_type/views/product_views.xml b/new_product_type/views/product_views.xml
new file mode 100644
index 00000000000..8179f19148a
--- /dev/null
+++ b/new_product_type/views/product_views.xml
@@ -0,0 +1,17 @@
+
+
+
+ product.template.form.kit.inherit
+ product.template
+
+
+
+
+
+
+
+
+
+
+
diff --git a/new_product_type/views/sale_kit_wizard_views.xml b/new_product_type/views/sale_kit_wizard_views.xml
new file mode 100644
index 00000000000..a28ada76bdb
--- /dev/null
+++ b/new_product_type/views/sale_kit_wizard_views.xml
@@ -0,0 +1,34 @@
+
+
+
+ sale.kit.wizard.form
+ sale.kit.wizard
+
+
+
+
+
diff --git a/new_product_type/views/sale_order_line_views.xml b/new_product_type/views/sale_order_line_views.xml
new file mode 100644
index 00000000000..c2a912b49c6
--- /dev/null
+++ b/new_product_type/views/sale_order_line_views.xml
@@ -0,0 +1,36 @@
+
+
+ sale.order.line.kit.button.inherit
+ sale.order
+
+
+
+
+
+
+
+
+
+ is_kit_sub_line
+
+
+ is_kit_sub_line
+
+
+ is_kit_sub_line
+
+
+ is_kit_sub_line
+
+
+ is_kit_sub_line
+
+
+
+
diff --git a/new_product_type/wizard/__init__.py b/new_product_type/wizard/__init__.py
new file mode 100644
index 00000000000..6262d98c334
--- /dev/null
+++ b/new_product_type/wizard/__init__.py
@@ -0,0 +1,2 @@
+from . import sale_kit_wizard
+from . import sale_kit_wizard_line
diff --git a/new_product_type/wizard/sale_kit_wizard.py b/new_product_type/wizard/sale_kit_wizard.py
new file mode 100644
index 00000000000..eee78049c15
--- /dev/null
+++ b/new_product_type/wizard/sale_kit_wizard.py
@@ -0,0 +1,89 @@
+from odoo import models, fields, api
+from odoo.fields import Command
+
+
+class SaleKitWizard(models.TransientModel):
+ _name = 'sale.kit.wizard'
+ _description = 'Sale Kit Sub Products Wizard'
+
+ order_line_id = fields.Many2one('sale.order.line', string='Order Line', required=True)
+ product_id = fields.Many2one('product.template', string='Product')
+ wizard_line_ids = fields.One2many(
+ 'sale.kit.wizard.line',
+ inverse_name='wizard_id',
+ string='Sub Products',
+ )
+
+ @api.model
+ def default_get(self, fields_list):
+ res = super().default_get(fields_list)
+
+ active_model = self.env.context.get('active_model')
+ active_id = self.env.context.get('active_id')
+
+ if active_model != 'sale.order.line' or not active_id:
+ return res
+
+ sale_line = self.env['sale.order.line'].browse(active_id)
+ if not sale_line.product_id:
+ return res
+
+ product = sale_line.product_id
+ kit_sub_product = []
+
+ for sub in product.product_tmpl_id.sub_product_ids:
+ existing_line = sale_line.order_id.order_line.filtered(
+ lambda line: line.product_id == sub
+ and line.kit_main_line_id == sale_line
+ )
+ kit_sub_product.append(
+ Command.create({
+ 'product_id': sub.id,
+ 'quantity': existing_line.product_uom_qty
+ if existing_line else 1.0,
+ 'price': existing_line.kit_unit_price
+ if existing_line else sub.lst_price,
+ })
+ )
+
+ res.update({
+ 'product_id': product.product_tmpl_id.id,
+ 'order_line_id': sale_line.id,
+ 'wizard_line_ids': kit_sub_product,
+ })
+ return res
+
+ def action_confirm_kit(self):
+ self.ensure_one()
+
+ parent_line = self.order_line_id
+ order = parent_line.order_id
+ total_price = parent_line.product_id.lst_price
+
+ for wiz_line in self.wizard_line_ids:
+ existing_line = order.order_line.filtered(
+ lambda line: line.product_id == wiz_line.product_id
+ and line.kit_main_line_id == parent_line
+ )
+
+ values = {
+ 'product_uom_qty': wiz_line.quantity,
+ 'price_unit': 0.0,
+ 'kit_unit_price': wiz_line.price,
+ 'sequence': parent_line.sequence,
+ }
+
+ if existing_line:
+ existing_line.write(values)
+ else:
+ self.env['sale.order.line'].create({
+ **values,
+ 'name': wiz_line.product_id.name,
+ 'order_id': order.id,
+ 'product_id': wiz_line.product_id.id,
+ 'is_kit_sub_line': True,
+ 'kit_main_line_id': parent_line.id,
+ })
+ total_price += wiz_line.price * wiz_line.quantity
+ parent_line.write({'price_unit': total_price})
+ return {'type': 'ir.actions.act_window_close'}
diff --git a/new_product_type/wizard/sale_kit_wizard_line.py b/new_product_type/wizard/sale_kit_wizard_line.py
new file mode 100644
index 00000000000..c6833962043
--- /dev/null
+++ b/new_product_type/wizard/sale_kit_wizard_line.py
@@ -0,0 +1,11 @@
+from odoo import models, fields
+
+
+class SaleKitWizardLine(models.TransientModel):
+ _name = 'sale.kit.wizard.line'
+ _description = 'Sale Kit Wizard Line'
+
+ wizard_id = fields.Many2one('sale.kit.wizard', required=True, ondelete='cascade')
+ product_id = fields.Many2one('product.product', string='Product')
+ quantity = fields.Float(default=1.0, digits=(16, 2))
+ price = fields.Float(digits=(16, 2))