← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 800301] Re: stock function fields of stock.location compute wrong quanties

 

Agree with you Olivier, thanks for catching it and avoiding it to regress
again as it has very bad consequences in a loaded production.

On Wed, Jul 13, 2011 at 12:46 PM, Olivier Dony (OpenERP) <
800301@xxxxxxxxxxxxxxxxxx> wrote:

> Hello Omar,
>
> You are right, the current function fields on stock.location do not
> properly compute the values in case the product_id is not passed in the
> context. And your patch will fix it indeed, so we could apply it.
> However these fields are really not meant to be used without the filter on
> product, because the computation can be very expensive. The product_id
> passed in the context acts as a 'flag' to enable the function fields, and
> will normally be passed only when accessing the 'stock by location' views of
> a product. See bug 777121: in trunk an explicit check was introduced to
> completely disable the computation when product_id is not provided.
>
> So we can apply your patch in trunk, but it will not work for what you want
> to do, due to the patch for bug 777121. Instead, perhaps this could be
> improved by creating 2 functions: one that will compute all the time
> properly, and another one that calls the first one only when a product_id is
> passed in context. For normal views we would use the function field that
> works only when product_id is in context, and people who want the full
> (expensive!) version can use the other field.
> What do you think?
>
> PS: for 6.0 we can't change that, the policy is not to avoid changing
> core code if it's not necessary to use official modules. But it's the
> OPW team that decides for 6.0, so you can try to report it via OPW, and
> they could apply your patch if they think it's safe enough.
>
> ** Changed in: openobject-addons
>   Importance: Undecided => Wishlist
>
> ** Changed in: openobject-addons
>       Status: New => Confirmed
>
> ** Changed in: openobject-addons
>     Assignee: (unassigned) => OpenERP R&D Addons Team 2
> (openerp-dev-addons2)
>
> --
> You received this bug notification because you are a member of OpenERP
> Drivers, which is subscribed to OpenERP Addons.
> https://bugs.launchpad.net/bugs/800301
>
> Title:
>  stock function fields of stock.location compute wrong quanties
>
> Status in OpenERP Modules (addons):
>   Confirmed
>
> Bug description:
>  Hi,
>
>  stock_real, stock_virtual, stock_real_value and stock_virtual_value
>  function fields of stock.location, compute wrong stock quantities if
>  you don't pass in context the product, because in its function
>  _product_value when obtaining the products whose get the stock, it
>  gets products from currently location origin moves + currently
>  location destination moves, then it will have duplicate products if in
>  this location had stock entries and outputs of same product. Check
>  this logic, I see this issue showing these fields in stock.locations
>  tree view. I attach a patch.
>
>  Regards
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/openobject-addons/+bug/800301/+subscriptions
>

-- 
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/800301

Title:
  stock function fields of stock.location compute wrong quanties

Status in OpenERP Modules (addons):
  Confirmed

Bug description:
  Hi,

  stock_real, stock_virtual, stock_real_value and stock_virtual_value
  function fields of stock.location, compute wrong stock quantities if
  you don't pass in context the product, because in its function
  _product_value when obtaining the products whose get the stock, it
  gets products from currently location origin moves + currently
  location destination moves, then it will have duplicate products if in
  this location had stock entries and outputs of same product. Check
  this logic, I see this issue showing these fields in stock.locations
  tree view. I attach a patch.

  Regards

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


References