summaryrefslogtreecommitdiff
path: root/addons/sale_product_configurator/wizard
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/sale_product_configurator/wizard
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/sale_product_configurator/wizard')
-rw-r--r--addons/sale_product_configurator/wizard/__init__.py4
-rw-r--r--addons/sale_product_configurator/wizard/sale_product_configurator.py21
-rw-r--r--addons/sale_product_configurator/wizard/sale_product_configurator_views.xml40
3 files changed, 65 insertions, 0 deletions
diff --git a/addons/sale_product_configurator/wizard/__init__.py b/addons/sale_product_configurator/wizard/__init__.py
new file mode 100644
index 00000000..a0eaada8
--- /dev/null
+++ b/addons/sale_product_configurator/wizard/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import sale_product_configurator
diff --git a/addons/sale_product_configurator/wizard/sale_product_configurator.py b/addons/sale_product_configurator/wizard/sale_product_configurator.py
new file mode 100644
index 00000000..4d636383
--- /dev/null
+++ b/addons/sale_product_configurator/wizard/sale_product_configurator.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import models, fields
+
+
+class SaleProductConfigurator(models.TransientModel):
+ _name = 'sale.product.configurator'
+ _description = 'Sale Product Configurator'
+
+ product_template_id = fields.Many2one(
+ 'product.template', string="Product",
+ required=True, domain=[('sale_ok', '=', True), ('attribute_line_ids.value_ids', '!=', False)])
+ quantity = fields.Integer('Quantity')
+ pricelist_id = fields.Many2one('product.pricelist', 'Pricelist', readonly=True)
+ product_template_attribute_value_ids = fields.Many2many(
+ 'product.template.attribute.value', 'product_configurator_template_attribute_value_rel', string='Attribute Values', readonly=True)
+ product_custom_attribute_value_ids = fields.Many2many(
+ 'product.attribute.custom.value', 'product_configurator_custom_attribute_value_rel', string="Custom Values")
+ product_no_variant_attribute_value_ids = fields.Many2many(
+ 'product.template.attribute.value', 'product_configurator_no_variant_attribute_value_rel', string="Extra Values")
diff --git a/addons/sale_product_configurator/wizard/sale_product_configurator_views.xml b/addons/sale_product_configurator/wizard/sale_product_configurator_views.xml
new file mode 100644
index 00000000..8c7cf016
--- /dev/null
+++ b/addons/sale_product_configurator/wizard/sale_product_configurator_views.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+<odoo>
+ <record id="sale_product_configurator_view_form" model="ir.ui.view">
+ <field name="name">sale_product_configurator.product.configurator.view.form</field>
+ <field name="model">sale.product.configurator</field>
+ <field name="arch" type="xml">
+ <form js_class="product_configurator_form">
+ <group>
+ <field name="product_template_id" class="oe_product_configurator_product_template_id" />
+ <field name="product_template_attribute_value_ids" invisible="1">
+ <tree limit="10000"/>
+ </field>
+ <field name="product_custom_attribute_value_ids" invisible="1" widget="one2many" >
+ <tree limit="10000">
+ <field name="custom_product_template_attribute_value_id"/>
+ <field name="custom_value"/>
+ </tree>
+ </field>
+ <field name="product_no_variant_attribute_value_ids" invisible="1">
+ <tree limit="10000"/>
+ </field>
+ <field name="quantity" invisible="1" />
+ </group>
+ <footer>
+ <button string="Add" class="btn-primary o_sale_product_configurator_add" special="add"/>
+ <button string="Save" class="btn-primary o_sale_product_configurator_edit" style="display: none;" special="save"/>
+ <button string="Cancel" class="btn-secondary" special="cancel"/>
+ </footer>
+ </form>
+ </field>
+ </record>
+
+ <record id="sale_product_configurator_action" model="ir.actions.act_window">
+ <field name="name">Configure a product</field>
+ <field name="res_model">sale.product.configurator</field>
+ <field name="view_mode">form</field>
+ <field name="target">new</field>
+ <field name="view_id" ref="sale_product_configurator_view_form"/>
+ </record>
+</odoo>