Skip to content

Commit

Permalink
Merge ab94fd1 into da3e482
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeheele committed Jun 1, 2015
2 parents da3e482 + ab94fd1 commit 6cc9797
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Product attribute types
=======================

This module extends product attributes, adds new type range, also the option of
defining if it is required and a default value for the attribute.


Credits
=======

Contributors
------------
* Mikel Arregi <mikelarregi@avanzosc.es>
* Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>
* Pedro M. Baeza <pedro.baeza@serviciobaeza.com>
* Ana Juaristi <ajuaristio@gmail.com>
20 changes: 20 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# -*- encoding: utf-8 -*-
##############################################################################
#
# 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 . import models
40 changes: 40 additions & 0 deletions __openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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 attribute types",
"version": "1.0",
"depends": [
"product",
],
"author": "OdooMRP team,"
"AvanzOSC,"
"Serv. Tecnol. Avanzados - Pedro M. Baeza",
"contributors": [
"Mikel Arregi <mikelarregi@avanzosc.es>",
"Oihane Crucelaegui <oihanecrucelaegi@avanzosc.es>",
"Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>",
"Ana Juaristi <ajuaristio@gmail.com>"
],
"category": "Product Management",
"website": "http://www.odoomrp.com",
'data': [
"views/product_view.xml",
],
'installable': True,
}
67 changes: 67 additions & 0 deletions i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_attribute_types
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-12-30 08:56+0000\n"
"PO-Revision-Date: 2014-12-30 08:56+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_attribute_types
#: field:product.attribute.line,default:0
msgid "Default"
msgstr "Por defecto"

#. module: product_attribute_types
#: field:product.attribute.value,max_range:0
msgid "Max"
msgstr "Max"

#. module: product_attribute_types
#: field:product.attribute.value,min_range:0
msgid "Min"
msgstr "Min"

#. module: product_attribute_types
#: selection:product.attribute,attr_type:0
msgid "Numeric"
msgstr "Numérico"

#. module: product_attribute_types
#: field:product.attribute.value,numeric_value:0
msgid "Numeric Value"
msgstr "Valor numérico"

#. module: product_attribute_types
#: model:ir.model,name:product_attribute_types.model_product_attribute
msgid "Product Attribute"
msgstr "Atributo de producto"

#. module: product_attribute_types
#: selection:product.attribute,attr_type:0
msgid "Range"
msgstr "Rango"

#. module: product_attribute_types
#: field:product.attribute.line,required:0
msgid "Required"
msgstr "Requerido"

#. module: product_attribute_types
#: selection:product.attribute,attr_type:0
msgid "Select"
msgstr "Selección"

#. module: product_attribute_types
#: field:product.attribute,attr_type:0
msgid "Type"
msgstr "Tipo"

67 changes: 67 additions & 0 deletions i18n/product_attribute_types.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_attribute_types
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2014-12-30 08:55+0000\n"
"PO-Revision-Date: 2014-12-30 08:55+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: product_attribute_types
#: field:product.attribute.line,default:0
msgid "Default"
msgstr ""

#. module: product_attribute_types
#: field:product.attribute.value,max_range:0
msgid "Max"
msgstr ""

#. module: product_attribute_types
#: field:product.attribute.value,min_range:0
msgid "Min"
msgstr ""

#. module: product_attribute_types
#: selection:product.attribute,attr_type:0
msgid "Numeric"
msgstr ""

#. module: product_attribute_types
#: field:product.attribute.value,numeric_value:0
msgid "Numeric Value"
msgstr ""

#. module: product_attribute_types
#: model:ir.model,name:product_attribute_types.model_product_attribute
msgid "Product Attribute"
msgstr ""

#. module: product_attribute_types
#: selection:product.attribute,attr_type:0
msgid "Range"
msgstr ""

#. module: product_attribute_types
#: field:product.attribute.line,required:0
msgid "Required"
msgstr ""

#. module: product_attribute_types
#: selection:product.attribute,attr_type:0
msgid "Select"
msgstr ""

#. module: product_attribute_types
#: field:product.attribute,attr_type:0
msgid "Type"
msgstr ""

20 changes: 20 additions & 0 deletions models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# -*- encoding: utf-8 -*-
##############################################################################
#
# 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 . import product
47 changes: 47 additions & 0 deletions models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# 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 import models, fields


class ProductAttribute(models.Model):
_inherit = "product.attribute"

attr_type = fields.Selection(required=True, selection=[
('select', 'Select'),
('range', 'Range'),
('numeric', 'Numeric')], string="Type", default='select')


class ProductAttributeLine(models.Model):
_inherit = "product.attribute.line"

required = fields.Boolean('Required')
default = fields.Many2one('product.attribute.value', 'Default')
attr_type = fields.Selection(string='Type', store=False,
related='attribute_id.attr_type')


class ProductAttributeValue(models.Model):
_inherit = "product.attribute.value"

attr_type = fields.Selection(string='Type',
related='attribute_id.attr_type')
numeric_value = fields.Float('Numeric Value', digits=(12, 6))
min_range = fields.Float('Min', digits=(12, 6))
max_range = fields.Float('Max', digits=(12, 6))
63 changes: 63 additions & 0 deletions views/product_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="varitants_extend_form_view">
<field name="name">product.template.variants.extended</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_only_form_view" />
<field name="arch" type="xml">
<field name="attribute_id" position="after">
<field name="required" />
</field>
<field name="value_ids" position="after">
<field name="attr_type" invisible="1" />
</field>
</field>
</record>

<record model="ir.ui.view"
id="product_attribute_extended_tree_view">
<field name="name">product.attribute.extended.tree</field>
<field name="model">product.attribute</field>
<field name="inherit_id" ref="product.attribute_tree_view" />
<field name="arch" type="xml">
<field name="name" position="after">
<field name="attr_type" />
</field>
</field>
</record>

<record model="ir.ui.view"
id="product_attribute_value_extended_tree_view">
<field name="name">product.attribute.value.extended.tree</field>
<field name="model">product.attribute.value</field>
<field name="inherit_id" ref="product.variants_tree_view" />
<field name="arch" type="xml">
<field name="attribute_id" position="after">
<field name="attr_type" readonly="1"/>
</field>
<field name="name" position="after">
<field name="numeric_value" attrs="{'readonly':[('attr_type','!=','numeric')],'required':[('attr_type','=','numeric')]}" />
<field name="min_range" attrs="{'readonly':[('attr_type','!=','range')],'required':[('attr_type','=','range')]}" />
<field name="max_range" attrs="{'readonly':[('attr_type','!=','range')],'required':[('attr_type','=','range')]}" />
</field>
</field>
</record>

<record model="ir.ui.view" id="product_attribute_value_search_view">
<field name="name">product.attribute.value.search</field>
<field name="model">product.attribute.value</field>
<field name="arch" type="xml">
<search string="Variant Values">
<field name="attribute_id"/>
<field name="attr_type" />
<field name="name"/>
<group expand="0" string="Group By">
<filter string="Attribute" domain="" context="{'group_by':'attribute_id'}"/>
<filter string="Attribute Type" domain="" context="{'group_by':'attr_type'}"/>
</group>
</search>
</field>
</record>
</data>
</openerp>

0 comments on commit 6cc9797

Please sign in to comment.