OpenERP Addons (modules)

More refactoring needed for partial pickings

Reported by Numérigraphe on 2011-10-07
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenERP Addons
Wishlist
OpenERP R&D Addons Team 2

Bug Description

I would love to make a patch for the trunk for a simple improvement in the partial picking procedure (https://bugs.launchpad.net/openobject-addons/+bug/891664).
In v5, it used to be a straigtforward patch in an old-style wizard.
in V6, some form of refactoring has been made, but the # FIXMEs admit that this was not made right.
Now the whole thing in unreadable, and it makes it hard for the community to contribute improvements.

Amit Parik (amit-parik) on 2011-10-12
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Wishlist
status: New → Confirmed
Numérigraphe (numerigraphe) wrote :

IMHO this wizard need complete rethinking. I'll give it a try because I need it ASAP, so I'll be filing a blueprint soon.
Lionel.

summary: - Absurd refactoring for partial pickings
+ More refactoring needed for partial pickings
Numérigraphe (numerigraphe) wrote :

From my humble point of view, the biggest problems now are in do_partial() in both stock picking and stock move :
1/ there is a lot of duplicate code
2/ it does both stock operations and average price computations - separation of concern would help a lot here. I know nothing about prices
3/ it's not clear to me how the two do_partial()'s are supposed to be used by the rest of the system
When those are solved, the code would be easier to adapt and then we could help improve the process and the UI.
Lionel Sausin.

description: updated
description: updated

It's also on my wishlist. A separate function for average price computation is necessary.

The current computation should also be improved: prices should not be rounded by the currency_obj.compute function. All the decimal precision available is needed in such computation (especially when your currency has no decimal...)

=== modified file 'stock/stock.py'
--- stock/stock.py 2011-11-29 14:23:09 +0000
+++ stock/stock.py 2011-12-06 04:23:09 +0000
@@ -1216,7 +1216,7 @@

                     if qty > 0:
                         new_price = currency_obj.compute(cr, uid, product_currency,
- move_currency_id, product_price)
+ move_currency_id, product_price, False)
                         new_price = uom_obj._compute_price(cr, uid, product_uom, new_price,
                                 product.uom_id.id)
                         if product.qty_available <= 0:
@@ -2457,7 +2457,7 @@
                 qty = uom_obj._compute_qty(cr, uid, product_uom, product_qty, product.uom_id.id)
                 if qty > 0:
                     new_price = currency_obj.compute(cr, uid, product_currency,
- move_currency_id, product_price)
+ move_currency_id, product_price, False)
                     new_price = uom_obj._compute_price(cr, uid, product_uom, new_price,
                             product.uom_id.id)
                     if product.qty_available <= 0:

Numérigraphe (numerigraphe) wrote :

Dear Xavier Fernandez,
I totally agree that the price computation must be in another function, for the sake of separation of concern.
Lionel.

tags: added: partiel-delivery
tags: added: partial-delivery
removed: partiel-delivery
Numérigraphe (numerigraphe) wrote :

The whole think has been rewritten in v7 and v8, so let's say it's fixed.

Changed in openobject-addons:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers