itpp-labs / odoo-development

Usefull information for odoo developers. Published at odoo-development.readthedocs.io
https://odoo-development.readthedocs.io/
GNU Affero General Public License v3.0
139 stars 171 forks source link

TypeError: not enough arguments for format string (ODOO 11 on Ubuntu 16.04) #178

Closed FlyingPigSolutions closed 5 years ago

FlyingPigSolutions commented 5 years ago

Having this error since Last July 2018:

Can't validate some entries as it creates an error. Seems its on 2 types of entry only (accounting module or now called invoicing)

Traceback (most recent call last):

  File "/home/odoo/odoo-server/odoo/http.py", line 647, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/odoo/odoo-server/odoo/http.py", line 307, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/home/odoo/odoo-server/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/home/odoo/odoo-server/odoo/http.py", line 689, in dispatch
    result = self._call_function(**self.params)
  File "/home/odoo/odoo-server/odoo/http.py", line 339, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/odoo/odoo-server/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/odoo/odoo-server/odoo/http.py", line 332, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/odoo/odoo-server/odoo/http.py", line 933, in __call__
    return self.method(*args, **kw)
  File "/home/odoo/odoo-server/odoo/http.py", line 512, in response_wrap
    response = f(*args, **kw)
  File "/home/odoo/odoo-server/addons/web/controllers/main.py", line 934, in call_button
    action = self._call_kw(model, method, args, {})
  File "/home/odoo/odoo-server/addons/web/controllers/main.py", line 922, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/odoo/odoo-server/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/home/odoo/odoo-server/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/home/odoo/odoo-server/addons/account_asset/models/account.py", line 24, in post
    return super(AccountMove, self).post()
  File "/home/odoo/odoo-server/addons/account/models/account_move.py", line 160, in post
    new_name = sequence.with_context(ir_sequence_date=move.date).next_by_id()
  File "/home/odoo/odoo-server/odoo/addons/base/ir/ir_sequence.py", line 263, in next_by_id
    return self._next()
  File "/home/odoo/odoo-server/odoo/addons/base/ir/ir_sequence.py", line 257, in _next
    return seq_date.with_context(ir_sequence_date_range=seq_date.date_from)._next()
  File "/home/odoo/odoo-server/odoo/addons/base/ir/ir_sequence.py", line 352, in _next
    return self.sequence_id.get_next_char(number_next)
  File "/home/odoo/odoo-server/odoo/addons/base/ir/ir_sequence.py", line 224, in get_next_char
    interpolated_prefix, interpolated_suffix = self._get_prefix_suffix()
  File "/home/odoo/odoo-server/odoo/addons/base/ir/ir_sequence.py", line 217, in _get_prefix_suffix
    interpolated_prefix = _interpolate(self.prefix, d)
  File "/home/odoo/odoo-server/odoo/addons/base/ir/ir_sequence.py", line 194, in _interpolate
    return (s % d) if s else ''

TypeError: not enough arguments for format string

Although I understand the issue, I don't understand where it comes from as its not from a module installation and it was working file for 6 months in production.

I was looking into the odoo config sequences to see what would cause this issue because :

its not creating an error for all sequences it creates it only on one

However, making changes on the sequences, didn't solved it.

I don't think I have to get into the code itself and make any change. I believe it is more during configuration that it creates the issue afterwards.

https://github.com/odoo/odoo/blob/12.0/odoo/addons/base/models/ir_sequence.py#L193

Is it possible to come from a python version? Should I pass to python 3.6 ? I have python 2.7 and python 3.5 installed

Updating the python3.6 didn't solve the issue Update Odoo 11 didn't solve the issue Update command on ubuntu didn't solve the issue

Appreciate if anyone would have a clue, but I'll dig some more too.

FlyingPigSolutions commented 5 years ago

TypeError: not enough arguments for format string

The issue is coming from the sequence that was giving a draft number / and *XXXXX due to a conflict to find the right sequence. In sequence: Attribute a code sequence In journal: Attribute the same code sequence To make sure the link is made and there is no conflict.

Problem solved just by :