Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
4 Răspunsuri
12339 Vizualizări

Hi everybody,

Someone knows how to sort products by alphabetical in "Products by categories" ? When I add _order... in my python file it works only on the total list of products "Products".

Thanks in advance for your help.

JMB

Imagine profil
Abandonează
Cel mai bun răspuns

image description

Is this what you wanted.. ? Here you can See that i clicked on name (column header) And it got sorted in alphabetical Order.

Sorry if i have mistook your requiremet

Imagine profil
Abandonează
Autor

Thanks for your answer. Unfortunately it's not this list that I wanna sort but the hierarchical tree (where it's possible to click on a category and then the subcategory opens). It's the first screen when you click on the menu "Products by Category".

Cel mai bun răspuns

I want to sort categories e.g. alphabetically. I haven't understood how to do this. Who would provide full instructions?

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Thanks for your answer but it doesn't work. Indeed, it's not possible to click on the title "name".

Do you see another solution ? I think I have to modify something in a js file.

Imagine profil
Abandonează
Cel mai bun răspuns

You need to modify the action and sort by the name, write a small module, like this:

product.py file below from openerp.osv import osv

class product_category(osv.osv):

_inherit = "product.category"
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
    if context is None:
        context = {}
    if context and context.get('order_name', False):
        order = 'name'
    return super(product_category, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)

product_category()

XML - product_view.xml <openerp> <data> <record id="product.product_category_action" model="ir.actions.act_window"> <field name="context">{'order_name':True}</field> </record>

</data>

</openerp>

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
0
mar. 15
3812
1
dec. 22
5816
16
sept. 24
77174
3
oct. 22
9994
1
dec. 21
10156