[IMP] product: category and website_sale controllers

bzr revid: chm@openerp.com-20140114142940-xpshp8e6trio5mxc
This commit is contained in:
Christophe Matthieu 2014-01-14 15:29:40 +01:00
parent 9e0df88d7a
commit 4e94761a8e
2 changed files with 11 additions and 11 deletions

View File

@ -400,7 +400,7 @@
<field name="name">product.public.category.form</field>
<field name="model">product.public.category</field>
<field name="arch" type="xml">
<form string="Product Categories" version="7.0">
<form string="Pos/Public Categories" version="7.0">
<sheet>
<field name="image_medium" widget='image' class="oe_avatar oe_right"/>
<div class="oe_left">
@ -426,7 +426,7 @@
</field>
</record>
<record id="product_public_category_action" model="ir.actions.act_window">
<field name="name">Public Categories</field>
<field name="name">Pos/Public Product Categories</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.public.category</field>
<field name="view_type">form</field>
@ -445,7 +445,7 @@
</p>
</field>
</record>
<menuitem action="product_public_category_action" id="menu_product_public_category" parent="base.menu_product" sequence="10" />
<menuitem action="product_public_category_action" id="menu_product_public_category" parent="prod_config_main" sequence="10" />
<!-- END -->
<!-- Unit of Measure -->

View File

@ -199,10 +199,10 @@ class Ecommerce(http.Controller):
@website.route([
'/shop/',
'/shop/page/<int:page>/',
'/shop/category/<int:category>/',
'/shop/category/<int:category>/page/<int:page>/'
'/shop/category/<model("product.public.category"):category>/',
'/shop/category/<model("product.public.category"):category>/page/<int:page>/'
], type='http', auth="public", multilang=True)
def shop(self, category=0, page=0, filters='', search='', **post):
def shop(self, category=None, page=0, filters='', search='', **post):
cr, uid, context = request.cr, request.uid, request.context
product_obj = request.registry.get('product.template')
domain = request.registry.get('website').ecommerce_get_product_domain()
@ -211,7 +211,7 @@ class Ecommerce(http.Controller):
('name', 'ilike', "%%%s%%" % search),
('description', 'ilike', "%%%s%%" % search)]
if category:
domain.append(('product_variant_ids.public_categ_id', 'child_of', category))
domain.append(('product_variant_ids.public_categ_id', 'child_of', category.id))
if filters:
filters = simplejson.loads(filters)
if filters:
@ -286,7 +286,7 @@ class Ecommerce(http.Controller):
}
return request.website.render("website_sale.product", values)
@website.route(['/shop/product/<int:product_template_id>/comment'], type='http', auth="public")
@website.route(['/shop/product/comment'], type='http', auth="public", methods=['POST'])
def product_comment(self, product_template_id, **post):
cr, uid, context = request.cr, request.uid, request.context
if post.get('comment'):
@ -298,11 +298,11 @@ class Ecommerce(http.Controller):
context=dict(context, mail_create_nosubcribe=True))
return werkzeug.utils.redirect(request.httprequest.referrer + "#comments")
@website.route(['/shop/add_product/', '/shop/category/<int:cat_id>/add_product/'], type='http', auth="user", multilang=True, methods=['POST'])
def add_product(self, name="New Product", cat_id=0, **post):
@website.route(['/shop/add_product/'], type='http', auth="user", multilang=True, methods=['POST'])
def add_product(self, name="New Product", category=0, **post):
Product = request.registry.get('product.product')
product_id = Product.create(request.cr, request.uid, {
'name': name, 'public_categ_id': cat_id
'name': name, 'public_categ_id': category
}, context=request.context)
product = Product.browse(request.cr, request.uid, product_id, context=request.context)