Somesh Khare(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-577140-opw-skh into
lp:openobject-addons.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-577140-opw-skh/+merge/137563
Hello Sir,
"FIX] rounding issue with same or different uom in partial picking wizard"
Steps :
1). Create a purchase order for product = Wood 2mm with quantity = 27.400
2). Confirm the purchase order , Goto reception and try to process & validate
the 27.400 (with either UOM = m(meter) or cm(centi-meter)) quantity in wizard.
The warning message is appeared.
Code is forwarded from 6.1 addons from revision: 6961, This branch fixes the
issue, Kindly review the branch and please share your view on it
Regards,
Somesh Khare
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-577140-opw-skh/+merge/137563
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-577140-opw-skh.
=== modified file 'stock/wizard/stock_partial_picking.py'
--- stock/wizard/stock_partial_picking.py 2012-11-10 13:43:52 +0000
+++ stock/wizard/stock_partial_picking.py 2012-12-03 13:28:25 +0000
@@ -23,6 +23,7 @@
from lxml import etree
from osv import fields, osv
from tools.misc import DEFAULT_SERVER_DATETIME_FORMAT
+from tools.float_utils import float_compare
import decimal_precision as dp
from tools.translate import _
@@ -176,7 +177,7 @@
qty_in_line_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, line_uom.id)
if line_uom.factor and line_uom.factor <> 0:
- if qty_in_line_uom <> wizard_line.quantity:
+ if float_compare(qty_in_line_uom, wizard_line.quantity, precision_rounding=line_uom.rounding) != 0:
raise osv.except_osv(_('Warning!'), _('The unit of measure rounding does not allow you to ship "%s %s", only roundings of "%s %s" is accepted by the Unit of Measure.') % (wizard_line.quantity, line_uom.name, line_uom.rounding, line_uom.name))
if move_id:
#Check rounding Quantity.ex.
@@ -187,7 +188,7 @@
#Compute the quantity for respective wizard_line in the initial uom
qty_in_initial_uom = uom_obj._compute_qty(cr, uid, line_uom.id, wizard_line.quantity, initial_uom.id)
without_rounding_qty = (wizard_line.quantity / line_uom.factor) * initial_uom.factor
- if qty_in_initial_uom <> without_rounding_qty:
+ if float_compare(qty_in_initial_uom, without_rounding_qty, precision_rounding=initial_uom.rounding) != 0:
raise osv.except_osv(_('Warning!'), _('The rounding of the initial uom does not allow you to ship "%s %s", as it would let a quantity of "%s %s" to ship and only roundings of "%s %s" is accepted by the uom.') % (wizard_line.quantity, line_uom.name, wizard_line.move_id.product_qty - without_rounding_qty, initial_uom.name, initial_uom.rounding, initial_uom.name))
else:
seq_obj_name = 'stock.picking.' + picking_type
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp