Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MARGIN MODULE - ERROR #10

Open
xAlphaOmega opened this issue Nov 8, 2019 · 3 comments
Open

MARGIN MODULE - ERROR #10

xAlphaOmega opened this issue Nov 8, 2019 · 3 comments

Comments

@xAlphaOmega
Copy link

xAlphaOmega commented Nov 8, 2019

Received following error on Margin Module

2019-11-08 01:59:46,488 30482 ERROR odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
File "/opt/odoo/odoo13/odoo/api.py", line 753, in get
value = self._data[field][record._ids[0]]
KeyError:

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/odoo/odoo13/odoo/fields.py", line 955, in get
value = env.cache.get(record, self)
File "/opt/odoo/odoo13/odoo/api.py", line 759, in get
raise CacheMiss(record, field)
odoo.exceptions.CacheMiss: ("account.move.line(,).margin", None)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/odoo/odoo13/odoo/http.py", line 619, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo13/odoo/http.py", line 309, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo13/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/opt/odoo/odoo13/odoo/http.py", line 664, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo13/odoo/http.py", line 345, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo13/odoo/service/model.py", line 93, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo13/odoo/http.py", line 338, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo13/odoo/http.py", line 909, in call
return self.method(*args, **kw)
File "/opt/odoo/odoo13/odoo/http.py", line 510, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo13/addons/web/controllers/main.py", line 1319, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/odoo13/addons/web/controllers/main.py", line 1311, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo13/odoo/api.py", line 395, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo13/odoo/api.py", line 382, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/odoo13/addons/account/models/account_move.py", line 873, in onchange
return super(AccountMove, self.with_context(recursive_onchanges=False)).onchange(values, field_name, field_onchange)
File "/opt/odoo/odoo13/odoo/models.py", line 6036, in onchange
for name in nametree
File "/opt/odoo/odoo13/odoo/models.py", line 6037, in
if name not in done and snapshot0.has_changed(name)
File "/opt/odoo/odoo13/odoo/models.py", line 5904, in has_changed
return self[name] != record[name]
File "/opt/odoo/odoo13/odoo/models.py", line 5564, in getitem
return self._fields[key].get(self, type(self))
File "/opt/odoo/odoo13/odoo/fields.py", line 950, in get
self.compute_value(recs)
File "/opt/odoo/odoo13/odoo/fields.py", line 1060, in compute_value
records._compute_field_value(self)
File "/opt/odoo/odoo13/odoo/models.py", line 3880, in _compute_field_value
getattr(self, field.compute)()
File "/opt/odoo/custom/hibou/account_invoice_margin/models/account_invoice.py", line 65, in _product_margin
invoice.margin = sum(invoice.invoice_line_ids.mapped('margin'))
File "/opt/odoo/odoo13/odoo/models.py", line 5160, in mapped
recs = recs._mapped_func(operator.itemgetter(name))
File "/opt/odoo/odoo13/odoo/models.py", line 5119, in _mapped_func
vals = [func(rec) for rec in self]
File "/opt/odoo/odoo13/odoo/models.py", line 5119, in
vals = [func(rec) for rec in self]
File "/opt/odoo/odoo13/odoo/models.py", line 5564, in getitem
return self._fields[key].get(self, type(self))
File "/opt/odoo/odoo13/odoo/fields.py", line 979, in get
self.compute_value(recs)
File "/opt/odoo/odoo13/odoo/fields.py", line 1060, in compute_value
records._compute_field_value(self)
File "/opt/odoo/odoo13/odoo/models.py", line 3880, in _compute_field_value
getattr(self, field.compute)()
File "/opt/odoo/custom/hibou/account_invoice_margin/models/account_invoice.py", line 47, in _product_margin
price = from_cur._convert(line.product_id.standard_price, currency, line.company_id, date, round=False)
File "/opt/odoo/odoo13/odoo/addons/base/models/res_currency.py", line 191, in _convert
assert company, "convert amount from unknown company"
AssertionError: convert amount from unknown company

@jaredkipe
Copy link
Member

jaredkipe commented Nov 8, 2019

Can you provide steps to reproduce and ensure that you have this commit. 824184f

FWIW, the error appears to be in res_currency, and must be related to either permissions or somehow missing the company on the journal entry/invoice.

@xAlphaOmega
Copy link
Author

The currency was set properly and it would happen when trying to send the invoice out.

@jaredkipe
Copy link
Member

Well I came across this this morning. Did you get it resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants