Skip to Content
मेन्यू
This question has been flagged

Good morning,


I created a calculated field in the manufacturing module (total cost) to link with standard_price in the inventory module, with odoo studio, but afterward I deleted the field.


in the inventory module when I want to save a transfer it gives this error message.

Odoo Server Error
Traceback (most recent call last):
  File "/opt/odoo13-latest/odoo/odoo/http.py", line 624, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo13-latest/odoo/odoo/http.py", line 310, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo13-latest/odoo/odoo/tools/pycompat.py", line 14, in reraise
    raise value
  File "/opt/odoo13-latest/odoo/odoo/http.py", line 669, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo13-latest/odoo/odoo/http.py", line 350, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo13-latest/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo13-latest/odoo/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo13-latest/odoo/odoo/http.py", line 915, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo13-latest/odoo/odoo/http.py", line 515, in response_wrap
    response = f(*args, **kw)
  File "/opt/odoo13-latest/odoo/addons/web/controllers/main.py", line 1339, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/opt/odoo13-latest/odoo/addons/web/controllers/main.py", line 1331, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/opt/odoo13-latest/odoo/odoo/api.py", line 388, in call_kw
    model.flush()
  File "/opt/odoo13-latest/odoo/odoo/models.py", line 5499, in flush
    self.recompute()
  File "/opt/odoo13-latest/odoo/odoo/models.py", line 5941, in recompute
    process(field)
  File "/opt/odoo13-latest/odoo/odoo/models.py", line 5925, in process
    recs.mapped(field.name)
  File "/opt/odoo13-latest/odoo/odoo/models.py", line 5307, in mapped
    recs = recs._mapped_func(operator.itemgetter(name))
  File "/opt/odoo13-latest/odoo/odoo/models.py", line 5266, in _mapped_func
    vals = [func(rec) for rec in self]
  File "/opt/odoo13-latest/odoo/odoo/models.py", line 5266, in 
    vals = [func(rec) for rec in self]
  File "/opt/odoo13-latest/odoo/odoo/models.py", line 5731, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/opt/odoo13-latest/odoo/odoo/fields.py", line 1032, in __get__
    self.compute_value(recs)
  File "/opt/odoo13-latest/odoo/odoo/fields.py", line 1146, in compute_value
    records._compute_field_value(self)
  File "/opt/odoo13-latest/odoo/odoo/models.py", line 4005, in _compute_field_value
    field.compute(self)
  File "/opt/odoo13-latest/odoo/odoo/addons/base/models/ir_model.py", line 33, in 
    func = lambda self: safe_eval(text, SAFE_EVAL_BASE, {'self': self}, mode="exec")
  File "/opt/odoo13-latest/odoo/odoo/tools/safe_eval.py", line 352, in safe_eval
    c = test_expr(expr, _SAFE_OPCODES, mode=mode)
  File "/opt/odoo13-latest/odoo/odoo/tools/safe_eval.py", line 207, in test_expr
    code_obj = compile(expr, "", mode)
  File "", line 2
    record['x_studio_total'] = record.product_id.standard_price * record.product_uom_qty
         ^
IndentationError: expected an indented block

field x_studio_total is already deleted from the list of fields.

Avatar
Discard
Best Answer

Hi,
Even if the field is deleted still some code like server action/automated action use this field, so check for the usage of this field inside the automated actions/server action and remove the field from those depending on your logic and correct the indentations.

    record['x_studio_total'] = record.product_id.standard_price * record.product_uom_qty


The Reason for error is due to wrong indention in the code

Thanks

Avatar
Discard
Author

thank you Niyas, problem resolved

Related Posts Replies Views Activity
3
जून 25
2620
2
फ़र॰ 25
1451
0
नव॰ 24
1233
1
अक्तू॰ 24
1409
3
मार्च 24
6714