Community mailing list archives

Re: Ordering of items in Packs based on rules.

John Pia Jr
- 12/07/2014 05:53:10

Wow Ferdinand!

Thank you so much for this. I will be digging into this to see if it can solve my need.

Thank you again for your time.

On Dec 7, 2014 4:09 AM, "Ferdinand Gassauer" <> wrote:
probably you could use

you could supply the order criteria as parameter

Variant of field type one2many for sorted associations


| import one2many_sorted
| ...
|    _columns = \
|        { 'partner_ids'  : one2many_sorted.one2many_sorted
|            ( 'res.partner'
|            , 'parent_id'
|            , 'Sorted Partner List'
|            , order='name.upper(), title'
|            , search=[('is_company', '=', 'False')]
|            , set={'is_company' : False}
|            )
|        }
| ...

In the example above, the primary sort criteria is "name" (not 
case-sensitive), the secondary is "title".
Only partners that are physical persons (not is_company) are selected - 
and only those can be added.

Another possibility is to define a text-property with naming convention 
(in the example above this would be "res.partner.parent_id.order").
The value of this property is the sort criteria.

The advantage of properties is, that they can by company-individual.

A third possibility is to hand over a "context" key named 
"one2many_sorted_order" that contains the name of a property.

If no "context" key is found, then the property with the naming 
convention is taken.
If no property is defined, the programmed sort order is taken.
Otherwise no sorting takes place.

many2many_sorted has a similar syntax but without search feature.

Note that it works on translated term, not only the text stored in the DB !

On 2014-12-06 10:33, John Pia Jr wrote:
> I have a need to be able to define an order of items in a pack 
> (pallet) based on rules (mainly surrounding weight).
> Basically I need to the system to automatically order items in a pack 
> in a certain way that will not disrupt the integrity of the products 
> sold.
> We are one of the large a test fresh mushroom producers in the world. 
> We sell over 1600 skus of mushrooms (mainly just in different 
> packages/containers). Because it is a produce product, they weight 
> distribution of  the various products need to be right, if not product 
> will be damaged.
> Right now we do this manually. We have one guy who knows how's to 
> build all the pallets so we does this and then supplies the pallet 
> builders with a ordered list.
> basically I need the system to be able to follow the example below.
> Let's say we have 3 products on a single pallet that is going out the 
> door (post manufacturing)
> Product A = 10LBs / unit (in cardboard box)
> Product B = 10LB / unit (in plastic box)
> Product C  = 5LB / unit in cardboard.
> Let's say pur order has 30 of this each products.
> We would need to stack the pallet like this:
> From bottom to top:
> B > A > C
> I would like for this to be don't automatically, but with the option 
> to manually reorder if required.
> Anyone ever have a need for this??
> _______________________________________________
> Mailing-List:
> Post to:
> Unsubscribe:

Post to: