diff --git a/addons/product/product.py b/addons/product/product.py index a756a116994..f04c53b2cd5 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -945,6 +945,14 @@ class product_product(osv.osv): break return res + def _get_pricelist_items(self, cr, uid, ids, field_name, args, context=None): + res = {} + for prod_id in ids: + prod = self.browse(cr, uid, [prod_id], context=context) + item_ids = self.pool['product.pricelist.item'].search(cr, uid, ['|', ('product_id', '=', prod_id), ('product_tmpl_id', '=', prod.product_tmpl_id.id)], context=context) + res[prod_id] = item_ids + return res + _columns = { 'price': fields.function(_product_price, fnct_inv=_set_product_lst_price, type='float', string='Price', digits_compute=dp.get_precision('Product Price')), 'price_extra': fields.function(_get_price_extra, type='float', string='Variant Extra Price', help="This is the sum of the extra price of all attributes", digits_compute=dp.get_precision('Product Price')), @@ -981,6 +989,7 @@ class product_product(osv.osv): groups="base.group_user", string="Cost"), 'volume': fields.float('Volume', help="The volume in m3."), 'weight': fields.float('Weight', digits_compute=dp.get_precision('Stock Weight'), help="The weight of the contents in Kg, not including any packaging, etc."), + 'pricelist_item_ids': fields.function(_get_pricelist_items, type='many2many', relation='product.pricelist.item', string='Pricelist Items'), } _defaults = { diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index f8e21db754e..2e52604eb0c 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -469,6 +469,22 @@ + + + + + + + + + + + + + + + +