~sebastien.beau/e-commerce-addons/e-commerce-addons-invoice-payment-method

« back to all changes in this revision

Viewing changes to base_sale_multichannels/product.py

  • Committer: Guewen Baconnier
  • Author(s): Sébastien Beau
  • Date: 2013-01-14 09:01:40 UTC
  • mfrom: (279.1.2 e-commerce-addons)
  • Revision ID: guewen.baconnier@camptocamp.com-20130114090140-5ngativdwaj64jaw
[FIX] base_sale_multichannels: fix export link between category and product

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
                                                            context=context)
67
67
        return res
68
68
 
69
 
 
70
 
    def _get_categories_ids_for_shop(self, cr, uid, product_id, shop_id, context=None):
71
 
        shop_categ_ids = self.pool.get('sale.shop').read(cr, uid, shop_id,
72
 
                                ['exportable_category_ids'],
73
 
                                context=context)['exportable_category_ids']
74
 
        product = self.read(cr, uid, product_id, ['categ_ids', 'categ_id'], context=context)
75
 
        product_categ_ids = product['categ_ids']
76
 
        if product['categ_id'][0] not in product_categ_ids:
77
 
            product_categ_ids.append(product['categ_id'][0])
78
 
        res = []
79
 
        for categ in product_categ_ids:
80
 
            if categ in shop_categ_ids:
81
 
                res.append(categ)
82
 
        return res
83
 
 
84
69
    def _get_categories_ids_for_shop(self, cr, uid, product_id, shop_id, context=None):
85
70
        shop_obj = self.pool.get('sale.shop')
86
71
        shop_values = shop_obj.read(cr, uid, shop_id,
90
75
        product = self.read(cr, uid, product_id, ['categ_ids', 'categ_id'], context=context)
91
76
        product_categ_ids = set(product['categ_ids'])
92
77
        product_categ_ids.add(product['categ_id'][0])
93
 
        return list(prod_categ_ids & shop_categ_ids)
 
78
        return list(product_categ_ids & shop_categ_ids)
94
79
 
95
80
    def _get_or_create_ext_category_ids_for_shop(self, cr, uid, external_session, product_id, context=None):
96
81
        res = []
99
84
            res.append(categ_obj.get_or_create_extid(cr, uid, external_session, oe_categ_id, context=context))
100
85
        return res
101
86
 
102
 
 
103
 
 
104
87
class product_template(Model):
105
88
    _inherit = 'product.template'
106
89