← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~akretion-team/openerp-product-variant/product-variant-multi-attribute into lp:openerp-product-variant

 

Sébastien BEAU - http://www.akretion.com has proposed merging lp:~akretion-team/openerp-product-variant/product-variant-multi-attribute into lp:openerp-product-variant.

Requested reviews:
  Product Core Editors (product-core-editors)

For more details, see:
https://code.launchpad.net/~akretion-team/openerp-product-variant/product-variant-multi-attribute/+merge/223611

It's a total refactor of product variant multi.
The idea is too split the module in order to be more flexible.

As you can see a new concept have been added "Product display", this are the equivalent of "Configurable Product" on Magento side.

We do not map the "Product Template" with "Configurable Product" because it's not the same concept. Template are here for generating all of the variant, and the "Product Display" is just a way to show your product in a catalog.

For example, you can have 1 template (t-shirt color: red/yellow/blue size:S/M/L/XL) and then on magento you want to create 3 configurables products, one for each color. this case can be supported as you will create 3 displays from the product template.


-- 
https://code.launchpad.net/~akretion-team/openerp-product-variant/product-variant-multi-attribute/+merge/223611
Your team Product Core Editors is requested to review the proposed merge of lp:~akretion-team/openerp-product-variant/product-variant-multi-attribute into lp:openerp-product-variant.
=== added directory '__unported__'
=== renamed directory 'product_variant_multi_advanced' => '__unported__/product_variant_multi_advanced'
=== modified file '__unported__/product_variant_multi_advanced/__openerp__.py'
--- product_variant_multi_advanced/__openerp__.py	2013-09-19 11:46:57 +0000
+++ __unported__/product_variant_multi_advanced/__openerp__.py	2014-06-18 16:37:46 +0000
@@ -39,6 +39,6 @@
     'init_xml': [],
     'update_xml': ['product.xml'],
     'demo_xml': [],
-    'installable': True,
+    'installable': False,
     'active': False,
 }

=== modified file '__unported__/product_variant_multi_advanced/product.py'
--- product_variant_multi_advanced/product.py	2013-09-19 15:50:40 +0000
+++ __unported__/product_variant_multi_advanced/product.py	2014-06-18 16:37:46 +0000
@@ -41,13 +41,13 @@
 duplicated_fields = ['description_sale', 'name']
 
 
-class product_template(orm.Model):
+class ProductTemplate(orm.Model):
     _inherit = "product.template"
 
     def button_generate_variants(self, cr, uid, ids, context=None):
         if context is None:
             context = {}
-        super(product_template, self).button_generate_variants(cr, uid, ids, context=context)
+        super(ProductTemplate, self).button_generate_variants(cr, uid, ids, context=context)
         product_ids = self.get_products_from_product_template(cr, uid, ids, context=context)
         # generate/update sale description
         _logger.info("Starting to generate/update product sale descriptions...")
@@ -57,7 +57,7 @@
         return True
 
 
-class product_product(orm.Model):
+class ProductProduct(orm.Model):
     _inherit = "product.product"
 
     def write(self, cr, uid, ids, vals, context=None):
@@ -65,7 +65,7 @@
             ids = [ids]
         if context is None:
             context = {}
