Skip to Content
Menu
This question has been flagged
4 Replies
6334 Views

When attempting to process a specific work order I am getting an error.

I am unsure how precision rounding is causing an issue with the work order/manufacturing order. It has been submitted to the Odoo bug team but since they have been quite busy for the last few weeks I thought I would check if anyone here has any tips.


Thanks in advance.


The error can be seen below.

Odoo Server Error
Traceback (most recent call last):
  File "/home/odoo/src/odoo/odoo/http.py", line 624, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/src/odoo/odoo/http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/home/odoo/src/odoo/odoo/tools/pycompat.py", line 14, in reraise
    raise value
  File "/home/odoo/src/odoo/odoo/http.py", line 669, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/src/odoo/odoo/http.py", line 350, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/src/odoo/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 915, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/src/odoo/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1326, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1314, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 387, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/home/odoo/src/odoo/odoo/api.py", line 374, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/home/odoo/src/enterprise/mrp_workorder/models/mrp_workorder.py", line 583, in do_finish
    self.record_production()
  File "/home/odoo/src/enterprise/mrp_workorder/models/mrp_workorder.py", line 525, in record_production
    res = super(MrpProductionWorkcenterLine, self).record_production()
  File "/home/odoo/src/odoo/addons/mrp/models/mrp_workorder.py", line 412, in record_production
    self._update_finished_move()
  File "/home/odoo/src/odoo/addons/mrp/models/mrp_abstract_workorder.py", line 273, in _update_finished_move
    float_round(self.qty_producing, precision_rounding=rounding)
  File "/home/odoo/src/odoo/odoo/tools/float_utils.py", line 55, in float_round
    precision_rounding=precision_rounding)
  File "/home/odoo/src/odoo/odoo/tools/float_utils.py", line 30, in _float_check_precision
    "precision_rounding must be positive, got %s" % precision_rounding
AssertionError: precision_rounding must be positive, got 0.0
Avatar
Discard
Author Best Answer

The error ended up being unrelated to precision rounding but was caused earlier and wasn't caught until the rounding function.

Location of Error

File "/home/odoo/src/odoo/addons/mrp/models/mrp_abstract_workorder.py", line 273, in _update_finished_move

production_move = self.production_id.move_finished_ids.filtered(
            lambda move: move.product_id == self.product_id and
            move.state not in ('done', 'cancel')
        )

The problem

In the above lambda statement move.product_id was returning the id of the originally selected product which had since been changed so it was being compared to self.product_id which was a different product. The odd part was that in the Odoo interface there was no indication of this issue as everything looked like it was updated to the new product.


My Solution

Not the ideal solution, but I ran a one time scheduled task and updated the finished_product_id to match the new product id.


Avatar
Discard
Best Answer
precision_rounding should be 0.01 not zero
Avatar
Discard
Author

I looked at it appears that all of the products units of measurement have their round set to 0.01 with a few being at 0.001 so the problem may be somewhere else instead?

You need to audit these files

File "/home/odoo/src/odoo/addons/mrp/models/mrp_workorder.py", line 412, in record_production

self._update_finished_move()

File "/home/odoo/src/odoo/addons/mrp/models/mrp_abstract_workorder.py", line 273, in _update_finished_move

float_round(self.qty_producing, precision_rounding=rounding)

Related Posts Replies Views Activity
1
Oct 23
911
0
Jul 23
716
2
May 23
2036
1
Oct 22
1398
0
Jun 22
2124