Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/e-commerce-addons/7.0-product_links-migr into lp:e-commerce-addons.
Commit message: [MIGR] migration of product_links to OpenERP 7.0 Requested reviews: extra-addons-commiter (extra-addons-commiter) For more details, see: https://code.launchpad.net/~camptocamp/e-commerce-addons/7.0-product_links-migr/+merge/145639 Migration of product_links to openerp 7.0 * changed license GPL to AGPL version 3 * formatting python & xml * removed dependency on stock, replaced by a dependency on product (it was there just for a menu) * moved the menu of product links to the 'Sales' section instead of 'Stock' section -- https://code.launchpad.net/~camptocamp/e-commerce-addons/7.0-product_links-migr/+merge/145639 Your team extra-addons-commiter is requested to review the proposed merge of lp:~camptocamp/e-commerce-addons/7.0-product_links-migr into lp:e-commerce-addons.
=== modified file 'product_links/__openerp__.py' --- product_links/__openerp__.py 2012-12-26 13:24:14 +0000 +++ product_links/__openerp__.py 2013-01-30 15:51:23 +0000 @@ -1,45 +1,47 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright Camptocamp SA +# Author: Guewen Baconnier +# Copyright 2011-2013 Camptocamp SA # # 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. +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# 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 links', - 'version': '6.1.0', - 'category': 'Generic Modules/Products', + 'name': 'Product Links', + 'version': '7.0.0', + 'category': 'Generic Modules', 'description': """ -This module adds links between products : - - cross-selling - - up-selling - - related +This module adds links between products: + +- cross-selling +- up-selling +- related + These types of links are common in e-commerce shops. -It can be used as a base to implement synchronisations with e-commerce (used in magentoerpconnect). +It can be used as a base to implement synchronisations with +e-commerce (as instance, it is used in magentoerpconnect). """, 'author': 'Camptocamp', 'website': 'http://www.camptocamp.com', - 'depends': ['stock'], - 'init_xml': [], - 'update_xml': [ - 'security/ir.model.access.csv', - 'product_links_view.xml', - ], - 'demo_xml': [], - 'installable': False, + 'depends': ['product'], + 'data': [ + 'security/ir.model.access.csv', + 'product_links_view.xml' + ], + 'installable': True, 'active': False, } === modified file 'product_links/product_links.py' --- product_links/product_links.py 2012-11-05 14:27:55 +0000 +++ product_links/product_links.py 2013-01-30 15:51:23 +0000 @@ -1,41 +1,55 @@ -# -*- encoding: utf-8 -*- +# -*- coding: utf-8 -*- ############################################################################## # -# Author Guewen Baconnier. Copyright Camptocamp SA +# Author: Guewen Baconnier +# Copyright 2011-2013 Camptocamp SA # # 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. +# 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 General Public License for more details. +# GNU Affero General Public License for more details. # -# You should have received a copy of the GNU General Public License +# 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.orm import Model -from openerp.osv import fields - -class product_link(Model): +from openerp.osv import orm, fields + + +class product_link(orm.Model): _name = 'product.link' _rec_name = 'linked_product_id' def get_link_type_selection(self, cr, uid, context=None): - # selection can be inherited - return [('cross_sell', 'Cross-Sell'), ('up_sell', 'Up-Sell'), ('related', 'Related')] + # selection can be inherited and extended + return [('cross_sell', 'Cross-Sell'), + ('up_sell', 'Up-Sell'), + ('related', 'Related')] def _get_link_type_selection(self, cr, uid, context=None): return self.get_link_type_selection(cr, uid, context=context) _columns = { - 'product_id': fields.many2one('product.product', 'Source product', required=True, ondelete='cascade'), - 'linked_product_id': fields.many2one('product.product', 'Linked product', required=True, ondelete='cascade'), - 'type': fields.selection(_get_link_type_selection, 'Link type', required=True), + 'product_id': fields.many2one( + 'product.product', + 'Source product', + required=True, + ondelete='cascade'), + 'linked_product_id': fields.many2one( + 'product.product', + 'Linked product', + required=True, + ondelete='cascade'), + 'type': fields.selection( + _get_link_type_selection, + string='Link type', + required=True), 'is_active': fields.boolean('Active'), } @@ -45,21 +59,20 @@ def _get_default_product_id(self, cr, uid, context=None): if context is None: context = {} - return context.get('product_id') + return context.get('product_id', False) _defaults = { 'is_active': True, 'product_id': _get_default_product_id, } -class product(Model): - """Inherit product in order to manage product links""" + +class product(orm.Model): _inherit = 'product.product' _columns = { 'product_link_ids': fields.one2many( 'product.link', 'product_id', - 'Product links', - ), + string='Product links'), } === modified file 'product_links/product_links_view.xml' --- product_links/product_links_view.xml 2012-11-05 14:27:55 +0000 +++ product_links/product_links_view.xml 2013-01-30 15:51:23 +0000 @@ -3,14 +3,13 @@ <data> <record model="ir.ui.view" id="product_link_form"> - <!-- must be unique in this module. --> <field name="name">product.link.form</field> <field name="model">product.link</field> - <!--parent python entity --> - <field name="type">form</field> <field name="arch" type="xml"> <form string="Product Links"> - <field name="product_id" invisible="not context.get('product_link_main_view')" select="1"/> + <field name="product_id" + invisible="not context.get('product_link_main_view')" + select="1"/> <field name="is_active" select="1" /> <field name="linked_product_id" select="1" /> <field name="type" select="1" /> @@ -19,14 +18,12 @@ </record> <record model="ir.ui.view" id="product_link_tree"> - <!-- must be unique in this module. --> <field name="name">product.link.tree</field> <field name="model">product.link</field> - <!--parent python entity --> - <field name="type">tree</field> <field name="arch" type="xml"> <tree string="Product Links"> - <field name="product_id" invisible="not context.get('product_link_main_view')" /> + <field name="product_id" + invisible="not context.get('product_link_main_view')" /> <field name="is_active" /> <field name="linked_product_id" /> <field name="type" /> @@ -38,11 +35,11 @@ <field name="name">product.normal.form.custom.link</field> <field name="model">product.product</field> <field name="inherit_id" ref="product.product_normal_form_view"/> - <field name="type">form</field> <field name="arch" type="xml"> <notebook position="inside"> <page string="Product Links"> - <field name="product_link_ids" colspan="4" nolabel="1" context="{'product_id': active_id}"/> + <field name="product_link_ids" colspan="4" + nolabel="1" context="{'product_id': active_id}"/> </page> </notebook> </field> @@ -56,8 +53,10 @@ <field name="context">{'product_link_main_view': True}</field> </record> - <menuitem id="product_link_menu" parent="stock.menu_product_in_config_stock" - action="product_link_action" sequence="100"/> + <menuitem id="product_link_menu" + parent="base.menu_product" + action="product_link_action" + sequence="100"/> </data> </openerp>
-- Mailing list: https://launchpad.net/~savoirfairelinux-openerp Post to : [email protected] Unsubscribe : https://launchpad.net/~savoirfairelinux-openerp More help : https://help.launchpad.net/ListHelp

