Browse Source

[ADD]product_m2mcategories:Allows for provision of multiple categories for a single product

pull/186/head
Sharoon Thomas 15 years ago
committed by sebastien beau
parent
commit
3e658832a3
  1. 18
      product_m2mcategories/__init__.py
  2. 39
      product_m2mcategories/__terp__.py
  3. 25
      product_m2mcategories/product.py
  4. 33
      product_m2mcategories/product_view.xml

18
product_m2mcategories/__init__.py

@ -0,0 +1,18 @@
#########################################################################
# Copyright (C) 2009 Sharoon Thomas & Open ERP Community #
# #
#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/>. #
#########################################################################
import product

39
product_m2mcategories/__terp__.py

@ -0,0 +1,39 @@
#########################################################################
# Copyright (C) 2009 Sharoon Thomas & Open ERP Community #
# #
#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 - Many Categories",
"version" : "1.0.2",
"author" : "Sharoon Thomas",
"website" : "",
"category" : "Added functionality",
"depends" : ['base','product'],
"description": """
This module Extends the existing functionality of Open ERP Products (One product - One Catgory)
to One product -> Many Categories
*Note: This module was built generically but in focus of the Magento Open ERP connector
""",
"init_xml": [],
"update_xml": [
'product_view.xml'
],
"installable": True,
"active": False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

25
product_m2mcategories/product.py

@ -0,0 +1,25 @@
#########################################################################
# Copyright (C) 2009 Sharoon Thomas & Open ERP Community #
# #
#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 osv import osv,fields
class product_product(osv.osv):
_inherit = "product.template"
_columns = {
'categ_id': fields.many2one('product.category','Pricing/Primary Category',change_default=True),
'categ_ids': fields.many2many('product.category','product_categ_rel','product_id','categ_id','Product Categories')
}
product_product()

33
product_m2mcategories/product_view.xml

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="product_normal_form_view_rem_categid" model="ir.ui.view">
<field name="name">product.normal.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="type">form</field>
<field eval="7" name="priority"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page/group/field[@name='categ_id']" position="replace"/>
</field>
</record>
<record id="product_normal_form_view_add_categids" model="ir.ui.view">
<field name="name">product.normal.form</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view" />
<field name="type">form</field>
<field eval="7" name="priority"/>
<field name="arch" type="xml">
<xpath expr="/form/notebook/page[@string='Information']" position="after">
<page string="Categorisation">
<field name="categ_id" colspan="2"/>
<newline/>
<separator string="Classification Categories" colspan="2"/>
<newline/>
<field name="categ_ids" nolabel="1" colspan="2"/>
</page>
</xpath>
</field>
</record>
</data>
</openerp>
Loading…
Cancel
Save