← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 716289] Re: Pricing Does Not Work When Multiple UOM On A Product

 

I am getting the correct results by inserting the code between the
XXXXXXXX into product.pricelist.py. The surrounding code just shows the
context of where the new code fits in.

                categ_id = products_dict[product_id].categ_id and products_dict[product_id].categ_id.id or False
                categ_ids = _create_parent_category_list(categ_id, [categ_id])
                if categ_ids:
                    categ_where = '(categ_id IN (' + ','.join(map(str, categ_ids)) + '))'
                else:
                    categ_where = '(categ_id IS NULL)'

XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
                # convert sale uom qty into default_uom_qty
                if 'uom' in context:
                    sale_uom = context['uom']                  
                    product_default_uom = product_template_obj.read(cr, uid, [tmpl_id], ['uom_id'])[0]['uom_id'][0]
                    if sale_uom and product_default_uom and product_default_uom != sale_uom:
                        qty = product_uom_obj._compute_qty(cr, uid, sale_uom, qty, to_uom_id=product_default_uom)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX                 
                cr.execute(
                    'SELECT i.*, pl.currency_id '
                    'FROM product_pricelist_item AS i, '
                        'product_pricelist_version AS v, product_pricelist AS pl '
                    'WHERE (product_tmpl_id IS NULL OR product_tmpl_id = %s) '
                        'AND (product_id IS NULL OR product_id = %s) '
                        'AND (' + categ_where + ' OR (categ_id IS NULL)) '
                        'AND price_version_id = %s '
                        'AND (min_quantity IS NULL OR min_quantity <= %s) '
                        'AND i.price_version_id = v.id AND v.pricelist_id = pl.id '
                    'ORDER BY sequence',
                    (tmpl_id, product_id, plversion_ids[0], qty))
                res1 = cr.dictfetchall()

Please note that in addition to this code, the rounding on the default
UOM needs to be set to a 0.001. This ensures that fractions of the
default UOM quantity are passed into the query.

I hope this is of some help.

-- 
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.
https://bugs.launchpad.net/bugs/716289

Title:
  Pricing Does Not Work When Multiple UOM On A Product

Status in OpenERP Modules (addons):
  Invalid
Status in OpenERP Addons 6.0 series:
  Fix Released

Bug description:
  The price lists enable you to establish pricing on the quantity that
  is purchased.

  Lets imagine that 64 units of an item constitute a pallet. You set up
  pricing to say that if 64 units are purchased, then there is a
  discount of say 10% (purchase by the pallet and get a 10% discount).

  Now sell 1 pallet to a customer (as you have already set up a UOM
  with a bigger than reference at a ratio of 64).

  The pricing will not give a 10% discount until you sell 64 of any
  units of measure.

  I would have thought that because of the pallet constituting 64 units,
  that the pricing applied for this single pallet would get the 10%
  discount.

  This pattern can be replicated across all combinations where the UOM
  is different to the UOS.

  This is making it impossible to set up price rules if sell by multiple
  UOM.

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/716289/+subscriptions


References