← Back to team overview

openerp-expert-production team mailing list archive

[Bug 794207] Re: MRP operations time precission to seconds

 

Mmm, OK, not sure what you are meaning by the rounding affecting the
hours value.

I tested this thourougly and found I needed the rounding. Maybe this
script can help with analysis.


#!/usr/bin/python
# -*- coding: utf-8 -*-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
import math

#############################################################################################
# Test float to time
def float_time_secs_convert(float_val, seconds=None):

        hours = math.floor(abs(float_val))

        mins = abs(float_val)%1
        mins = mins * 60
        mins = round(mins + 0.0001,4)
        if mins >= 60:
            hours = hours + 1
            mins = 0

        float_time = '%02d:%02d' % (hours,mins)
        if seconds:
            secs = abs((mins)%1)
            secs = secs * 60
            secs = round(secs + 0.0001,4)
            if secs >= 60:
                mins = mins + 1
                secs = 0
                float_time = '%02d:%02d:%02d' % (hours,mins,secs)

        return float_time

secs = True
for i in range(24):
    for j in range(60):
        for k in range(60):
            input_time = '%02d:%02d' % (i,j)
            float_val = round(int(input_time.split(':')[0]) + int(input_time.split(':')[1]) / 60.0, 8)
            if secs:
                input_time = '%02d:%02d:%02d' % (i,j,k)
                float_val = round(int(input_time.split(':')[0]) + int(input_time.split(':')[1]) / 60.0 + int(input_time.split(':')[2]) / 60.0 / 60.0, 8)
            output_time = float_time_secs_convert(float_val, seconds=secs)

            if output_time != input_time:
                print "input_time (%s) != output_time (%s)" % (input_time, output_time)

-- 
You received this bug notification because you are a member of OpenERP
Manufacturing Experts, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/794207

Title:
  MRP operations time precission to seconds

Status in OpenERP Addons (modules):
  Opinion

Bug description:
  MRP operations time precision to seconds

  In our industry we need to estimate time for one cycle in seconds, in
  fact we do have several operations for one second.

  Please make possible to use time with seconds in all manufacture
  process.

  I would gladly help if I knew how.
  I tried to make the field nbr_hours in work center definition as field.time, it does display seconds but then it does not compute.

  I need help please,

  Thanks
  Mihai

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