Merge lp:~camptocamp/e-commerce-addons/7.0-product_links-migr into lp:~extra-addons-commiter/e-commerce-addons/7.0

Proposed by Guewen Baconnier @ Camptocamp
Status: Merged
Merged at revision: 282
Proposed branch: lp:~camptocamp/e-commerce-addons/7.0-product_links-migr
Merge into: lp:~extra-addons-commiter/e-commerce-addons/7.0
Diff against target: 242 lines (+70/-56)
3 files modified
product_links/__openerp__.py (+25/-23)
product_links/product_links.py (+34/-21)
product_links/product_links_view.xml (+11/-12)
To merge this branch: bzr merge lp:~camptocamp/e-commerce-addons/7.0-product_links-migr
Reviewer Review Type Date Requested Status
Alexandre Fayolle - camptocamp code review, no test Approve
Review via email: mp+145639@code.launchpad.net

Commit message

[MIGR] migration of product_links to OpenERP 7.0

Description of the change

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

To post a comment you must log in.
Revision history for this message
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote :

s/as instance/for instance/

review: Approve (code review, no test)
283. By Guewen Baconnier @ Camptocamp

[FIX] typo, write 'for instance' and not 'as instance' 1000 times on a blackboard

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product_links/__openerp__.py'
2--- product_links/__openerp__.py 2012-12-26 13:24:14 +0000
3+++ product_links/__openerp__.py 2013-01-30 16:16:21 +0000
4@@ -1,45 +1,47 @@
5-# -*- encoding: utf-8 -*-
6+# -*- coding: utf-8 -*-
7 ##############################################################################
8 #
9-# Copyright Camptocamp SA
10+# Author: Guewen Baconnier
11+# Copyright 2011-2013 Camptocamp SA
12 #
13 # This program is free software: you can redistribute it and/or modify
14-# it under the terms of the GNU General Public License as published by
15-# the Free Software Foundation, either version 3 of the License, or
16-# (at your option) any later version.
17+# it under the terms of the GNU Affero General Public License as
18+# published by the Free Software Foundation, either version 3 of the
19+# License, or (at your option) any later version.
20 #
21 # This program is distributed in the hope that it will be useful,
22 # but WITHOUT ANY WARRANTY; without even the implied warranty of
23 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24-# GNU General Public License for more details.
25+# GNU Affero General Public License for more details.
26 #
27-# You should have received a copy of the GNU General Public License
28+# You should have received a copy of the GNU Affero General Public License
29 # along with this program. If not, see <http://www.gnu.org/licenses/>.
30 #
31 ##############################################################################
32
33 {
34- 'name': 'Product links',
35- 'version': '6.1.0',
36- 'category': 'Generic Modules/Products',
37+ 'name': 'Product Links',
38+ 'version': '7.0.0',
39+ 'category': 'Generic Modules',
40 'description': """
41-This module adds links between products :
42- - cross-selling
43- - up-selling
44- - related
45+This module adds links between products:
46+
47+- cross-selling
48+- up-selling
49+- related
50+
51 These types of links are common in e-commerce shops.
52
53-It can be used as a base to implement synchronisations with e-commerce (used in magentoerpconnect).
54+It can be used as a base to implement synchronisations with
55+e-commerce (for instance, it is used in magentoerpconnect).
56 """,
57 'author': 'Camptocamp',
58 'website': 'http://www.camptocamp.com',
59- 'depends': ['stock'],
60- 'init_xml': [],
61- 'update_xml': [
62- 'security/ir.model.access.csv',
63- 'product_links_view.xml',
64- ],
65- 'demo_xml': [],
66- 'installable': False,
67+ 'depends': ['product'],
68+ 'data': [
69+ 'security/ir.model.access.csv',
70+ 'product_links_view.xml'
71+ ],
72+ 'installable': True,
73 'active': False,
74 }
75
76=== modified file 'product_links/product_links.py'
77--- product_links/product_links.py 2012-11-05 14:27:55 +0000
78+++ product_links/product_links.py 2013-01-30 16:16:21 +0000
79@@ -1,41 +1,55 @@
80-# -*- encoding: utf-8 -*-
81+# -*- coding: utf-8 -*-
82 ##############################################################################
83 #
84-# Author Guewen Baconnier. Copyright Camptocamp SA
85+# Author: Guewen Baconnier
86+# Copyright 2011-2013 Camptocamp SA
87 #
88 # This program is free software: you can redistribute it and/or modify
89-# it under the terms of the GNU General Public License as published by
90-# the Free Software Foundation, either version 3 of the License, or
91-# (at your option) any later version.
92+# it under the terms of the GNU Affero General Public License as
93+# published by the Free Software Foundation, either version 3 of the
94+# License, or (at your option) any later version.
95 #
96 # This program is distributed in the hope that it will be useful,
97 # but WITHOUT ANY WARRANTY; without even the implied warranty of
98 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
99-# GNU General Public License for more details.
100+# GNU Affero General Public License for more details.
101 #
102-# You should have received a copy of the GNU General Public License
103+# You should have received a copy of the GNU Affero General Public License
104 # along with this program. If not, see <http://www.gnu.org/licenses/>.
105 #
106 ##############################################################################
107
108-from openerp.osv.orm import Model
109-from openerp.osv import fields
110-
111-class product_link(Model):
112+from openerp.osv import orm, fields
113+
114+
115+class product_link(orm.Model):
116 _name = 'product.link'
117 _rec_name = 'linked_product_id'
118
119 def get_link_type_selection(self, cr, uid, context=None):
120- # selection can be inherited
121- return [('cross_sell', 'Cross-Sell'), ('up_sell', 'Up-Sell'), ('related', 'Related')]
122+ # selection can be inherited and extended
123+ return [('cross_sell', 'Cross-Sell'),
124+ ('up_sell', 'Up-Sell'),
125+ ('related', 'Related')]
126
127 def _get_link_type_selection(self, cr, uid, context=None):
128 return self.get_link_type_selection(cr, uid, context=context)
129
130 _columns = {
131- 'product_id': fields.many2one('product.product', 'Source product', required=True, ondelete='cascade'),
132- 'linked_product_id': fields.many2one('product.product', 'Linked product', required=True, ondelete='cascade'),
133- 'type': fields.selection(_get_link_type_selection, 'Link type', required=True),
134+ 'product_id': fields.many2one(
135+ 'product.product',
136+ 'Source product',
137+ required=True,
138+ ondelete='cascade'),
139+ 'linked_product_id': fields.many2one(
140+ 'product.product',
141+ 'Linked product',
142+ required=True,
143+ ondelete='cascade'),
144+ 'type': fields.selection(
145+ _get_link_type_selection,
146+ string='Link type',
147+ required=True),
148 'is_active': fields.boolean('Active'),
149 }
150
151@@ -45,21 +59,20 @@
152 def _get_default_product_id(self, cr, uid, context=None):
153 if context is None:
154 context = {}
155- return context.get('product_id')
156+ return context.get('product_id', False)
157
158 _defaults = {
159 'is_active': True,
160 'product_id': _get_default_product_id,
161 }
162
163-class product(Model):
164- """Inherit product in order to manage product links"""
165+
166+class product(orm.Model):
167 _inherit = 'product.product'
168
169 _columns = {
170 'product_link_ids': fields.one2many(
171 'product.link',
172 'product_id',
173- 'Product links',
174- ),
175+ string='Product links'),
176 }
177
178=== modified file 'product_links/product_links_view.xml'
179--- product_links/product_links_view.xml 2012-11-05 14:27:55 +0000
180+++ product_links/product_links_view.xml 2013-01-30 16:16:21 +0000
181@@ -3,14 +3,13 @@
182 <data>
183
184 <record model="ir.ui.view" id="product_link_form">
185- <!-- must be unique in this module. -->
186 <field name="name">product.link.form</field>
187 <field name="model">product.link</field>
188- <!--parent python entity -->
189- <field name="type">form</field>
190 <field name="arch" type="xml">
191 <form string="Product Links">
192- <field name="product_id" invisible="not context.get('product_link_main_view')" select="1"/>
193+ <field name="product_id"
194+ invisible="not context.get('product_link_main_view')"
195+ select="1"/>
196 <field name="is_active" select="1" />
197 <field name="linked_product_id" select="1" />
198 <field name="type" select="1" />
199@@ -19,14 +18,12 @@
200 </record>
201
202 <record model="ir.ui.view" id="product_link_tree">
203- <!-- must be unique in this module. -->
204 <field name="name">product.link.tree</field>
205 <field name="model">product.link</field>
206- <!--parent python entity -->
207- <field name="type">tree</field>
208 <field name="arch" type="xml">
209 <tree string="Product Links">
210- <field name="product_id" invisible="not context.get('product_link_main_view')" />
211+ <field name="product_id"
212+ invisible="not context.get('product_link_main_view')" />
213 <field name="is_active" />
214 <field name="linked_product_id" />
215 <field name="type" />
216@@ -38,11 +35,11 @@
217 <field name="name">product.normal.form.custom.link</field>
218 <field name="model">product.product</field>
219 <field name="inherit_id" ref="product.product_normal_form_view"/>
220- <field name="type">form</field>
221 <field name="arch" type="xml">
222 <notebook position="inside">
223 <page string="Product Links">
224- <field name="product_link_ids" colspan="4" nolabel="1" context="{'product_id': active_id}"/>
225+ <field name="product_link_ids" colspan="4"
226+ nolabel="1" context="{'product_id': active_id}"/>
227 </page>
228 </notebook>
229 </field>
230@@ -56,8 +53,10 @@
231 <field name="context">{'product_link_main_view': True}</field>
232 </record>
233
234- <menuitem id="product_link_menu" parent="stock.menu_product_in_config_stock"
235- action="product_link_action" sequence="100"/>
236+ <menuitem id="product_link_menu"
237+ parent="base.menu_product"
238+ action="product_link_action"
239+ sequence="100"/>
240
241 </data>
242 </openerp>

Subscribers

People subscribed via source and target branches