More refactoring needed for partial pickings

Bug #870090 reported by Numérigraphe
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
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)
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 2 (openerp-dev-addons2)
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
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
Revision history for this message
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
Revision history for this message
Xavier Fernandez http://www.smile.fr (xav-fernandez) wrote :

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:

Revision history for this message
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
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.