This question has been flagged
2 Replies
2814 Views

Hello community, how can I make the purchase order automatically ordered by product category?

Avatar
Discard
Best Answer

Hi,

The lines in the purchase order lines can be grouped based on the category either manually or by using the code.If manually you can use the  handle widget to group the lines. Once you fill the order lines, in the edit mode, you can see a plus button (a symbol similar to plus button), you can use that button to drag and reposition the lines to required position.


This widget is coming along with the field named sequence defined in the order line model. The line with the small sequence will be displayed in the top. Once you drag and reposition the line, the sequence number will get changed accordingly,


if you need to do the same from the code, assign the same sequence value for the same product category, Suppose if you have category1 and category2 products in the order lines, assign the similar value for the same product category lines, ie, value for the sequence field of the line of product category1 as 2 and other category as 3, then the product category1 products will get displayed first and then the others. This you can be done by overiding the write and create method of the corresponding model.


Thanks

Avatar
Discard
Best Answer

Hi,

   You can Override the Create and Write Methods and write code for rearranging   the products according to their category        

Avatar
Discard
Author

Hello, thanks for the answer!

I do not understand you very well, can you explain to me how I do it?

Sorry I'm not good at odoo, I've been with him for a short time.