vertelab / odoo-l10n_se

Swedish accounting. All our Odoo Modules can be found at https://vertel.se/apps
13 stars 12 forks source link

[FIX] Make l10n_se install again #7

Closed mlaitinen closed 4 years ago

mlaitinen commented 6 years ago

.. by making Bank Transfer account common for all CoAs.

If you try to install l10n_se in a fresh database, the install fails to the following error:

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 640, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 677, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 333, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 101, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 326, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 935, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 506, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 889, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 877, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/base/res/res_config.py", line 128, in action_next
    return self.execute() or self.next()
  File "/usr/lib/python2.7/dist-packages/odoo/addons/account/models/chart_template.py", line 821, in execute
    acc_template_ref, taxes_ref = self.chart_template_id._install_template(company, code_digits=self.code_digits, transfer_account_id=self.transfer_account_id)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/account/models/chart_template.py", line 277, in _install_template
    tmp1, tmp2 = self.parent_id._install_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, acc_ref=acc_ref, taxes_ref=taxes_ref)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/account/models/chart_template.py", line 280, in _install_template
    tmp1, tmp2 = self._load_template(company, code_digits=code_digits, transfer_account_id=transfer_account_id, account_ref=acc_ref, taxes_ref=taxes_ref)
  File "/usr/lib/python2.7/dist-packages/odoo/addons/account/models/chart_template.py", line 320, in _load_template
    company.transfer_account_id = account_template_ref[transfer_account_id.id]
KeyError: 1244

And this is because the child CoAs use a different bank transfer account than the general CoA. There's no differences between the bank transfer accounts among the CoAs so I don't think there's a reason to have one for each child CoA.

I made sure that after making this change the inter-company transfer account is correctly set on the res.company.

Hälsningar från Finland, Miku

anderswallenquist commented 6 years ago

Thank you mlaitinen for this fix. We have implemented your XML-changes to the python-script that generates those files. https://github.com/vertelab/odoo-l10n_se/commit/c508ed15e590798ff701f3a753da5976553fd6c3