flectra/addons/website_sale_stock/controllers/main.py
2018-01-16 02:34:37 -08:00

28 lines
1.1 KiB
Python

# -*- coding: utf-8 -*-
# Part of Odoo, Flectra. See LICENSE file for full copyright and licensing details.
from flectra.addons.website_sale.controllers.main import WebsiteSale
from flectra.http import request
from flectra.tools import ustr
from flectra.tools.pycompat import izip
class WebsiteSale(WebsiteSale):
def get_attribute_value_ids(self, product):
res = super(WebsiteSale, self).get_attribute_value_ids(product)
variant_ids = [r[0] for r in res]
# recordsets conserve the order
for r, variant in izip(res, request.env['product.product'].sudo().browse(variant_ids)):
r.extend([{
'virtual_available': variant.virtual_available,
'product_type': variant.type,
'inventory_availability': variant.inventory_availability,
'available_threshold': variant.available_threshold,
'custom_message': variant.custom_message,
'product_template': variant.product_tmpl_id.id,
'cart_qty': variant.cart_qty,
'uom_name': variant.uom_id.name,
}])
return res