1
# -*- encoding: utf-8 -*-
2
##############################################################################
4
# Author Guewen Baconnier. Copyright Camptocamp SA
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
##############################################################################
21
from osv import fields, osv
22
from base_external_referentials import external_osv
24
class product_link(external_osv.external_osv):
25
_name = 'product.link'
26
_rec_name = 'linked_product_id'
28
def get_link_type_selection(self, cr, uid, context=None):
29
# selection can be inherited
30
return [('cross_sell', 'Cross-Sell'), ('up_sell', 'Up-Sell'), ('related', 'Related')]
33
'product_id': fields.many2one('product.product', 'Source product', required=True),
34
'linked_product_id': fields.many2one('product.product', 'Linked product', required=True),
35
'type': fields.selection(get_link_type_selection, 'Link type', required=True)
40
class product(osv.osv):
41
"""Inherit product in order to manage product links"""
42
_inherit = 'product.product'
45
'product_link_ids': fields.one2many(