-        res = super(product_product, self).write(cr, uid, ids, vals.copy(), context=context)
+        res = super(ProductProduct, self).write(cr, uid, ids, vals.copy(), context=context)
 
         ids_simple = self.search(
             cr, uid,
@@ -98,7 +98,7 @@
         # and not on the product_product
 
         #take care to use vals.copy() if not the vals will be changed by calling the super method
-        ids = super(product_product, self).create(cr, uid, vals.copy(), context=context)
+        ids = super(ProductProduct, self).create(cr, uid, vals.copy(), context=context)
         ####### write the value in the product_product
         ctx = context.copy()
         ctx['iamthechild'] = True

=== added directory 'product_display'
=== added file 'product_display/__init__.py'
--- product_display/__init__.py	1970-01-01 00:00:00 +0000
+++ product_display/__init__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2013 Akretion (http://www.akretion.com).
+#   @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+import product

=== added file 'product_display/__openerp__.py'
--- product_display/__openerp__.py	1970-01-01 00:00:00 +0000
+++ product_display/__openerp__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Chafique Delli
+#    Copyright 2013 Akretion
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{'name' : 'Product Display',
+ 'version' : '1.0',
+ "author": "Akretion",
+ 'category': 'Sales Management',
+ 'description': """
+Product Display
+================
+
+A simple module for handling the product display.
+It provides view for product display,
+so they can be created manually. It doesn't provide
+all the bells and whistles of the product_variant_display
+module (creator wizards, ...).
+
+""",
+ 'author' : 'Akretion',
+ 'maintainer': 'Akretion',
+ 'website': 'http://www.akretion.com/',
+ 'depends' : [
+    'product',
+    ],
+ 'data': [
+    'product_view.xml',
+    ],
+ 'test': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'application': True,
+ }

=== added file 'product_display/product.py'
--- product_display/product.py	1970-01-01 00:00:00 +0000
+++ product_display/product.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2013 Akretion (http://www.akretion.com).
+#   @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+from openerp.osv import orm, fields
+
+
+class ProductProduct(orm.Model):
+    _inherit = 'product.product'
+
+    _columns = {
+        'display_for_product_ids': fields.many2many(
+            'product.product',
+            'product_template_option_rel',
+            'product_display_id',
+            'product_id',
+            string='Products'),
+        'display_ids': fields.many2many(
+            'product.product',
+            'product_template_option_rel',
+            'product_id',
+            'product_display_id',
+            string='Products Display'),
+        'is_display': fields.boolean('Is Display'),
+    }
+
+    _defaults = {
+        'is_display': False,
+    }

=== added file 'product_display/product_view.xml'
--- product_display/product_view.xml	1970-01-01 00:00:00 +0000
+++ product_display/product_view.xml	2014-06-18 16:37:46 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+
+        <!--Product Display -->
+
+        <record id="product_display_form_view" model="ir.ui.view">
+            <field name="name">product.display.form</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="product.product_normal_form_view" />
+            <field name="arch" type="xml">
+                <xpath expr="//label[@for='sale_ok']" position="after">
+                    <field name="is_display"/>
+                    <label for="is_display" />
+                </xpath>
+                <notebook position="inside">
+                    <page string="Product Display" attrs="{'invisible':[('is_display','=',False)]}">
+                        <group colspan="2" col="2">
+                            <field name="display_for_product_ids" nolabel="1"/>
+                        </group>
+                    </page>
+                </notebook>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== added directory 'product_variant_display_generator'
=== added file 'product_variant_display_generator/__init__.py'
--- product_variant_display_generator/__init__.py	1970-01-01 00:00:00 +0000
+++ product_variant_display_generator/__init__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2013 Akretion (http://www.akretion.com).
+#   @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+import product_variant_display

=== added file 'product_variant_display_generator/__openerp__.py'
--- product_variant_display_generator/__openerp__.py	1970-01-01 00:00:00 +0000
+++ product_variant_display_generator/__openerp__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2013 Akretion (http://www.akretion.com).
+#   @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+{
+    "name": "Product Variant Display Generator",
+    "version": "1.0",
+    "author": "OpenERP SA, Akretion",
+    "category": "Sales Management",
+    "license": "AGPL-3",
+    "summary": "Products Displays with multi-dimension variants ",
+    "description": """
+Multi-axial display product support for OpenERP
+===============================================
+
+
+    """,
+    "depends" : [
+                "product_custom_attributes",
+                "product_variant_generator",
+                "product_display"
+                ],
+    "data" : ["product_view.xml",
+              ],
+    "application": True,
+    "active": False,
+    "installable": True,
+}

=== added file 'product_variant_display_generator/product_variant_display.py'
--- product_variant_display_generator/product_variant_display.py	1970-01-01 00:00:00 +0000
+++ product_variant_display_generator/product_variant_display.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,130 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2013 Akretion (http://www.akretion.com).
+#   @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+from openerp.osv import orm, fields
+
+
+import logging
+_logger = logging.getLogger(__name__)
+
+
+class ProductTemplate(orm.Model):
+    _inherit = "product.template"
+
+    _columns = {
+        'generate_main_display': fields.boolean('Generate Main Display'),
+        'main_dim_id': fields.many2one(
+            'attribute.attribute',
+            string='Main Dimension',
+            help=('This dimension will be used for generating '
+                 'the product display')),
+        'display_variant_ids': fields.one2many(
+            'product.product',
+            'product_tmpl_id',
+            domain=[
+                ('is_display', '=', True),
+                '|',
+                ('active', '=', True),
+                ('active', '=', False),
+                ], string='Display Variants'),
+        'product_variant_ids': fields.one2many(
+            'product.product',
+            'product_tmpl_id',
+            domain=[
+                ('is_display', '=', False),
+                '|',
+                ('active', '=', True),
+                ('active', '=', False),
+                ], string='Product Variants'),
+    }
+
+    def _get_combinaison(self, cr, uid, product_temp, context=None):
+        if context.get('product_display'):
+            fields = [dim.name for dim in product_temp.dimension_ids]
+            num_of_fields = len(fields)
+            combinaisons = []
+            if product_temp.main_dim_id:
+                for value in product_temp.value_ids:
+                    if value.dimension_id.id == product_temp.main_dim_id.id:
+                        combinaisons.append(
+                            [value.option_id.id] + [None]*(num_of_fields - 1)
+                            )
+            if product_temp.generate_main_display:
+                combinaisons.append([None]*num_of_fields)
+            return combinaisons
+        return super(ProductTemplate, self)._get_combinaison(
+            cr, uid, product_temp, context=context)
+
+    def _prepare_variant_vals(self, cr, uid, product_temp, combinaison,
+                              context=None):
+        product_obj = self.pool['product.product']
+        vals = super(ProductTemplate, self)._prepare_variant_vals(
+            cr, uid, product_temp, combinaison, context=context)
+        if context.get('product_display'):
+            vals['is_display'] = True
+            domain = [
+                ['product_tmpl_id', '=', vals['product_tmpl_id']],
+                ['is_display', '=', False],
+            ]
+            dimension = product_temp.main_dim_id
+            if dimension and dimension.name in vals:
+                domain.append([dimension.name, '=', vals[dimension.name]])
+            product_ids = product_obj.search(cr, uid, domain, context=context)
+            vals['display_for_product_ids'] = [(6, 0, product_ids)]
+        return vals
+
+    def _create_variant(self, cr, uid, product_temp, existing_product_ids,
+                        context=None):
+        created_product_ids = super(ProductTemplate, self)._create_variant(
+            cr, uid, product_temp, existing_product_ids, context=context)
+        if created_product_ids:
+            self.pool['product.product'].update_existing_product_display(
+                cr, uid, created_product_ids, context=context)
+
+        ctx = context.copy()
+        ctx['product_display'] = True
+        created_product_display_ids = super(ProductTemplate, self).\
+            _create_variant(cr, uid, product_temp, existing_product_ids,
+                            context=ctx)
+        return created_product_ids + created_product_display_ids
+
+
+class ProductProduct(orm.Model):
+    _inherit = 'product.product'
+
+    def update_existing_product_display(self, cr, uid, ids, context=None):
+        ids = self.search(cr, uid, [
+            ['id', 'in', ids],
+            ['is_display', '=', True]
+            ], context=context)
+
+        for product in self.browse(cr, uid, ids, context=context):
+            domain = [
+                ['product_tmpl_id', '=', product.product_tmpl_id.id],
+                ['is_display', '=', False],
+            ]
+            dim = product.main_dim_id
+            if dim and product[dim.name]:
+                domain.append([dim.name, '=', product[dim.name].name])
+            product_ids = self.search(cr, uid, domain, context=context)
+            product.write({'display_for_product_ids': [(6, 0, product_ids)]})
+        return True

=== added file 'product_variant_display_generator/product_view.xml'
--- product_variant_display_generator/product_view.xml	1970-01-01 00:00:00 +0000
+++ product_variant_display_generator/product_view.xml	2014-06-18 16:37:46 +0000
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+<!--
+  Module for OpenERP
+  The licence is in the file __openerp__.py
+  @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+-->
+
+        <!-- PRODUCT TEMPLATE -->
+        <record id="product_variant_multi_product_display_form_view" model="ir.ui.view">
+            <field name="name">product.variant.multi.product.display.form</field>
+            <field name="model">product.template</field>
+            <field name="inherit_id" ref="product_variant_generator.product_variant_multi_product_template_form_view" />
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='do_not_update_variant']/.." position="after">
+                    <group string="Displays" colspan="1" col="4" attrs="{'invisible':[('is_multi_variants','=',False)]}">
+                        <field name="generate_main_display"/>
+                        <field name="dimension_ids" invisible="1"/>
+                        <field name="main_dim_id" domain="[('id', 'in', dimension_ids and dimension_ids[0][2])]"/>
+                        <field name="display_variant_ids" nolabel="1" colspan="4">
+                            <tree string="Display Variants">
+                                <field name="code" />
+                                <field name="name" />
+                                <field name="variants" string="Dimension Values" />
+                            </tree>
+                        </field>
+                    </group>
+                </xpath>
+                <field name="variant_ids" position="replace">
+                    <field name="product_variant_ids" nolabel="1" colspan="4">
+                        <tree string="Product Variants">
+                            <field name="code" />
+                            <field name="name" />
+                            <field name="variants" string="Dimension Values" />
+                        </tree>
+                    </field>
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== renamed directory 'product_variant_multi' => 'product_variant_generator'
=== modified file 'product_variant_generator/__init__.py'
--- product_variant_multi/__init__.py	2013-09-19 11:46:57 +0000
+++ product_variant_generator/__init__.py	2014-06-18 16:37:46 +0000
@@ -22,3 +22,4 @@
 # flake8: noqa
 
 from . import product_variant
+from . import wizard

=== modified file 'product_variant_generator/__openerp__.py'
--- product_variant_multi/__openerp__.py	2013-09-19 11:46:57 +0000
+++ product_variant_generator/__openerp__.py	2014-06-18 16:37:46 +0000
@@ -20,7 +20,7 @@
 #
 ##############################################################################
 {
-    "name": "Product Variant Multi",
+    "name": "Product Variant Generator",
     "version": "1.0",
     "author": "OpenERP SA, Akretion",
     "category": "Sales Management",
@@ -44,8 +44,6 @@
 the space of the variants. You could also choose to populate only some combinations
 by hand instead.
 
-Each variant can have an extra price that will be taken into account when computing
-the base listed price. Yet to be implemented: a price extra per variant dimension value.
 Finally, this module is better used along with the product_variant_configurator which
 will help the salesman selecting the appropriate variant in the sale order line
 using dimension criteria instead of having to crawl the full space of variants.
@@ -60,11 +58,15 @@
 and only from product.template if not found on product.product. But at least you
 will have been warned.
     """,
-    "depends": ["product"],
-    "demo": ["demo_data.xml"],
-    "data": [
+    "depends" : [
+        "product_custom_attributes",
+        "product_variant_simple"
+    ],
+    "data" : [
+        "wizard/product_template_add_option_view.xml",
         "security/ir.model.access.csv",
         "product_view.xml",
+        "product_data.xml",
     ],
     "application": True,
     "active": False,

=== modified file 'product_variant_generator/product_variant.py'
--- product_variant_multi/product_variant.py	2013-09-19 15:50:40 +0000
+++ product_variant_generator/product_variant.py	2014-06-18 16:37:46 +0000
@@ -7,6 +7,7 @@
 #    @author Sebatien Beau <sebastien.beau@xxxxxxxxxxxx>
 #    @author Raphaël Valyi <raphael.valyi@xxxxxxxxxxxx>
 #    @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
+#    @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
 #    update to use a single "Generate/Update" button & price computation code
 #
 #    This program is free software: you can redistribute it and/or modify
@@ -25,215 +26,239 @@
 ##############################################################################
 
 from openerp.osv import fields, osv, orm
-import openerp.addons.decimal_precision as dp
 # Lib to eval python code with security
+from openerp.tools.translate import _
+from collections import defaultdict
+from openerp.tools import config
 from openerp.tools.safe_eval import safe_eval
-from openerp.tools.translate import _
+import datetime
+
 
 import logging
 _logger = logging.getLogger(__name__)
 
 
-class product_variant_dimension_type(orm.Model):
-    _name = "product.variant.dimension.type"
-    _description = "Dimension Type"
+class AttributeAttribute(orm.Model):
+    _inherit = 'attribute.attribute'
 
     _columns = {
-        'description': fields.char('Description', size=64, translate=True),
-        'name': fields.char('Dimension Type Name', size=64, required=True),
-        'sequence': fields.integer('Sequence', help=("The product 'variants' code will "
-                                                     "use this to order the dimension values")),
-        'option_ids': fields.one2many('product.variant.dimension.option', 'dimension_id',
-                                      'Dimension Options'),
-        'product_tmpl_id': fields.many2many('product.template', 'product_template_dimension_rel',
-                                            'dimension_id', 'template_id', 'Product Template'),
-        'allow_custom_value': fields.boolean('Allow Custom Value',
-                                             help=("If true, custom values can be entered "
-                                                   "in the product configurator")),
-        'mandatory_dimension': fields.boolean('Mandatory Dimension',
-                                              help=("If false, variant products will be created "
-                                                    "with and without this dimension")),
+        'sequence': fields.integer(
+            'Sequence',
+            help=("The product 'variants' code will "
+                  "use this to order the dimension values")),
+        'mandatory_dimension': fields.boolean(
+            'Mandatory Dimension',
+            help=("If false, variant products will be created "
+                  "with and without this dimension")),
+        'is_dimension': fields.boolean('Is dimension', help='Help note'),
     }
 
     _defaults = {
         'mandatory_dimension': 1,
     }
 
-    _order = "sequence, name"
-
-    def name_search(self, cr, uid, name='', args=None, operator='ilike', context=None, limit=None):
-        if not context.get('product_tmpl_id', False):
-            args = None
-        return super(product_variant_dimension_type,
-                     self).name_search(cr, uid, '', args, 'ilike', None, None)
-
-
-class product_variant_dimension_option(orm.Model):
-    _name = "product.variant.dimension.option"
-    _description = "Dimension Option"
-
-    def _get_dimension_values(self, cr, uid, ids, context=None):
-        dimvalue_obj = self.pool.get('product.variant.dimension.value')
-        return dimvalue_obj.search(cr, uid, [('dimension_id', 'in', ids)], context=context)
-
-    _columns = {
-        'name': fields.char('Dimension Option Name', size=64, required=True),
-        'code': fields.char('Code', size=64),
-        'sequence': fields.integer('Sequence'),
-        'dimension_id': fields.many2one('product.variant.dimension.type',
-                                        'Dimension Type', ondelete='cascade'),
-    }
-
-    _order = "dimension_id, sequence, name"
-
-
-class product_variant_dimension_value(orm.Model):
-    _name = "product.variant.dimension.value"
+    _order = "sequence"
+
+
+class DimensionValue(orm.Model):
+    _name = "dimension.value"
     _description = "Dimension Value"
 
     def unlink(self, cr, uid, ids, context=None):
+        product_obj = self.pool['product.product']
         for value in self.browse(cr, uid, ids, context=context):
-            if value.product_ids:
-                product_names = [product.name for product in value.product_ids]
+            product_ids = product_obj.search(cr, uid, [
+                ['product_tmpl_id', '=', value.product_tmpl_id.id],
+                [value.dimension_id.name, '=', value.option_id.name],
+                ], context=context)
+            if product_ids:
+                products = product_obj.browse(cr, uid, product_ids,
+                                              context=context)
+                product_names = [product.name for product in products]
                 product_list = '\n    - ' + '\n    - '.join(product_names)
-                raise osv.except_osv(_('Dimension value can not be removed'),
-                                     _("The value %s is used by the products : %s \n "
-                                       "Please remove these products before removing the value.")
-                                     % (value.option_id.name, product_list))
-        return super(product_variant_dimension_value, self).unlink(cr, uid, ids, context)
+                raise osv.except_osv(
+                    _('Dimension value can not be removed'),
+                    _("The value %s is used by the products : %s \n "
+                      "Please remove these products before removing "
+                      "the value.") % (value.option_id.name, product_list))
+        return super(DimensionValue, self).\
+            unlink(cr, uid, ids, context)
 
     def _get_values_from_types(self, cr, uid, ids, context=None):
-        dimvalue_obj = self.pool.get('product.variant.dimension.value')
-        return dimvalue_obj.search(cr, uid, [('dimension_id', 'in', ids)], context=context)
-
-    def _get_values_from_options(self, cr, uid, ids, context=None):
-        dimvalue_obj = self.pool.get('product.variant.dimension.value')
-        return dimvalue_obj.search(cr, uid, [('option_id', 'in', ids)], context=context)
+        dimvalue_obj = self.pool.get('dimension.value')
+        return dimvalue_obj.search(cr, uid, [
+            ('dimension_id', 'in', ids),
+            ], context=context)
 
     _columns = {
-        'option_id': fields.many2one('product.variant.dimension.option', 'Option', required=True),
-        'name': fields.related('option_id', 'name', type='char',
-                               relation='product.variant.dimension.option',
-                               string="Dimension Value", readonly=True),
+        # TODO option_id add param in context
+        #     to have a full name 'dimension + option'
+        # exemple address on sale order
+        'option_id': fields.many2one(
+            'attribute.option',
+            'Option',
+            required=True),
+        'name': fields.related(
+            'option_id',
+            'name',
+            type='char',
+            string="Dimension Value",
+            readonly=True),
         'sequence': fields.integer('Sequence'),
-        'price_extra': fields.float('Sale Price Extra',
-                                    digits_compute=dp.get_precision('Sale Price')),
-        'price_margin': fields.float('Sale Price Margin',
-                                     digits_compute=dp.get_precision('Sale Price')),
-        'cost_price_extra': fields.float('Cost Price Extra',
-                                         digits_compute=dp.get_precision('Purchase Price')),
-        'dimension_id': fields.related('option_id', 'dimension_id', type="many2one",
-                                       relation="product.variant.dimension.type",
-                                       string="Dimension Type",
-                                       readonly=True,
-                                       store={'product.variant.dimension.value':
-                                              (lambda self, cr, uid, ids, c={}:
-                                                  ids, ['option_id'], 10),
-                                              'product.variant.dimension.option':
-                                              (_get_values_from_options, ['dimension_id'], 20)}),
-        'product_tmpl_id': fields.many2one('product.template', 'Product Template',
-                                           ondelete='cascade'),
-        'dimension_sequence': fields.related('dimension_id', 'sequence', type='integer',
-                                             relation='product.variant.dimension.type',
-                                             #used for ordering purposes in the "variants"
-                                             string="Related Dimension Sequence",
-                                             store={'product.variant.dimension.type':
-                                                    (_get_values_from_types, ['sequence'], 10)}),
-        'product_ids': fields.many2many('product.product', 'product_product_dimension_rel',
-                                        'dimension_id', 'product_id', 'Variant', readonly=True),
-        'active': fields.boolean('Active', help=("If false, this value will not be "
-                                                 "used anymore to generate variants.")),
+        'dimension_id': fields.many2one(
+            'attribute.attribute',
+            'Dimension',
+            required=True),
+        'product_tmpl_id': fields.many2one(
+            'product.template',
+            'Product Template',
+            ondelete='cascade'),
+        'dimension_sequence': fields.related(
+            'dimension_id',
+            'sequence',
+            type='integer',
+            string="Related Dimension Sequence",
+            store={
+                'attribute.attribute': (
+                    _get_values_from_types,
+                    ['sequence'],
+                    10),
+                'dimension.value': (
+                    lambda self, cr, uid, ids, c={}: ids,
+                    ['dimension_id'],
+                    10),
+            }),
+        'active': fields.boolean(
+            'Active',
+            help=("If false, this value will not be "
+                  "used anymore to generate variants.")),
     }
 
     _defaults = {
         'active': True,
     }
 
-    _sql_constraints = [('opt_dim_tmpl_uniq',
-                        'UNIQUE(option_id, dimension_id, product_tmpl_id)',
-                        _("The combination option and dimension type "
-                          "already exists for this product template !")), ]
-
-    _order = "dimension_sequence, dimension_id, sequence, option_id"
-
-
-class product_template(orm.Model):
+    _sql_constraints = [
+        (
+            'opt_dim_tmpl_uniq',
+            'UNIQUE(option_id, dimension_id, product_tmpl_id)',
+            _("The combination option and dimension type "
+              "already exists for this product template !")
+        ),
+        ]
+
+    _order = "dimension_sequence, sequence, option_id"
+
+    def on_dimension_change(self, cr, uid, ids, dimension_id, context=None):
+        dim_obj = self.pool['attribute.attribute']
+        dim = dim_obj.browse(cr, uid, dimension_id, context=context)
+        return {
+            'domain': {
+                'option_id': [
+                    ('id', 'in', [option.id for option in dim.option_ids])
+                    ]
+                },
+            'value': {'option_id': False},
+            }
+
+
+class ProductTemplate(orm.Model):
     _inherit = "product.template"
-
     _order = "name"
 
+    def _get_dimension_ids(self, cr, uid, ids, field_name, args, context=None):
+        result = {}
+        for product_tmpl in self.browse(cr, uid, ids, context=context):
+            attr_ids = []
+            for group in product_tmpl.attribute_set_id.attribute_group_ids:
+                for attr in group.attribute_ids:
+                    attr_ids.append(attr.attribute_id.id)
+            result[product_tmpl.id] = attr_ids
+        return result
+
     _columns = {
-        'name': fields.char('Name', size=128, translate=True, select=True, required=False),
-        'dimension_type_ids': fields.many2many('product.variant.dimension.type',
-                                               'product_template_dimension_rel',
-                                               'template_id', 'dimension_id', 'Dimension Types'),
-        'value_ids': fields.one2many('product.variant.dimension.value',
-                                     'product_tmpl_id',
-                                     'Dimension Values'),
-        'variant_ids': fields.one2many('product.product', 'product_tmpl_id', 'Variants'),
-        'variant_model_name': fields.char('Variant Model Name', size=64, required=True,
-                                          help=('[_o.dimension_id.name_] will be replaced with the'
-                                                ' name of the dimension and [_o.option_id.code_] '
-                                                'by the code of the option. Example of Variant '
-                                                'Model Name : "[_o.dimension_id.name_] - '
-                                                '[_o.option_id.code_]"')),
-        'variant_model_name_separator': fields.char('Variant Model Name Separator', size=64,
-                                                    help=('Add a separator between the elements '
-                                                          'of the variant name')),
-        'code_generator': fields.char('Code Generator', size=256,
-                                      help=('enter the model for the product code, all parameter'
-                                            ' between [_o.my_field_] will be replace by the '
-                                            'product field. Example product_code model : '
-                                            'prefix_[_o.variants_]_suffixe ==> result : '
-                                            'prefix_2S2T_suffix')),
+        'name': fields.char(
+            'Name', size=128,
+            translate=True,
+            select=True,
+            required=False),
+        'value_ids': fields.one2many(
+            'dimension.value',
+            'product_tmpl_id',
+            'Dimension Values'),
+        'dimension_ids': fields.function(
+            _get_dimension_ids,
+            string='Dimension',
+            type='many2many',
+            relation='attribute.attribute'),
+        'variant_ids': fields.one2many(
+            'product.product',
+            'product_tmpl_id',
+            'Variants'),
+        'template_name_id': fields.many2one(
+            'string.template',
+            'Template Name',
+            required=True,
+            domain=[('type', '=', 'product_name')],
+            ondelete='restrict'),
+        'template_code_id': fields.many2one(
+            'string.template',
+            'Template Code',
+            required=True,
+            domain=[('type', '=', 'product_code')],
+            ondelete='restrict'),
+        'base_default_code': fields.char(
+            'Base Default Code',
+            size=256,
+            help=('Base Default Code of the template '
+                  'used for generating the product code')),
         'is_multi_variants': fields.boolean('Is Multi Variants'),
-        'variant_track_production': fields.boolean('Track Production Lots on variants ?'),
-        'variant_track_incoming': fields.boolean('Track Incoming Lots on variants ?'),
-        'variant_track_outgoing': fields.boolean('Track Outgoing Lots on variants ?'),
-        'do_not_update_variant': fields.boolean("Don't Update Variant"),
-        'do_not_generate_new_variant': fields.boolean("Don't Generate New Variant"),
+        'variant_track_production': fields.boolean(
+            'Track Production Lots on variants ?'),
+        'variant_track_incoming': fields.boolean(
+            'Track Incoming Lots on variants ?'),
+        'variant_track_outgoing': fields.boolean(
+            'Track Outgoing Lots on variants ?'),
+        'do_not_update_variant': fields.boolean(
+            "Don't Update Variant"),
+        'do_not_generate_new_variant': fields.boolean(
+            "Don't Generate New Variant"),
     }
 
+    def _get_default_template_name(self, cr, uid, context=None):
+        tmpl_id = self.pool['string.template'].search(cr, uid, [
+            ('type', '=', 'product_name'),
+            ], context=context)
+        return tmpl_id and tmpl_id[0] or False
+
+    def _get_default_template_code(self, cr, uid, context=None):
+        tmpl_id = self.pool['string.template'].search(cr, uid, [
+            ('type', '=', 'product_code'),
+            ], context=context)
+        return tmpl_id and tmpl_id[0] or False
+
     _defaults = {
-        'variant_model_name': '[_o.dimension_id.name_] - [_o.option_id.name_]',
-        'variant_model_name_separator': ' - ',
         'is_multi_variants': False,
-        'code_generator': ("[_'-'.join([x.option_id.name for x in o.dimension_value_ids] "
-                           "or ['CONF'])_]"),
+        'template_name_id': _get_default_template_name,
+        'template_code_id': _get_default_template_code,
     }
 
     def unlink(self, cr, uid, ids, context=None):
         if context and context.get('unlink_from_product_product', False):
             for template in self.browse(cr, uid, ids, context):
                 if not template.is_multi_variants:
-                    super(product_template, self).unlink(cr, uid, [template.id], context)
+                    super(ProductTemplate, self).\
+                        unlink(cr, uid, [template.id], context)
         else:
             for template in self.browse(cr, uid, ids, context):
                 if template.variant_ids == []:
-                    super(product_template, self).unlink(cr, uid, [template.id], context)
+                    super(ProductTemplate, self).\
+                        unlink(cr, uid, [template.id], context)
                 else:
-                    raise osv.except_osv(_("Cannot delete template"),
-                                         _("This template has existing corresponding products..."))
-        return True
-
-    def add_all_option(self, cr, uid, ids, context=None):
-        #Reactive all unactive values
-        value_obj = self.pool.get('product.variant.dimension.value')
-        for template in self.browse(cr, uid, ids, context=context):
-            values_ids = value_obj.search(cr, uid, [['product_tmpl_id', '=', template.id],
-                                                    '|', ['active', '=', False],
-                                                         ['active', '=', True]], context=context)
-            value_obj.write(cr, uid, values_ids,
-                            {'active': True},
-                            context=context)
-            values = value_obj.browse(cr, uid, values_ids, context=context)
-            existing_option_ids = [value.option_id.id for value in values]
-            vals = {'value_ids': []}
-            for dim in template.dimension_type_ids:
-                for option in dim.option_ids:
-                    if not option.id in existing_option_ids:
-                        vals['value_ids'] += [[0, 0, {'option_id': option.id}]]
-            self.write(cr, uid, [template.id], vals, context=context)
+                    raise osv.except_osv(
+                        _("Cannot delete template"),
+                        _("This template has existing corresponding "
+                          "products..."))
         return True
 
     def get_products_from_product_template(self, cr, uid, ids, context=None):
@@ -245,12 +270,14 @@
             default = {}
         default = default.copy()
         default.update({'variant_ids': False, })
-        new_id = super(product_template, self).copy(cr, uid, id, default, context)
+        new_id = super(ProductTemplate, self).\
+            copy(cr, uid, id, default, context=context)
 
-        val_obj = self.pool.get('product.variant.dimension.value')
+        val_obj = self.pool.get('dimension.value')
         template = self.read(cr, uid, new_id, ['value_ids'], context=context)
         # Making sure the values we duplicated are no longer linked via the
-        # m2m 'product_ids' with the product.product variants from the original template
+        # m2m 'product_ids' with the product.product variants
+        # from the original template
         val_obj.write(cr, uid, template['value_ids'], {
             'product_ids': [(6, 0, [])],
         }, context=context)
@@ -260,384 +287,294 @@
     def copy_translations(self, cr, uid, old_id, new_id, context=None):
         if context is None:
             context = {}
-        # avoid recursion through already copied records in case of circular relationship
+        # avoid recursion through already copied records in case
+        # of circular relationship
         seen_map = context.setdefault('__copy_translations_seen', {})
         if old_id in seen_map.setdefault(self._name, []):
             return
         seen_map[self._name].append(old_id)
-        return super(product_template, self).copy_translations(cr, uid, old_id, new_id,
-                                                               context=context)
+        return super(ProductTemplate, self).\
+            copy_translations(cr, uid, old_id, new_id, context=context)
 
-    def _create_variant_list(self, cr, ids, uid, vals, context=None):
+    def _create_variant_list(self, cr, uid, vals, context=None):
 
         def cartesian_product(args):
             if len(args) == 1:
                 return [x and [x] or [] for x in args[0]]
-            return [(i and [i] or []) + j for j in cartesian_product(args[1:]) for i in args[0]]
+            return [(i and [i] or []) + j for j in cartesian_product(args[1:])
+                    for i in args[0]]
 
         return cartesian_product(vals)
 
+    def _get_combinaison(self, cr, uid, product_temp, context=None):
+        res = defaultdict(list)
+
+        for value in product_temp.value_ids:
+            res[value.dimension_id].append(value.option_id.id)
+
+        temp_val_list = []
+        for dim in res:
+            temp_val_list += [
+                res[dim]
+                + (not dim.mandatory_dimension and [None] or [])
+                ]
+
+        # example temp_val_list is equal to [['red', 'blue', 'yellow'],
+        # ['L', 'XL', 'M']]
+        # In reallity it's not a string value but the id of the value
+
+        if not temp_val_list:
+            return []
+
+        combinaisons = self._create_variant_list(
+            cr, uid, temp_val_list, context)
+        return combinaisons
+
+    def _get_combinaisons_to_create(self, cr, uid, product_temp,
+                                    existing_product_ids, context=None):
+        variants_obj = self.pool['product.product']
+
+        fields = set([dimension_value.dimension_id.name
+                      for dimension_value in product_temp.value_ids])
+
+        combinaisons = self._get_combinaison(
+            cr, uid, product_temp, context=context)
+
+        for combinaison in combinaisons:
+            combinaison.sort()
+
+        existing_products = variants_obj.read(
+            cr, uid, existing_product_ids, fields, context=context)
+
+        existing_combinaisons = []
+        for existing_product in existing_products:
+            existing_combinaison = []
+            for field in fields:
+                if existing_product[field]:
+                    existing_combinaison.append(existing_product[field][0])
+                else:
+                    existing_combinaison.append(None)
+            existing_combinaison.sort()
+            existing_combinaisons.append(existing_combinaison)
+
+        combinaisons_to_create = [x for x in combinaisons
+                                  if not x in existing_combinaisons]
+
+        _logger.debug("variant existing : %s, variant to create : %s",
+                      len(existing_combinaisons),
+                      len(combinaisons_to_create))
+        return combinaisons_to_create
+
+    def _prepare_variant_vals(self, cr, uid, product_temp, combinaison,
+                              context=None):
+        option_obj = self.pool['attribute.option']
+        vals = {
+            'name': product_temp.name,
+            'track_production': product_temp.variant_track_production,
+            'track_incoming': product_temp.variant_track_incoming,
+            'track_outgoing': product_temp.variant_track_outgoing,
+            'product_tmpl_id': product_temp.id,
+        }
+        option_ids = [option_id for option_id in combinaison if option_id]
+        for option in option_obj.browse(cr, uid, option_ids, context=context):
+            vals[option.attribute_id.name] = option.id
+        return vals
+
+    def _create_variant(self, cr, uid, product_temp, existing_product_ids,
+                        context=None):
+        variants_obj = self.pool['product.product']
+        created_product_ids = []
+        combinaisons_to_create = self.\
+            _get_combinaisons_to_create(
+                cr, uid, product_temp, existing_product_ids,
+                context=context)
+
+        count = 0
+        for combinaison in combinaisons_to_create:
+            count += 1
+            vals = self._prepare_variant_vals(
+                cr, uid, product_temp, combinaison,
+                context=context)
+
+            cr.execute("SAVEPOINT pre_variant_save")
+            try:
+                product_id = variants_obj.create(cr, uid, vals, {
+                    'generate_from_template': True,
+                    })
+                created_product_ids.append(product_id)
+                if count % 50 == 0:
+                    _logger.debug("product created : %s", count)
+            except Exception, e:
+                if config['debug_mode']:
+                    raise
+                _logger.error("Error creating product variant: %s",
+                              e, exc_info=True)
+                _logger.debug("Values used to attempt creation of "
+                              "product variant: %s", vals)
+                cr.execute("ROLLBACK TO SAVEPOINT pre_variant_save")
+            cr.execute("RELEASE SAVEPOINT pre_variant_save")
+
+        _logger.debug("product created : %s", len(created_product_ids))
+        return created_product_ids
+
+    def _generate_variant_for_template(self, cr, uid, product_temp,
+                                       context=None):
+        variants_obj = self.pool['product.product']
+        created_product_ids = []
+
+        existing_product_ids = variants_obj.search(cr, uid, [
+            ('product_tmpl_id', '=', product_temp.id)
+            ], context=context)
+
+        if not product_temp.do_not_generate_new_variant:
+            created_product_ids = self._create_variant(
+                cr, uid, product_temp, existing_product_ids,
+                context=context)
+
+        product_ids = existing_product_ids + created_product_ids
+
+        _logger.debug("Starting to generate/update variant names...")
+        variants_obj.update_variant(cr, uid, product_ids, context=context)
+        return True
+
     def button_generate_variants(self, cr, uid, ids, context=None):
-        variants_obj = self.pool.get('product.product')
-
-        for product_temp in self.browse(cr, uid, ids, context):
-            res = {}
-            temp_val_list = []
-            for value in product_temp.value_ids:
-                if res.get(value.dimension_id, False):
-                    res[value.dimension_id] += [value.id]
-                else:
-                    res[value.dimension_id] = [value.id]
-            for dim in res:
-                temp_val_list += [res[dim] + (not dim.mandatory_dimension and [None] or [])]
-
-            existing_product_ids = variants_obj.search(cr, uid,
-                                                       [('product_tmpl_id', '=', product_temp.id)])
-            created_product_ids = []
-            if temp_val_list and not product_temp.do_not_generate_new_variant:
-                list_of_variants = self._create_variant_list(cr, uid, ids, temp_val_list, context)
-                existing_product_dim_value = variants_obj.read(cr, uid, existing_product_ids,
-                                                               ['dimension_value_ids'])
-                list_of_variants_existing = [x['dimension_value_ids']
-                                             for x in existing_product_dim_value]
-                for x in list_of_variants_existing:
-                    x.sort()
-                for x in list_of_variants:
-                    x.sort()
-                list_of_variants_to_create = [x for x in list_of_variants
-                                              if not x in list_of_variants_existing]
-
-                _logger.debug("variant existing : %s, variant to create : %s",
-                              len(list_of_variants_existing),
-                              len(list_of_variants_to_create))
-                count = 0
-                for variant in list_of_variants_to_create:
-                    count += 1
-
-                    vals = {
-                        'name': product_temp.name,
-                        'track_production': product_temp.variant_track_production,
-                        'track_incoming': product_temp.variant_track_incoming,
-                        'track_outgoing': product_temp.variant_track_outgoing,
-                        'product_tmpl_id': product_temp.id,
-                        'dimension_value_ids': [(6, 0, variant)],
-                    }
-
-                    cr.execute("SAVEPOINT pre_variant_save")
-                    try:
-                        product_id = variants_obj.create(cr, uid, vals,
-                                                         {'generate_from_template': True})
-                        created_product_ids.append(product_id)
-                        if count % 50 == 0:
-                            _logger.debug("product created : %s", count)
-                    except Exception, e:
-                        _logger.error("Error creating product variant: %s",
-                                      e, exc_info=True)
-                        _logger.debug("Values used to attempt creation of product variant: %s",
-                                      vals)
-                        cr.execute("ROLLBACK TO SAVEPOINT pre_variant_save")
-                    cr.execute("RELEASE SAVEPOINT pre_variant_save")
-
-                _logger.debug("product created : %s", count)
-
-            if not product_temp.do_not_update_variant:
-                product_ids = existing_product_ids + created_product_ids
-            else:
-                product_ids = created_product_ids
-
-            # FIRST, Generate/Update variant names ('variants' field)
-            _logger.debug("Starting to generate/update variant names...")
-            self.pool.get('product.product').build_variants_name(cr, uid, product_ids,
-                                                                 context=context)
-            _logger.debug("End of the generation/update of variant names.")
-            # SECOND, Generate/Update product codes and properties (we may need variants name)
-            _logger.debug("Starting to generate/update product codes and properties...")
-            self.pool.get('product.product').build_product_code_and_properties(cr, uid,
-                                                                               product_ids,
-                                                                               context=context)
-            _logger.debug("End of the generation/update of product codes and properties.")
-            # THIRD, Generate/Update product names (we may need variants name for that)
-            _logger.debug("Starting to generate/update product names...")
-            self.pool.get('product.product').build_product_name(cr, uid, product_ids,
-                                                                context=context)
-            _logger.debug("End of generation/update of product names.")
+        for product_temp in self.browse(cr, uid, ids, context=context):
+            self._generate_variant_for_template(
+                cr, uid, product_temp, context=context)
         return True
 
 
-class product_product(orm.Model):
+class ProductProduct(orm.Model):
     _inherit = "product.product"
 
     def init(self, cr):
-        #For the first installation if you already have product in your database,
-        # the name of the existing product will be empty, so we fill it
-        cr.execute("update product_product set name=name_template where name is null;")
+        #TODO do it only for the first installation
+        #For the first installation if you already have product in
+        # your database, the name of the existing product will be empty,
+        # so we fill it
+        cr.execute("UPDATE product_product SET name=name_template "
+                   "WHERE name is null;")
         return True
 
     def unlink(self, cr, uid, ids, context=None):
         if not context:
             context = {}
         context['unlink_from_product_product'] = True
-        return super(product_product, self).unlink(cr, uid, ids, context)
-
-    def build_product_name(self, cr, uid, ids, context=None):
-        return self.build_product_field(cr, uid, ids, 'name', context=None)
-
-    def build_product_field(self, cr, uid, ids, field, context=None):
-        def get_description_sale(product):
-            return self.parse(cr, uid, product,
-                              product.product_tmpl_id.description_sale,
-                              context=context)
-
-        def get_name(product):
-            return (product.product_tmpl_id.name or '') + ' ' + (product.variants or '')
-
-        if not context:
-            context = {}
+        return super(ProductProduct, self).unlink(cr, uid, ids, context)
+
+    def update_variant(self, cr, uid, ids, context=None):
+        lang_obj = self.pool.get('res.lang')
+        lang_ids = lang_obj.search(cr, uid, [
+            ('translatable', '=', True),
+            ], context=context)
+        for lang in lang_obj.browse(cr, uid, lang_ids, context=context):
+            context['lang'] = lang.code
+            for product in self.browse(cr, uid, ids, context=context):
+                self._update_variant(cr, uid, product, context=context)
+        return True
+
+    def _update_variant(self, cr, uid, product, context=None):
+        vals = self._prepare_update_vals(cr, uid, product, context=context)
+        vals = self._remove_not_updated(cr, uid, product, vals, context=context)
+        if vals:
+            product.write(vals)
+        return True
+
+    def _prepare_update_vals(self, cr, uid, product, context=None):
         context['is_multi_variants'] = True
-        obj_lang = self.pool.get('res.lang')
-        lang_ids = obj_lang.search(cr, uid, [('translatable', '=', True)], context=context)
-        lang_code = [x['code']
-                     for x in obj_lang.read(cr, uid, lang_ids, ['code'], context=context)]
-        for code in lang_code:
-            context['lang'] = code
-            for product in self.browse(cr, uid, ids, context=context):
-                new_field_value = eval("get_" + field + "(product)")  # TODO convert to safe_eval
-                cur_field_value = safe_eval("product." + field, {'product': product})
-                if new_field_value != cur_field_value:
-                    self.write(cr, uid, [product.id], {field: new_field_value}, context=context)
-        return True
-
-    def parse(self, cr, uid, o, text, context=None):
-        if not text:
-            return ''
-        vals = text.split('[_')
-        description = ''
-        for val in vals:
-            if '_]' in val:
-                sub_val = val.split('_]')
-                try:
-                    description += (safe_eval(sub_val[0], {'o': o, 'context': context})
-                                    or ''
-                                    ) + sub_val[1]
-                except AttributeError:
-                    raise osv.except_osv(_('Bad expression'),
-                                         _("One of your expressions contains "
-                                           "a non existing attribute: %s"
-                                           ) % sub_val[0])
-            else:
-                description += val
-        return description
-
-    def generate_product_code(self, cr, uid, product_obj, code_generator, context=None):
-        '''I wrote this stupid function to be able to inherit it in a custom module !'''
-        return self.parse(cr, uid, product_obj, code_generator, context=context)
-
-    def build_product_code_and_properties(self, cr, uid, ids, context=None):
-        for product in self.browse(cr, uid, ids, context=context):
-            new_default_code = self.generate_product_code(cr, uid, product,
-                                                          product.product_tmpl_id.code_generator,
-                                                          context=context)
-            current_values = {
-                'default_code': product.default_code,
-                #'track_production': product.track_production,
-                #'track_outgoing': product.track_outgoing,
-                #'track_incoming': product.track_incoming,
-            }
-            new_values = {
-                'default_code': new_default_code,
-                #'track_production': product.product_tmpl_id.variant_track_production,
-                #'track_outgoing': product.product_tmpl_id.variant_track_outgoing,
-                #'track_incoming': product.product_tmpl_id.variant_track_incoming,
-            }
-            if new_values != current_values:
-                self.write(cr, uid, [product.id], new_values, context=context)
-        return True
-
-    def product_ids_variant_changed(self, cr, uid, ids, res, context=None):
-        '''it's a hook for product_variant_multi advanced'''
-        return True
-
-    def generate_variant_name(self, cr, uid, product_id, context=None):
-        '''Do the generation of the variant name in a dedicated function, so that we can
-        inherit this function to hack the code generation'''
-        product = self.browse(cr, uid, product_id, context=context)
-        model = product.variant_model_name
-        r = map(lambda dim: [dim.dimension_id.sequence,
-                             self.parse(cr, uid, dim, model, context=context)],
-                product.dimension_value_ids)
-        r.sort()
-        r = [x[1] for x in r]
-        new_variant_name = (product.variant_model_name_separator or '').join(r)
-        return new_variant_name
-
-    def build_variants_name(self, cr, uid, ids, context=None):
-        for product in self.browse(cr, uid, ids, context=context):
-            new_variant_name = self.generate_variant_name(cr, uid, product.id, context=context)
-            if new_variant_name != product.variants:
-                self.write(cr, uid, [product.id], {'variants': new_variant_name}, context=context)
-        return True
-
-    def _check_dimension_values(self, cr, uid, ids):
-        # TODO: check that all dimension_types of the product_template
-        # have a corresponding dimension_value ??
-        for product in self.browse(cr, uid, ids, {}):
-            buffer = []
-            for value in product.dimension_value_ids:
-                buffer.append(value.dimension_id)
-            unique_set = set(buffer)
-            if len(unique_set) != len(buffer):
-                raise orm.except_orm(_('Constraint error :'),
-                                     _("On product '%s', there are several dimension values "
-                                       "for the same dimension type.") % product.name)
-        return True
-
-    def compute_product_dimension_extra_price(self, cr, uid, product_id,
-                                              product_price_extra=False, dim_price_margin=False,
-                                              dim_price_extra=False, context=None):
-        if context is None:
-            context = {}
-        dimension_extra = 0.0
-        product = self.browse(cr, uid, product_id, context=context)
-        for dim in product.dimension_value_ids:
-            if product_price_extra and dim_price_margin and dim_price_extra:
-                dimension_extra += (safe_eval('product.' + product_price_extra,
-                                              {'product': product})
-                                    * safe_eval('dim.' + dim_price_margin,
-                                                {'dim': dim})
-                                    + safe_eval('dim.' + dim_price_extra,
-                                                {'dim': dim}))
-            elif not product_price_extra and not dim_price_margin and dim_price_extra:
-                dimension_extra += safe_eval('dim.' + dim_price_extra, {'dim': dim})
-            elif product_price_extra and dim_price_margin and not dim_price_extra:
-                dimension_extra += (safe_eval('product.' + product_price_extra,
-                                              {'product': product})
-                                    * safe_eval('dim.' + dim_price_margin,
-                                                {'dim': dim}))
-            elif product_price_extra and not dim_price_margin and dim_price_extra:
-                dimension_extra += (safe_eval('product.' + product_price_extra,
-                                              {'product': product})
-                                    + safe_eval('dim.' + dim_price_extra, {'dim': dim}))
-
-        if 'uom' in context:
-            product_uom_obj = self.pool.get('product.uom')
-            uom = product.uos_id or product.uom_id
-            dimension_extra = product_uom_obj._compute_price(cr, uid, uom.id,
-                                                             dimension_extra, context['uom'])
-        return dimension_extra
-
-    def compute_dimension_extra_price(self, cr, uid, ids, result, product_price_extra=False,
-                                      dim_price_margin=False, dim_price_extra=False, context=None):
-        if context is None:
-            context = {}
-        for product in self.browse(cr, uid, ids, context=context):
-            dimension_extra = self.compute_product_dimension_extra_price(
-                cr, uid, product.id,
-                product_price_extra=product_price_extra,
-                dim_price_margin=dim_price_margin,
-                dim_price_extra=dim_price_extra,
-                context=context)
-            result[product.id] += dimension_extra
-        return result
-
-    def price_get(self, cr, uid, ids, ptype='list_price', context=None):
-        if context is None:
-            context = {}
-        result = super(product_product, self).price_get(cr, uid, ids, ptype, context=context)
-        if ptype == 'list_price':
-            #TODO check if the price_margin on the dimension is very usefull,
-            # maybe we will remove it
-            result = self.compute_dimension_extra_price(
-                cr, uid, ids, result,
-                product_price_extra='price_extra',
-                dim_price_margin='price_margin',
-                dim_price_extra='price_extra',
-                context=context)
-        elif ptype == 'standard_price':
-            result = self.compute_dimension_extra_price(
-                cr, uid, ids, result,
-                product_price_extra='cost_price_extra',
-                dim_price_extra='cost_price_extra',
-                context=context)
-        return result
-
-    def _product_lst_price(self, cr, uid, ids, name, arg, context=None):
-        if context is None:
-            context = {}
-        result = super(product_product, self)._product_lst_price(cr, uid, ids, name, arg,
-                                                                 context=context)
-        result = self.compute_dimension_extra_price(cr, uid, ids, result,
-                                                    product_price_extra='price_extra',
-                                                    dim_price_margin='price_margin',
-                                                    dim_price_extra='price_extra',
-                                                    context=context)
-        return result
-
-    def copy(self, cr, uid, id, default=None, context=None):
-        if default is None:
-            default = {}
-        default = default.copy()
-        default.update({'variant_ids': False})
-        return super(product_product, self).copy(cr, uid, id, default, context)
-
-    def _product_compute_weight_volume(self, cr, uid, ids, fields, arg, context=None):
-        result = {}
-        for product in self.browse(cr, uid, ids, context=context):
-            result[product.id] = p = {}
-            p['total_weight'] = product.weight + product.additional_weight
-            p['total_weight_net'] = product.weight_net + product.additional_weight_net
-            p['total_volume'] = product.volume + product.additional_volume
-        return result
+        string_template_obj = self.pool['string.template']
+        vals = {
+            'variants': string_template_obj._build(
+                cr, uid, product.template_name_id.id, product),
+            'default_code': string_template_obj._build(
+                cr, uid, product.template_code_id.id, product),
+        }
+        vals['name'] = "%s %s" % (
+            product.product_tmpl_id.name or '',
+            vals['variants'])
+        return vals
+
+    def _remove_not_updated(self, cr, uid, product, vals, context=None):
+        vals_to_write = {}
+        for key in vals:
+            if vals[key] != product[key]:
+                vals_to_write[key] = vals[key]
+        return vals_to_write
 
     _columns = {
-        'name': fields.char('Name', size=128, translate=True, select=True),
-        'variants': fields.char('Variants', size=128),
-        'dimension_value_ids': fields.many2many(
-            'product.variant.dimension.value',
-            'product_product_dimension_rel',
-            'product_id', 'dimension_id',
-            'Dimensions',
-            domain="[('product_tmpl_id','=',product_tmpl_id)]"),
-        'cost_price_extra': fields.float('Purchase Extra Cost',
-                                         digits_compute=dp.get_precision('Purchase Price')),
-        'lst_price': fields.function(_product_lst_price,
-                                     method=True,
-                                     type='float',
-                                     string='List Price',
-                                     digits_compute=dp.get_precision('Sale Price')),
-        #the way the weight are implemented are not clean at all,
-        #we should redesign the module product form the addons
-        #in order to get something correclty.
-        #indeed some field of the template have to be overwrited
-        #like weight, name, weight_net, volume.
-        #in order to have a consitent api we should use the same field for getting the weight,
-        #now we have to use "weight" or "total_weight"
-        #not clean at all with external syncronization
-        'total_weight': fields.function(_product_compute_weight_volume,
-                                        method=True,
-                                        type='float',
-                                        string='Total Gross Weight',
-                                        help="The gross weight in Kg.",
-                                        multi='weight_volume'),
-        'total_weight_net': fields.function(_product_compute_weight_volume,
-                                            method=True,
-                                            type='float',
-                                            string='Total Net Weight',
-                                            help="The net weight in Kg.",
-                                            multi='weight_volume'),
-        'total_volume':  fields.function(_product_compute_weight_volume,
-                                         method=True,
-                                         type='float',
-                                         string='Total Volume',
-                                         help="The volume in m3.",
-                                         multi='weight_volume'),
-        'additional_weight': fields.float('Additional Gross weight',
-                                          help="The additional gross weight in Kg."),
-        'additional_weight_net': fields.float('Additional Net weight',
-                                              help="The additional net weight in Kg."),
-        'additional_volume': fields.float('Additional Volume',
-                                          help="The additional volume in Kg."),
+        'name': fields.char(
+            'Name',
+            size=128,
+            translate=True,
+            select=True),
+        'variants': fields.char(
+            'Variants',
+            size=128),
     }
 
-    _constraints = [
-        (_check_dimension_values, 'Error msg in raise', ['dimension_value_ids']),
-    ]
+
+class StringTemplate(orm.Model):
+    _name = 'string.template'
+
+    def __get_type(self, cr, uid, context=None):
+        return self._get_type(cr, uid, context=context)
+
+    def _get_type(self, cr, uid, context=None):
+        return [
+            ('product_code', 'Product Code'),
+            ('product_name', 'Product Name'),
+            ]
+
+    _columns = {
+        'name': fields.char('name', required=True),
+        'type': fields.selection(__get_type, 'Type', required=True),
+        'code': fields.text('Code', required=True),
+        }
+
+    _defaults = {
+        'code': """# Python code. Use result='YOUR_RESULT' to return your value.
+        # You can use the following variables :
+        #  - self: ORM model of the record which is checked
+        #  - o: browse_record of product template
+        #  - pool: ORM model pool (i.e. self.pool)
+        #  - datetime: Python datetime module
+        #  - cr: database cursor
+        #  - uid: current user id
+        #  - context: current context
+        """
+        }
+
+    def _eval_context(self, cr, uid, obj, context=None):
+        if context is None:
+            context = {}
+
+        user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
+        return {
+            'self': self.pool.get(obj._name),
+            'o': obj,
+            'pool': self.pool,
+            'cr': cr,
+            'uid': uid,
+            'user': user,
+            'datetime': datetime,
+            # copy context to prevent side-effects of eval
+            'context': context.copy(),
+            }
+
+    def _build(self, cr, uid, template_id, obj, context=None):
+        if isinstance(template_id, (tuple, list)):
+            template_id = template_id[0]
+        template = self.browse(cr, uid, template_id, context=context)
+        expr = template.code
+        space = self._eval_context(cr, uid, obj, context=context)
+        try:
+            safe_eval(expr,
+                      space,
+                      mode='exec',
+                      nocopy=True)  # nocopy allows to return 'result'
+        except Exception, e:
+            raise orm.except_orm(
+                _('Error'),
+                _('Error when evaluating the template:\n %s \n(%s)')
+                % (template.name, e))
+        return space.get('result', False)

=== modified file 'product_variant_generator/product_view.xml'
--- product_variant_multi/product_view.xml	2013-04-22 21:00:07 +0000
+++ product_variant_generator/product_view.xml	2014-06-18 16:37:46 +0000
@@ -3,224 +3,109 @@
     <data>
 
 <!--
-  "Product variant multi" module for OpenERP
+  "Product variant generator" module for OpenERP
   The licence is in the file __openerp__.py
   @author Alexis de Lattre <alexis.delattre@xxxxxxxxxxxx>
   @author Sebastien Beau <sebastien.beau@xxxxxxxxxxxx>
+  @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
 -->
 
-
-        <menuitem name="Variant Dimensions" id="menu_variant_dimension" parent="product.prod_config_main" />
-
-
-        <!-- DIMENSION OPTION -->
-        <record id="product_variant_multi_dimension_option_seach" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.option.search</field>
-            <field name="model">product.variant.dimension.option</field>
-            <field name="arch" type="xml">
-                <search string="Dimension Options Search">
-                    <field name="name"/>
-                    <field name="dimension_id"/>
-                </search>
-            </field>
-        </record>
-
-        <record id="product_variant_multi_dimension_option_tree" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.option.tree</field>
-            <field name="model">product.variant.dimension.option</field>
-            <field name="arch" type="xml">
-                <tree string="Dimension Options" editable="top">
-                    <field name="dimension_id" invisible="not context.get('dimension_option_main_view', False)" />
-                    <field name="name" />
-                    <field name="sequence" />
-                    <field name="code" />
-                </tree>
-            </field>
-        </record>
-
-        <record id="product_variant_multi_dimension_option_form" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.option.form</field>
-            <field name="model">product.variant.dimension.option</field>
-            <field name="arch" type="xml">
-                <form string="Dimension Options">
-                    <field name="dimension_id" invisible="not context.get('dimension_option_main_view', False)" />
-                    <newline />
-                    <field name="sequence" />
-                    <field name="name" />
-                    <field name="code" />
-                </form>
-            </field>
-        </record>
-
-        <record id="action_dimension_option" model="ir.actions.act_window">
-            <field name="name">Dimension Options</field>
-            <field name="res_model">product.variant.dimension.option</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="context">{'dimension_option_main_view': True}</field>
-        </record>
-
-        <menuitem id="menu_variant_dimension_option" parent="menu_variant_dimension" action="action_dimension_option" />
-
-
         <!-- DIMENSION VALUES -->
-        <record id="product_variant_multi_dimension_value_search" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.value.search</field>
-            <field name="model">product.variant.dimension.value</field>
-            <field name="arch" type="xml">
-                <search string="Dimension Values Search">
-                    <field name="product_tmpl_id"/>
-                    <field name="option_id"/>
-                </search>
-            </field>
-        </record>
-
-
-        <record id="product_variant_multi_dimension_value_tree" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.value.tree</field>
-            <field name="model">product.variant.dimension.value</field>
+        <record id="dimension_value_tree" model="ir.ui.view">
+            <field name="model">dimension.value</field>
             <field name="arch" type="xml">
                 <tree string="Dimension Values" editable="top">
-                    <field name="product_tmpl_id" invisible="not context.get('dimension_value_main_view', False)" />
+                    <field name="product_tmpl_id"
+                           invisible="not context.get('dimension_value_main_view', False)"/>
                     <field name="active" />
-                    <field name="dimension_id" />
                     <field name="option_id" />
                     <field name="sequence" />
-                    <field name="cost_price_extra" />
-                    <field name="price_extra" />
                 </tree>
             </field>
         </record>
 
         <record id="product_variant_multi_dimension_value_form" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.value.form</field>
-            <field name="model">product.variant.dimension.value</field>
+            <field name="model">dimension.value</field>
             <field name="arch" type="xml">
                 <form string="Dimension Values">
-                    <field name="product_tmpl_id" invisible="not context.get('dimension_value_main_view', False)" />
+                    <field name="product_tmpl_id"
+                           invisible="not context.get('dimension_value_main_view', False)"/>
                     <field name="active" />
-                    <field name="dimension_id" />
                     <newline />
                     <field name="option_id" />
                     <field name="sequence" />
-                    <field name="cost_price_extra" />
-                    <field name="price_extra" />
-                    <field name="price_margin" />
                 </form>
             </field>
         </record>
 
         <record id="action_dimension_value" model="ir.actions.act_window">
             <field name="name">Dimension values</field>
-            <field name="res_model">product.variant.dimension.value</field>
+            <field name="res_model">dimension.value</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
             <field name="context">{'dimension_value_main_view': True}</field>
         </record>
-
-
-        <!-- DIMENSION TYPE -->
-        <record id="product_variant_multi_dimension_type_search" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.type.search</field>
-            <field name="model">product.variant.dimension.type</field>
-            <field name="arch" type="xml">
-                <search string="Dimension Type Search">
-                    <field name="name"/>
-                </search>
-            </field>
-        </record>
-
-        <record id="product_variant_multi_dimension_type_tree" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.type.tree</field>
-            <field name="model">product.variant.dimension.type</field>
-            <field name="arch" type="xml">
-                <tree string="Dimension Types">
-                    <field name="name" />
-                    <field name="description" />
-                </tree>
-            </field>
-        </record>
-
-        <record id="product_variant_multi_dimension_type_form" model="ir.ui.view">
-            <field name="name">product.variant.multi.dimension.type.form</field>
-            <field name="model">product.variant.dimension.type</field>
-            <field name="arch" type="xml">
-                <form string="Dimension Types" version="7.0">
-                    <sheet>
-                        <div class="oe_title">
-                            <label for="name" string="Dimension Type Name" class="oe_edit_only"/>
-                            <h1>
-                                <field name="name" />
-                            </h1>
-                        </div>
-                        <group>
-                            <field name="description" />
-                            <field name="sequence" />
-                            <field name="allow_custom_value" />
-                            <field name="mandatory_dimension" />
-                            <field name="option_ids" nolabel="1" colspan="4"/>
-                        </group>
-                    </sheet>
-                </form>
-            </field>
-        </record>
-
-
-        <record id="action_dimension_type" model="ir.actions.act_window">
-            <field name="name">Dimension Types</field>
-            <field name="res_model">product.variant.dimension.type</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-            <field name="context">{'dimension_type_main_view': True}</field>
-        </record>
-
-        <menuitem id="menu_variant_dimension_types" parent="menu_variant_dimension" action="action_dimension_type" />
-
-
+        
+        <record id="attribute_attribute_form_view" model="ir.ui.view">
+            <field name="model">attribute.attribute</field>
+            <field name="inherit_id" ref="base_custom_attributes.attribute_attribute_form_view"/>
+            <field name="arch" type="xml">
+                <field name="translate" position="after">
+                    <field name="is_dimension"/>
+                    <field name="sequence"
+                           attrs="{'invisible': [('is_dimension','=', False)]}"/>
+                    <field name="mandatory_dimension"
+                           attrs="{'invisible': [('is_dimension','=', False)]}"/>
+                </field>
+            </field>
+        </record>
+    
         <!-- PRODUCT TEMPLATE -->
-
-<!-- TODO remove useless view of product.template in the module product or fusion this view with the existing view in product, it's depend how the inheritage on this view will be managed by the other module-->
-
-<!--TODO add a wizard to add the option-->
-<!--<button name="add_some_option" string="Add " type="object" colspan="2"/>-->
-
-        <record id="product_search_form_view_template" model="ir.ui.view">
-            <field name="name">product.search.form.template</field>
-            <field name="model">product.template</field>
-            <field name="arch" type="xml">
-                <search string="Product Template">
-                   <field name="name"/>
-                </search>
-            </field>
-        </record>
-
         <record id="product_variant_multi_product_template_form_view" model="ir.ui.view">
-            <field name="name">product.variant.multi.product.template.form</field>
             <field name="model">product.template</field>
             <field name="inherit_id" ref="product.product_template_form_view" />
             <field name="arch" type="xml">
                 <xpath expr="//field[@name='categ_id']/.." position="after">
                     <group>
                         <field name="is_multi_variants"/>
+                        <field name="attribute_set_id"
+                               attrs="{'invisible':[('is_multi_variants','=',False)]}"/>
                     </group>
                 </xpath>
                 <xpath expr="//form/notebook" position="inside">
                     <page string="Variants">
                         <group colspan="1" col="4" attrs="{'invisible':[('is_multi_variants','=',False)]}">
-                            <field name="dimension_type_ids" nolabel="1" colspan="4" />
-                            <button name="add_all_option" string="Add All Options" type="object" colspan="2"/>
-                            <field name="value_ids" nolabel="1" colspan="4" />
-                            <field name="variant_model_name" colspan="4"/>
-                            <field name="variant_model_name_separator" colspan="4"/>
-                            <field name="code_generator" colspan="4"/>
+                            <button name="%(product_variant_generator.action_add_option)d"
+                                string="Add Option"
+                                type="action"/>
+                            <field name="value_ids" nolabel="1" colspan="4">
+                                <tree string="Values" editable="top">
+                                    <field name="active"/>
+                                    <field name="dimension_id"
+                                           on_change="on_dimension_change(dimension_id, context)"
+                                           domain="[('dimension_id','in',parent.dimension_ids)]" />
+                                    <field name="option_id"/>
+                                    <field name="sequence"/>
+                                </tree>
+                            </field>
+                            <field name="base_default_code" colspan="4"/>
+                            <field name="template_name_id" colspan="4"/>
+                            <field name="template_code_id" colspan="4"/>
                             <field name="variant_track_production" colspan="4"/>
                             <field name="variant_track_incoming" colspan="4"/>
                             <field name="variant_track_outgoing" colspan="4"/>
                             <field name="do_not_generate_new_variant" colspan="4"/>
                             <field name="do_not_update_variant" colspan="4"/>
-                            <button name="button_generate_variants" string="Generate / Update Variants" type="object" colspan="4"/>
+                            <button name="button_generate_variants"
+                                    string="Generate / Update Variants"
+                                    type="object"
+                                    colspan="4"/>
                         </group>
-                        <field name="variant_ids" string="Variants" nolabel="1"  colspan="1">
+                        <separator string="Variants"/>
+                        <field name="variant_ids"
+                               string="Variants"
+                               nolabel="1" 
+                               colspan="1">
                             <tree string="Variants">
                                 <field name="code" />
                                 <field name="name" />
@@ -240,27 +125,8 @@
             <field name="view_mode">tree,form</field>
         </record>
 
-        <menuitem action="product_template" id="menu_template" parent="product.prod_config_main" />
-
-
         <!-- PRODUCT VARIANTS -->
-
-        <!-- TODO remove useless view of product.product in the module product or move this correct view in product, it's depend how the heritage on this view will be managed by the other module -->
-
-        <record id="product_search_form_view_variants" model="ir.ui.view">
-            <field name="name">product.search.form.variants</field>
-            <field name="model">product.product</field>
-            <field name="inherit_id" ref="product.product_search_form_view"/>
-            <field name="arch" type="xml">
-                <field name="categ_id" position="after">
-                    <field name="product_tmpl_id"/>
-                    <field name="variants"/>
-                </field>
-            </field>
-        </record>
-
         <record id="product_variant_form_view" model="ir.ui.view">
-            <field name="name">product.variant.form</field>
             <field name="model">product.product</field>
             <field name="arch" type="xml">
                 <form string="Product Variant" version="7.0">
@@ -280,27 +146,12 @@
                             <field name="default_code" />
                             <field name="active" />
                         </group>
-                        <notebook colspan="4">
-                            <page string="Dimensions">
-                                <separator string="Dimension Values" colspan="4"/>
-                                <field name="dimension_value_ids" context="{'product_tmpl_id':product_tmpl_id}" nolabel="1" colspan="4"/>
-                            </page>
-                            <page string="Prices">
-                                <group>
-                                    <field name="list_price" string="Template Sale Price" readonly="1"/>
-                                    <field name="price_margin" />
-                                    <field name="price_extra" />
-                                    <field name="cost_price_extra"/>
-                                </group>
-                            </page>
-                        </notebook>
                     </sheet>
                 </form>
             </field>
         </record>
 
         <record id="product_variant_tree_view" model="ir.ui.view">
-            <field name="name">product.variant.tree</field>
             <field name="model">product.product</field>
             <field name="arch" type="xml">
                 <tree string="Product Variant">
@@ -308,37 +159,11 @@
                     <field name="name"/>
                     <field name="product_tmpl_id"/>
                     <field name="variants"/>
-                    <field name="price_extra"/>
-                    <field name="cost_price_extra"/>
                 </tree>
             </field>
         </record>
 
-        <record id="product_variant" model="ir.actions.act_window">
-            <field name="name">Product Variants</field>
-            <field name="res_model">product.product</field>
-            <field name="view_type">form</field>
-            <field name="view_mode">tree,form</field>
-        </record>
-
-        <record id="action_variant_tree" model="ir.actions.act_window.view">
-            <field name="sequence" eval="10" />
-            <field name="view_mode">tree</field>
-            <field name="act_window_id" ref="product_variant" />
-            <field name="view_id" ref="product_variant_tree_view" />
-        </record>
-
-        <record id="action_variant_form" model="ir.actions.act_window.view">
-            <field name="sequence" eval="20" />
-            <field name="view_mode">form</field>
-            <field name="act_window_id" ref="product_variant" />
-            <field name="view_id" ref="product_variant_form_view" />
-        </record>
-
-        <menuitem action="product_variant" id="menu_variant" parent="product.prod_config_main" />
-
         <record id="product_normal_variant_form_view" model="ir.ui.view">
-            <field name="name">product.normal.variant.form</field>
             <field name="model">product.product</field>
             <field name="inherit_id" ref="product.product_normal_form_view" />
             <field name="arch" type="xml">
@@ -349,33 +174,54 @@
                     <field name="is_multi_variants" readonly="1"/>
                     <label for="is_multi_variants" />
                 </div>
-                <field name="standard_price" position="replace">
-                    <group name='cost_prices' colspan="2" col="2">
-                        <field name="standard_price" attrs="{'readonly':[('cost_method','=','average')]}"/>
-                        <field name="cost_price_extra" groups="product.group_product_variant"/>
-                    </group>
-                </field>
-                <group name="Weights" position="replace">
-                     <group colspan="4" col="6" name="Weights" groups="product.group_stock_packaging">
-                        <group name="template_weights" string="Template Weights">
-                            <field digits="(14, 3)" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
-                            <field name="weight" attrs="{'readonly':[('type','=','service')]}"/>
-                            <field name="weight_net" attrs="{'readonly':[('type','=','service')]}"/>
-                        </group>
-                        <group name="variant_weights" string="Variant Weights" attrs="{'invisible':[('is_multi_variants','=',False)]}">
-                            <field digits="(14, 3)" name="additional_volume" attrs="{'readonly':[('type','=','service')]}"/>
-                            <field name="additional_weight" attrs="{'readonly':[('type','=','service')]}"/>
-                            <field name="additional_weight_net" attrs="{'readonly':[('type','=','service')]}"/>
-                        </group>
-                        <group name="total_weights" string="Total Weights" attrs="{'invisible':[('is_multi_variants','=',False)]}">
-                            <field digits="(14, 3)" name="total_volume"/>
-                            <field name="total_weight"/>
-                            <field name="total_weight_net"/>
-                        </group>
-                    </group>
-                </group>
-            </field>
-        </record>
+            </field>
+        </record>
+
+        <record id="view_model_string_template_search" model="ir.ui.view">
+            <field name="model">string.template</field>
+            <field name="arch" type="xml">
+                <search string="String Template">
+                    <field name="name"/>
+                </search>
+            </field>
+        </record>
+
+        <record id="view_model_string_template_tree" model="ir.ui.view">
+            <field name="model">string.template</field>
+            <field name="arch" type="xml">
+                <tree string="String Template">
+                    <field name="name"/>
+                    <field name="type"/>
+                </tree>
+            </field>
+        </record>
+        
+        <record id="view_model_string_template_form" model="ir.ui.view">
+            <field name="model">string.template</field>
+            <field name="arch" type="xml">
+                <form string="Label" version="7.0">
+                    <field name="name"/>
+                    <field name="type"/>
+                    <field name="code"/>
+                </form>
+            </field>
+        </record>
+
+        <record id="string_template_form_action" model="ir.actions.act_window">
+            <field name="res_model">string.template</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="view_id" ref="view_model_string_template_tree"/>
+            <field name="search_view_id" ref="view_model_string_template_search"/>
+            <field name="help"></field>
+        </record>
+
+        <menuitem
+            name="Product Code/Name generator"
+            action="string_template_form_action"
+            id="menu_string_template_action"
+            parent="product.prod_config_main"
+            sequence="40"/>
 
     </data>
 </openerp>

=== modified file 'product_variant_generator/security/ir.model.access.csv'
--- product_variant_multi/security/ir.model.access.csv	2013-04-22 21:00:07 +0000
+++ product_variant_generator/security/ir.model.access.csv	2014-06-18 16:37:46 +0000
@@ -1,7 +1,3 @@
 "id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
-"access_product_variant_dimension_type_user","Read access on product.variant.dimension.type for employees","model_product_variant_dimension_type","base.group_user",1,0,0,0
-"access_product_variant_dimension_value_user","Read access on product.variant.dimension.value for employees","model_product_variant_dimension_value","base.group_user",1,0,0,0
-"access_product_variant_dimension_option_user","Read access on product.variant.dimension.option for employees","model_product_variant_dimension_option","base.group_user",1,0,0,0
-"access_product_variant_dimension_type_sale_manager","Full rights on product.variant.dimension.type for sale manager","model_product_variant_dimension_type","base.group_sale_manager",1,1,1,1
-"access_product_variant_dimension_value_sale_manager","Full rights on product.variant.dimension.value for sale manager","model_product_variant_dimension_value","base.group_sale_manager",1,1,1,1
-"access_product_variant_dimension_option_sale_manager","Full rights on product.variant.dimension.option for sale manager","model_product_variant_dimension_option","base.group_sale_manager",1,1,1,1
+"access_dimension_value_user","Read access on dimension.value for employees","model_dimension_value","base.group_user",1,0,0,0
+"access_dimension_value_sale_manager","Full rights on dimension.value for sale manager","model_dimension_value","base.group_sale_manager",1,1,1,1

=== added directory 'product_variant_generator/wizard'
=== added file 'product_variant_generator/wizard/__init__.py'
--- product_variant_generator/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ product_variant_generator/wizard/__init__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2014 Akretion (http://www.akretion.com).
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+from . import product_template_add_option
+

=== added file 'product_variant_generator/wizard/product_template_add_option.py'
--- product_variant_generator/wizard/product_template_add_option.py	1970-01-01 00:00:00 +0000
+++ product_variant_generator/wizard/product_template_add_option.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2014 Akretion (http://www.akretion.com).
+#   @author Sébastien BEAU <sebastien.beau@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+from openerp.osv import fields, orm
+
+
+class ProductTemplateAddOption(orm.TransientModel):
+    _name = 'product.template.add.option'
+    _description = 'Product Template Add Option'
+
+    def _get_option_domain(self, cr, uid, tmpl, context=None):
+        domain = [('attribute_id', 'in', [x.id for x in tmpl.dimension_ids])]
+        existing_option_ids = [value.option_id.id for value in tmpl.value_ids]
+        if existing_option_ids:
+            domain.append(('id', 'not in', existing_option_ids))
+        return domain
+
+    def fields_view_get(self, cr, uid, view_id=None, view_type='form',
+                        context=None, toolbar=False, submenu=False):
+        res = super(ProductTemplateAddOption, self).fields_view_get(
+            cr, uid, view_id=view_id, view_type=view_type,
+            context=context, toolbar=toolbar, submenu=submenu,
+            )
+        tmpl_id = context.get('active_id')
+        if tmpl_id and view_type == 'form':
+            tmpl_obj = self.pool['product.template']
+            tmpl = tmpl_obj.browse(cr, uid, tmpl_id, context=context)
+            res['fields']['option_ids']['domain'] = self._get_option_domain(
+                cr, uid, tmpl, context=context)
+        return res
+
+    _columns = {
+        'option_ids': fields.many2many(
+            'attribute.option',
+            string='Option'),
+    }
+
+    def add_option(self, cr, uid, ids, context=None):
+        tmpl_obj = self.pool['product.template']
+        for wizard in self.browse(cr, uid, ids, context=context):
+            values = []
+            for option in wizard.option_ids:
+                values.append([0, 0, {
+                    'dimension_id': option.attribute_id.id,
+                    'option_id': option.id,
+                    }])
+            tmpl_obj.write(cr, uid, context['active_id'], {
+                'value_ids': values,
+                }, context=context)
+        return True

=== added file 'product_variant_generator/wizard/product_template_add_option_view.xml'
--- product_variant_generator/wizard/product_template_add_option_view.xml	1970-01-01 00:00:00 +0000
+++ product_variant_generator/wizard/product_template_add_option_view.xml	2014-06-18 16:37:46 +0000
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+
+        <record id="action_add_option" model="ir.actions.act_window">
+            <field name="name">Add Option</field>
+            <field name="res_model">product.template.add.option</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="target">new</field>
+        </record>
+
+        <record id="view_product_template_add_option_form" model="ir.ui.view">
+            <field name="model">product.template.add.option</field>
+            <field name="arch" type="xml">
+                <form string="Add Option" version="7.0">
+                    <field name="option_ids"/>
+                    <footer>
+                        <button name="add_option" string="Confirm" type="object" class="oe_highlight"/>
+                        or
+                        <button string="Cancel" class="oe_link" special="cancel" />
+                    </footer>
+
+                </form>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== added directory 'product_variant_generator_price'
=== added file 'product_variant_generator_price/__init__.py'
--- product_variant_generator_price/__init__.py	1970-01-01 00:00:00 +0000
+++ product_variant_generator_price/__init__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2014 Akretion (http://www.akretion.com)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+# flake8: noqa
+
+from . import custom_attributes
+from . import product_variant

=== added file 'product_variant_generator_price/__openerp__.py'
--- product_variant_generator_price/__openerp__.py	1970-01-01 00:00:00 +0000
+++ product_variant_generator_price/__openerp__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,41 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2014 Akretion (http://www.akretion.com)
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    "name": "Product Variant Generator Price",
+    "version": "1.0",
+    "author": "OpenERP SA, Akretion",
+    "category": "Sales Management",
+    "license": "AGPL-3",
+    "summary": "Product Prices with multi-dimension variants",
+    "description": """
+
+    """,
+    "depends" : [
+                "product_variant_generator",
+                ],
+    "data" : [
+        "custom_attributes_view.xml",
+        "product_view.xml",
+    ],
+    "application": True,
+    "active": False,
+    "installable": True,
+}

=== added file 'product_variant_generator_price/custom_attributes.py'
--- product_variant_generator_price/custom_attributes.py	1970-01-01 00:00:00 +0000
+++ product_variant_generator_price/custom_attributes.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,34 @@
+# -*- encoding: utf-8 -*-
+###############################################################################
+#                                                                             #
+#                                                                             #
+#   Copyright (C) 2014 Akretion Chafique DELLI <chafique.delli@xxxxxxxxxxxx>  #
+#                                                                             #
+#   This program is free software: you can redistribute it and/or modify      #
+#   it under the terms of the GNU Affero General Public License as            #
+#   published by the Free Software Foundation, either version 3 of the        #
+#   License, or (at your option) any later version.                           #
+#                                                                             #
+#   This program is distributed in the hope that it will be useful,           #
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of            #
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the             #
+#   GNU Affero General Public License for more details.                       #
+#                                                                             #
+#   You should have received a copy of the GNU Affero General Public License  #
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.     #
+#                                                                             #
+###############################################################################
+
+from openerp.osv import orm, fields
+
+
+class AttributeOption(orm.Model):
+    _inherit = "attribute.option"
+
+    _columns = {
+        'price': fields.float('Price'),
+    }
+
+    _defaults = {
+        'price': 0,
+    }

=== added file 'product_variant_generator_price/custom_attributes_view.xml'
--- product_variant_generator_price/custom_attributes_view.xml	1970-01-01 00:00:00 +0000
+++ product_variant_generator_price/custom_attributes_view.xml	2014-06-18 16:37:46 +0000
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  base_custom_attributes for OpenERP
+  Copyright (C) 2014 Akretion (http://www.akretion.com/)
+  @author: Chafique DELLI <chafique.delli@xxxxxxxxxxxx>
+  The licence is in the file __openerp__.py
+-->
+
+<openerp>
+    <data>
+
+    <!-- ATTRIBUTE OPTION VIEW -->
+        <record id="attribute_option_form_view" model="ir.ui.view">
+            <field name="name">attribute.option.form</field>
+            <field name="model">attribute.option</field>
+            <field name="inherit_id" ref="base_custom_attributes.attribute_option_form_view"/>
+            <field name="arch" type="xml">
+                <field name="code" position="after">
+                    <field name="price"/>
+                </field>
+            </field>
+        </record>
+
+        <record id="attribute_option_tree_view" model="ir.ui.view">
+            <field name="name">attribute.option.tree</field>
+            <field name="model">attribute.option</field>
+            <field name="inherit_id" ref="base_custom_attributes.attribute_option_tree_view"/>
+            <field name="arch" type="xml">
+                <field name="attribute_id" position="after">
+                    <field name="price"/>
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== added file 'product_variant_generator_price/product_variant.py'
--- product_variant_generator_price/product_variant.py	1970-01-01 00:00:00 +0000
+++ product_variant_generator_price/product_variant.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,93 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2014 Akretion (www.akretion.com). All Rights Reserved
+#    @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import fields, orm
+
+
+class ProductProduct(orm.Model):
+    _inherit = "product.product"
+
+    def _get_price_extra(self, cr, uid, ids, field_names=None, arg=False,
+                         context=None):
+        res = {}
+        for product in self.browse(cr, uid, ids, context=context):
+            automatic = False
+            if field_names == 'price_extra':
+                automatic = self.pool.get('product.template').read(
+                    cr, uid,
+                    product.product_tmpl_id.id, ['generate_price_extra'],
+                    context=context)['generate_price_extra']
+                price_extra = 0.00
+                if automatic:
+                    for dimension in product.product_tmpl_id.dimension_ids:
+                        option = self.read(
+                            cr, uid,
+                            product.id, [dimension.name],
+                            context=context)[dimension.name]
+                        if option:
+                            price = self.pool.get('attribute.option').read(
+                                cr, uid, option[0], ['price'], context=context)
+                            price_extra += price['price']
+                else:
+                    price_extra = self.read(
+                        cr, uid,
+                        product.id, ['manual_price_extra'],
+                        context=context)['manual_price_extra']
+                res[product.id] = price_extra
+        return res
+
+    def _set_extra_price(self, cr, uid, id, field_names=None, value=None,
+                         arg=False, context=None):
+        self.write(cr, uid, id, {'manual_price_extra': value}, context=context)
+
+    _columns = {
+        'price_extra': fields.function(_get_price_extra, type='float',
+                                       fnct_inv=_set_extra_price,
+                                       string='Price Extra'),
+        'manual_price_extra': fields.float('Manual Price Extra'),
+    }
+
+
+class DimensionValue(orm.Model):
+    _inherit = "dimension.value"
+
+    _columns = {
+        'price_option': fields.related(
+            'option_id',
+            'price',
+            type='float',
+            relation='product.variant.dimension.option',
+            string="Price",
+            readonly=True),
+    }
+
+    _defaults = {
+        'price_option': 0,
+    }
+
+
+class ProductTemplate(orm.Model):
+    _inherit = "product.template"
+
+    _columns = {
+        'generate_price_extra': fields.boolean("Generate Price Extra"),
+    }

=== added file 'product_variant_generator_price/product_view.xml'
--- product_variant_generator_price/product_view.xml	1970-01-01 00:00:00 +0000
+++ product_variant_generator_price/product_view.xml	2014-06-18 16:37:46 +0000
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+<!--
+  "Product variant generator price" module for OpenERP
+  The licence is in the file __openerp__.py
+  @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+-->
+
+        <!-- PRODUCT TEMPLATE -->
+        <record id="product_variant_price_product_template_form_view" model="ir.ui.view">
+            <field name="name">product.variant.price.product.template.form</field>
+            <field name="model">product.template</field>
+            <field name="inherit_id" ref="product_variant_generator.product_variant_multi_product_template_form_view"/>
+            <field name="arch" type="xml">
+                <field name="option_id" position="after">
+                    <field name="price_option"/>
+                </field>
+                <field name="variant_ids" position="replace">
+                    <field name="variant_ids" string="Variants" nolabel="1"  colspan="1">
+                        <tree string="Variants" editable="top">
+                            <field name="code" readonly="1"/>
+                            <field name="name" readonly="1"/>
+                            <field name="variants" string="Dimension Values" readonly="1"/>
+                            <field name="price_extra"/>
+                            <field name="lst_price"/>
+                        </tree>
+                    </field>
+                </field>
+                <field name="do_not_update_variant" position="after">
+                    <field name="generate_price_extra"/>
+                </field>
+                <field name="list_price" position="replace"/>
+                <field name="is_multi_variants" position="before">
+                    <field name="list_price"/>
+                </field>
+            </field>
+        </record>
+
+        <!-- PRODUCT PRODUCT -->
+        <record id="product_variant_price_product_normal_form_view" model="ir.ui.view">
+            <field name="name">product.variant.price.product.normal.form</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="product.product_normal_form_view"/>
+            <field name="arch" type="xml">
+                <field name="list_price" position="replace">
+                    <field name="lst_price" string="Sale Price"/>
+                </field>
+                <field name="price_margin" position="replace">
+                    <field name="list_price" string="Base Price"/>
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== removed file 'product_variant_multi/demo_data.xml'
--- product_variant_multi/demo_data.xml	2011-08-23 07:46:17 +0000
+++ product_variant_multi/demo_data.xml	1970-01-01 00:00:00 +0000
@@ -1,84 +0,0 @@
-<?xml version="1.0" ?>
-<openerp>
-
-    <data noupdate="1">
-<!--
-        <record id="product_template_mezzanine" model="product.template">
-            <field eval="1.0" name="list_price"/>
-            <field eval="1.0" name="standard_price"/>
-            <field eval="&quot;&quot;&quot;fixed&quot;&quot;&quot;" name="mes_type"/>
-            <field name="uom_id" ref="product.product_uom_unit"/>
-            <field eval="1.0" name="uos_coeff"/>
-            <field eval="1" name="sale_ok"/>
-            <field eval="1" name="purchase_ok"/>
-            <field name="company_id" ref="base.main_company"/>
-            <field name="uom_po_id" ref="product.product_uom_unit"/>
-            <field eval="&quot;&quot;&quot;product&quot;&quot;&quot;" name="type"/>
-            <field eval="&quot;&quot;&quot;Mezzanine&quot;&quot;&quot;" name="name"/>
-            <field name="cost_method">standard</field>
-            <field name="supply_method">produce</field>
-            <field name="procure_method">make_to_order</field>
-            <field eval="0" name="rental"/>
-            <field eval="7.0" name="sale_delay"/>
-            <field name="categ_id" ref="product.cat1"/>
-            <field eval="1.0" name="produce_delay"/>
-        </record>
-        <record id="product_variant_dimension_type_hauteur0" model="product.variant.dimension.type">
-            <field name="product_tmpl_id" ref="product_template_mezzanine"/>
-            <field eval="1" name="allow_custom_value"/>
-            <field eval="&quot;&quot;&quot;Hauteur&quot;&quot;&quot;" name="name"/>
-            <field eval="0" name="sequence"/>
-        </record>
-        <record id="product_variant_dimension_type_largeur0" model="product.variant.dimension.type">
-            <field name="product_tmpl_id" ref="product_template_mezzanine"/>
-            <field eval="1" name="allow_custom_value"/>
-            <field eval="&quot;&quot;&quot;Largeur&quot;&quot;&quot;" name="name"/>
-            <field eval="1" name="sequence"/>
-        </record>
-        <record id="product_variant_dimension_value_0" model="product.variant.dimension.value">
-            <field eval="&quot;&quot;&quot;10&quot;&quot;&quot;" name="name"/>
-            <field name="dimension_id" ref="product_variant_dimension_type_hauteur0"/>
-            <field model="product.template" name="product_tmpl_id" search="[('name','=','Mezzanine')]"/>
-        </record>
-        <record id="product_variant_dimension_value_1" model="product.variant.dimension.value">
-            <field eval="&quot;&quot;&quot;20&quot;&quot;&quot;" name="name"/>
-            <field name="dimension_id" ref="product_variant_dimension_type_hauteur0"/>
-            <field model="product.template" name="product_tmpl_id" search="[('name','=','Mezzanine')]"/>
-        </record>
-
-        <record id="product_variant_dimension_value_2" model="product.variant.dimension.value">
-            <field eval="&quot;&quot;&quot;22&quot;&quot;&quot;" name="name"/>
-            <field name="dimension_id" ref="product_variant_dimension_type_largeur0"/>
-            <field eval="1.0" name="dimension_sequence"/>
-            <field model="product.template" name="product_tmpl_id" search="[('name','=','Mezzanine')]"/>
-        </record>
-        <record id="product_variant_dimension_value_3" model="product.variant.dimension.value">
-            <field eval="&quot;&quot;&quot;33&quot;&quot;&quot;" name="name"/>
-            <field name="dimension_id" ref="product_variant_dimension_type_largeur0"/>
-            <field eval="1.0" name="dimension_sequence"/>
-            <field model="product.template" name="product_tmpl_id" search="[('name','=','Mezzanine')]"/>
-        </record>
-
-        <record id="product_product_mezzanine0" model="product.product">
-            <field eval="1" name="active"/>
-            <field name="product_tmpl_id" ref="product_template_mezzanine"/>
-            <field eval="[(6,0,[ref('product_variant_dimension_value_0'),ref('product_variant_dimension_value_2')])]" name="dimension_value_ids"/>
-        </record>
-        <record id="product_product_mezzanine1" model="product.product">
-            <field eval="1" name="active"/>
-            <field name="product_tmpl_id" ref="product_template_mezzanine"/>
-            <field eval="[(6,0,[ref('product_variant_dimension_value_0'),ref('product_variant_dimension_value_3')])]" name="dimension_value_ids"/>
-        </record>
-        <record id="product_product_mezzanine2" model="product.product">
-            <field eval="1" name="active"/>
-            <field name="product_tmpl_id" ref="product_template_mezzanine"/>
-            <field eval="[(6,0,[ref('product_variant_dimension_value_1'),ref('product_variant_dimension_value_2')])]" name="dimension_value_ids"/>
-        </record>
-        <record id="product_product_mezzanine3" model="product.product">
-            <field eval="1" name="active"/>
-            <field name="product_tmpl_id" ref="product_template_mezzanine"/>
-            <field eval="[(6,0,[ref('product_variant_dimension_value_1'),ref('product_variant_dimension_value_3')])]" name="dimension_value_ids"/>
-        </record>
--->
-    </data>
-</openerp>

=== added directory 'product_variant_simple'
=== added file 'product_variant_simple/__init__.py'
--- product_variant_simple/__init__.py	1970-01-01 00:00:00 +0000
+++ product_variant_simple/__init__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import product

=== added file 'product_variant_simple/__openerp__.py'
--- product_variant_simple/__openerp__.py	1970-01-01 00:00:00 +0000
+++ product_variant_simple/__openerp__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Yannick Vaucher
+#    Copyright 2013 Camptocamp SA
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{'name' : 'Simple Product Variants',
+ 'version' : '1.0',
+ 'category': '',
+ 'description': """
+Simple Product Variants
+=======================
+
+A simple module for handling the product variants.
+It provides views for templates and for variants,
+so they can be created manually. It doesn't provide
+all the bells and whistles of the product_variant_multi
+module (generators wizards, ...).
+
+""",
+ 'author' : 'Camptocamp',
+ 'maintainer': 'Camptocamp',
+ 'website': 'http://www.camptocamp.com/',
+ 'depends' : ['product',
+              ],
+ 'data': ['product_view.xml',
+          'security/security.xml',
+          ],
+ 'test': [],
+ 'installable': True,
+ 'auto_install': False,
+ 'application': True,
+ }

=== added file 'product_variant_simple/product.py'
--- product_variant_simple/product.py	1970-01-01 00:00:00 +0000
+++ product_variant_simple/product.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Guewen Baconnier
+#    Copyright 2013 Camptocamp SA
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from openerp.osv import orm, fields
+
+
+class ProductTemplate(orm.Model):
+    _inherit = 'product.template'
+    _columns = {
+        'variant_ids': fields.one2many(
+            'product.product',
+            'product_tmpl_id',
+            string='Variants'),
+    }

=== added file 'product_variant_simple/product_view.xml'
--- product_variant_simple/product_view.xml	1970-01-01 00:00:00 +0000
+++ product_variant_simple/product_view.xml	2014-06-18 16:37:46 +0000
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <!-- Templates -->
+
+        <record id="product_template_search_view" model="ir.ui.view">
+            <field name="name">product.template.search</field>
+            <field name="model">product.template</field>
+            <field name="arch" type="xml">
+                <search string="Product Templates">
+                    <field name="name" string="Product"/>
+                    <filter string="Services" icon="terp-accessories-archiver" domain="[('type','=','service')]"/>
+                    <filter string="Consumable" name="consumable" icon="terp-accessories-archiver" domain="[('type','=','consu')]" help="Consumable products"/>
+                    <field name="categ_id"/>
+                    <group  expand='0' string='Group by...'>
+                        <filter string='Category'
+                            icon="terp-stock_symbol-selection"
+                            domain="[]"
+                            context="{'group_by': 'categ_id'}"/>
+                        <filter string='Type'
+                            icon="terp-stock_symbol-selection"
+                            domain="[]"
+                            context="{'group_by': 'type'}"/>
+                    </group>
+                </search>
+            </field>
+        </record>
+
+        <record id="product_template" model="ir.actions.act_window">
+            <field name="name">Product Templates</field>
+            <field name="res_model">product.template</field>
+            <field name="view_type">form</field>
+            <field name="domain">[]</field>
+            <field name="view_mode">tree,form</field>
+            <field name="search_view_id" ref="product_template_search_view"/>
+        </record>
+
+        <menuitem action="product_template" id="menu_template"
+            sequence="15"
+            parent="base.menu_product" />
+
+        <!-- Variants -->
+
+        <record id="product_variant_search_view" model="ir.ui.view">
+            <field name="name">product.variant.search</field>
+            <field name="model">product.product</field>
+            <field name="arch" type="xml">
+                <search string="Product Variants">
+                    <field name="product_tmpl_id" string="Product"/>
+                    <field name="name" string="Variant"
+                        filter_domain="['|', '|',
+                                             ('variants', 'ilike', self),
+                                             ('default_code', 'ilike', self)]"/>
+                    <group  expand='0' string='Group by...'>
+                        <filter string='Template'
+                            icon="terp-stock_symbol-selection"
+                            domain="[]"
+                            context="{'group_by': 'product_tmpl_id'}"/>
+                    </group>
+                </search>
+            </field>
+        </record>
+
+        <record id="product_variant" model="ir.actions.act_window">
+            <field name="name">Product Variants</field>
+            <field name="res_model">product.product</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="search_view_id" ref="product_variant_search_view"/>
+        </record>
+
+        <record id="action_variant_tree" model="ir.actions.act_window.view">
+            <field name="sequence" eval="10" />
+            <field name="view_mode">tree</field>
+            <field name="act_window_id" ref="product_variant" />
+            <field name="view_id" ref="product.product_variant_tree_view" />
+        </record>
+
+        <record id="action_variant_form" model="ir.actions.act_window.view">
+            <field name="sequence" eval="20" />
+            <field name="view_mode">form</field>
+            <field name="act_window_id" ref="product_variant" />
+            <field name="view_id" ref="product.product_variant_form_view" />
+        </record>
+
+        <menuitem action="product_variant" id="menu_variant"
+            sequence="20"
+            parent="base.menu_product" />
+
+    </data>
+</openerp>

=== added directory 'product_variant_simple/security'
=== added file 'product_variant_simple/security/security.xml'
--- product_variant_simple/security/security.xml	1970-01-01 00:00:00 +0000
+++ product_variant_simple/security/security.xml	2014-06-18 16:37:46 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+    <!-- Activate the Product Variant group on the Sales Manager -->
+    <record model="res.groups" id="base.group_sale_manager">
+        <field name="implied_ids" eval="[(4, ref('product.group_product_variant'))]"/>
+    </record>
+
+    </data>
+</openerp>
+
+

=== added directory 'sale_product_display'
=== added file 'sale_product_display/__init__.py'
--- sale_product_display/__init__.py	1970-01-01 00:00:00 +0000
+++ sale_product_display/__init__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2013 Akretion (http://www.akretion.com).
+#   @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+import sale

=== added file 'sale_product_display/__openerp__.py'
--- sale_product_display/__openerp__.py	1970-01-01 00:00:00 +0000
+++ sale_product_display/__openerp__.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Author: Chafique Delli
+#    Copyright 2013 Akretion
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{'name' : 'Sale Product Display',
+ 'version' : '1.0',
+ "author": "Akretion",
+ 'category': 'Sales Management',
+ 'description': """
+Sale Product Display
+====================
+
+A simple module for preventing validation of a command that contains a product display.
+
+""",
+ 'author' : 'Akretion',
+ 'maintainer': 'Akretion',
+ 'website': 'http://www.akretion.com/',
+ 'depends' : [
+    'sale',
+    'product_display'
+    ],
+ 'auto_install': True,
+ }

=== added file 'sale_product_display/sale.py'
--- sale_product_display/sale.py	1970-01-01 00:00:00 +0000
+++ sale_product_display/sale.py	2014-06-18 16:37:46 +0000
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+###############################################################################
+#
+#   Module for OpenERP
+#   Copyright (C) 2013 Akretion (http://www.akretion.com).
+#   @author Chafique Delli <chafique.delli@xxxxxxxxxxxx>
+#
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU Affero General Public License as
+#   published by the Free Software Foundation, either version 3 of the
+#   License, or (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU Affero General Public License for more details.
+#
+#   You should have received a copy of the GNU Affero General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+###############################################################################
+
+from openerp.osv import orm, osv
+from openerp.tools.translate import _
+
+
+class SaleOrderLine(orm.Model):
+    _inherit = 'sale.order.line'
+
+
+    def _check_product_display(self, cr, uid, ids, context=None):
+        for record in self.browse(cr, uid, ids, context=context):
+            if record.product_id.is_display:
+                raise osv.except_osv(_('Error'), _('You cannot validate the order with product display %s.')% (record.product_id.name))
+        return True
+
+    _constraints = [
+        (_check_product_display, 'You cannot validate an order with a product display.',
+            [])]


Follow ups