Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2579 Lượt xem

Hello

I have problems in manufacturing odoo. So when I have a production order and will do a production on a work order I get an error like this:

Error:Odoo Server Error


Traceback (most recent call last):

  File "/home/printart/printart-odoo/odoo/http.py", line 619, in _handle_exception

    return super(JsonRequest, self)._handle_exception(exception)

  File "/home/printart/printart-odoo/odoo/http.py", line 309, in _handle_exception

    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])

  File "/home/printart/printart-odoo/odoo/tools/pycompat.py", line 14, in reraise

    raise value

  File "/home/printart/printart-odoo/odoo/http.py", line 664, in dispatch

    result = self._call_function(**self.params)

  File "/home/printart/printart-odoo/odoo/http.py", line 345, in _call_function

    return checked_call(self.db, *args, **kwargs)

  File "/home/printart/printart-odoo/odoo/service/model.py", line 93, in wrapper

    return f(dbname, *args, **kwargs)

  File "/home/printart/printart-odoo/odoo/http.py", line 338, in checked_call

    result = self.endpoint(*a, **kw)

  File "/home/printart/printart-odoo/odoo/http.py", line 909, in __call__

    return self.method(*args, **kw)

  File "/home/printart/printart-odoo/odoo/http.py", line 510, in response_wrap

    response = f(*args, **kw)

  File "/home/printart/printart-odoo/addons/web/controllers/main.py", line 1403, in call_button

    action = self._call_kw(model, method, args, kwargs)

  File "/home/printart/printart-odoo/addons/web/controllers/main.py", line 1391, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/printart/printart-odoo/odoo/api.py", line 395, in call_kw

    result = _call_kw_multi(method, model, args, kwargs)

  File "/home/printart/printart-odoo/odoo/api.py", line 382, in _call_kw_multi

    result = method(recs, *args, **kwargs)

  File "/home/printart/printart-odoo/addons/sales_upload_files/models/mrp_workorder.py", line 13, in record_production

    super(MrpWorkorder, self).record_production()

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

    self._update_finished_move()

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

    float_round(self.qty_producing, precision_rounding=rounding)

  File "/home/printart/printart-odoo/odoo/tools/float_utils.py", line 55, in float_round

    precision_rounding=precision_rounding)

  File "/home/printart/printart-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"


Strangely, I only get this error in one of my warehouses (I use multi warehouse). when in another warehouse I don't get that error. then how can you solve that problem


Please Help 

Thanks 

Ảnh đại diện
Huỷ bỏ

Hi,
How did you solve this one?
I got a similar error.

Câu trả lời hay nhất

The error "AssertionError: precision_rounding must be positive, got 0.0" occurs when Odoo encounters a precision_rounding value of 0.0 during a computation. This typically happens due to an incorrect configuration of UoM (Unit of Measure) or decimal precision. Here's how you can resolve the issue:

1. Root Cause

  • The Unit of Measure (UoM) or related settings in the specific warehouse might not have a proper Rounding Precision configured.
  • Odoo uses precision_rounding to handle quantities in calculations. A value of 0.0 means the rounding is improperly set, which leads to this error.
  • The issue only occurs in one warehouse because UoM settings or BOM (Bill of Materials) configurations may differ between warehouses.

2. Steps to Resolve

Step 1: Check Units of Measure (UoM) Configuration

  1. Navigate to:
    • Inventory > Configuration > Units of Measure.
  2. Open the UoMs related to the affected product(s).
  3. Verify the following:
    • Rounding Precision: Ensure it is set to a positive value (e.g., 0.01 or 0.001 depending on your needs).
      • Rounding precision determines the smallest unit of quantity Odoo will handle.
    • Category: Ensure the UoM is correctly categorized under the same category as other UoMs for the product.
  4. Save the changes and test again.

Step 2: Verify Product Configuration

  1. Go to:
    • Inventory > Products > Products.
  2. Open the affected product(s).
  3. Check the following fields:
    • Unit of Measure and Purchase Unit of Measure: Ensure these have valid UoMs with proper rounding precision.
    • Routes: Ensure the product's routes (Make-to-Stock, Manufacture, etc.) align with the warehouse configuration.

Step 3: Check Bill of Materials (BOM)

  1. Navigate to:
    • Manufacturing > Products > Bill of Materials.
  2. Open the BOM associated with the product being manufactured in the affected warehouse.
  3. Check the following:
    • Component Quantities: Ensure all component quantities and UoMs are configured with appropriate rounding precisions.
    • Finished Product UoM: Verify the UoM for the finished product has a valid rounding precision.

Step 4: Verify Warehouse Configuration

  1. Navigate to:
    • Inventory > Configuration > Warehouses.
  2. Open the settings for the affected warehouse.
  3. Check:
    • Routes: Ensure the routes for manufacturing and stock movements are consistent with other warehouses.
    • Stock Locations: Verify stock location configurations (e.g., for raw materials and finished goods) do not have custom logic causing conflicts.

Step 5: Debug Logs and Server Action

If the issue persists:

  1. Enable Developer Mode in Odoo.
  2. Check the logs for the specific product or production order causing the error:
    • Go to Settings > Technical > Logs > Server Logs.
  3. Trace the affected rounding value being passed to float_round.

Step 6: Custom Code or Add-ons

  • The stack trace mentions a custom module (sales_upload_files/models/mrp_workorder.py) which may override the standard record_production method.
  • If custom code is involved:
    • Review the custom logic to ensure it doesn’t improperly set precision_rounding to 0.0.
    • Modify the code to include a fallback for rounding precision:
      rounding = rounding or 0.01  # Set a default positive value if rounding is 0.0
      

3. Preventive Actions

  1. Consistency Across Warehouses:
    • Ensure that UoMs and product configurations are consistent across all warehouses.
  2. Test Configurations:
    • Test manufacturing flows for each warehouse after changes.
  3. Regular Audits:
    • Periodically audit UoM configurations and rounding precisions to avoid similar issues.

4. If Issue Persists

  • If none of the above steps resolve the issue, you may need to:
    • Run a database query to identify products or UoMs with invalid configurations.
    • Contact Odoo support or your developer to debug the custom module mentioned in the error trace.

By following these steps, you should be able to resolve the issue and prevent it from recurring. Let me know if you need further assistance!

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 5 22
1446
1
thg 5 22
4247
0
thg 3 22
2077
2
thg 1 20
4978
1
thg 6 17
4418