[IMP] mrp: use also the ceiling method from product

bzr revid: mat@openerp.com-20140306094504-37r691hxcemp0ual
This commit is contained in:
Martin Trigaux 2014-03-06 10:45:04 +01:00
parent 1967b6ce19
commit 5db649549c
2 changed files with 5 additions and 2 deletions

View File

@ -30,6 +30,7 @@ from openerp.tools.translate import _
from openerp import netsvc from openerp import netsvc
from openerp import tools from openerp import tools
from openerp import SUPERUSER_ID from openerp import SUPERUSER_ID
from openerp.addons.product import _common
#---------------------------------------------------------- #----------------------------------------------------------
# Work Centers # Work Centers
@ -324,7 +325,7 @@ class mrp_bom(osv.osv):
""" """
routing_obj = self.pool.get('mrp.routing') routing_obj = self.pool.get('mrp.routing')
factor = factor / (bom.product_efficiency or 1.0) factor = factor / (bom.product_efficiency or 1.0)
factor = rounding(factor, bom.product_rounding) factor = _common.ceiling(factor, bom.product_rounding)
if factor < bom.product_rounding: if factor < bom.product_rounding:
factor = bom.product_rounding factor = bom.product_rounding
result = [] result = []
@ -380,6 +381,8 @@ class mrp_bom(osv.osv):
def rounding(f, r): def rounding(f, r):
# TODO for trunk: log deprecation warning
# _logger.warning("Deprecated rounding method, please use tools.float_round to round floats.")
import math import math
if not r: if not r:
return f return f

View File

@ -30,7 +30,7 @@ def rounding(f, r):
# _logger.warning("Deprecated rounding method, please use tools.float_round to round floats.") # _logger.warning("Deprecated rounding method, please use tools.float_round to round floats.")
return tools.float_round(f, precision_rounding=r) return tools.float_round(f, precision_rounding=r)
# TODO for trunk: add rounding method parameter to tools.float_round and remove this method # TODO for trunk: add rounding method parameter to tools.float_round and use this method as hook
def ceiling(f, r): def ceiling(f, r):
if not r: if not r:
return f return f