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

10.0 Crash in CSV import #117

Closed
alexis-via opened this issue Dec 6, 2016 · 4 comments
Closed

10.0 Crash in CSV import #117

alexis-via opened this issue Dec 6, 2016 · 4 comments

Comments

@alexis-via
Copy link
Contributor

With base_phone v10 (OCA 10.0 branch or akretion's "10-mig-generic-modules" branch), there is a crash when importing a CSV with a phone field. Here is the scenario:

  1. create a res.partner.csv file with the following content:
name,phone
Alexis de Lattre,06 98 09 92 46
  1. Install the base_phone and base_import modules.
  2. Go to Sales > Customers, switch to tree view and click on "Import"
  3. Upload the file res.partner.csv and click on "Validate": you get this crash:
2016-12-06 10:13:39,923 27953 INFO o0_test1 odoo.addons.base_import.models.base_import: importing 1 rows...
2016-12-06 10:13:39,977 27953 ERROR o0_test1 odoo.http: Exception during JSON request handling.
Traceback (most recent call last):
  File "/home/alexis/new_boite/dev/odoo0/odoo/http.py", line 638, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/alexis/new_boite/dev/odoo0/odoo/http.py", line 675, in dispatch
    result = self._call_function(**self.params)
  File "/home/alexis/new_boite/dev/odoo0/odoo/http.py", line 331, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/alexis/new_boite/dev/odoo0/odoo/service/model.py", line 119, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/alexis/new_boite/dev/odoo0/odoo/http.py", line 324, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/alexis/new_boite/dev/odoo0/odoo/http.py", line 933, in __call__
    return self.method(*args, **kw)
  File "/home/alexis/new_boite/dev/odoo0/odoo/http.py", line 504, in response_wrap
    response = f(*args, **kw)
  File "/home/alexis/new_boite/dev/odoo0/addons/web/controllers/main.py", line 862, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/home/alexis/new_boite/dev/odoo0/addons/web/controllers/main.py", line 854, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/alexis/new_boite/dev/odoo0/odoo/api.py", line 681, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/home/alexis/new_boite/dev/odoo0/odoo/api.py", line 672, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/home/alexis/new_boite/dev/odoo0/addons/base_import/models/base_import.py", line 666, in do
    import_result = self.env[self.res_model].with_context(import_file=True).load(import_fields, data)
  File "/home/alexis/new_boite/dev/odoo0/odoo/models.py", line 862, in load
    for id, xid, record, info in converted:
  File "/home/alexis/new_boite/dev/odoo0/odoo/models.py", line 1026, in _convert_records
    converted = convert(record, functools.partial(_log, extras, stream.index))
  File "/home/alexis/new_boite/dev/odoo0/odoo/addons/base/ir/ir_fields.py", line 79, in fn
    converted[field], ws = converters[field](value)
TypeError: 'NoneType' object is not callable
@alexis-via alexis-via changed the title Crash in CSV import 10.0 Crash in CSV import Dec 6, 2016
@alexis-via
Copy link
Contributor Author

@sylvain-garancher I guess this bug is in the "low level" code of base_phone... your insight would be greatly appreciated! :)

@Garamotte
Copy link

@alexis-via It seems that the converter methods are missing in base_phone for the new fields' types.

Converter methods searched here: https://github.com/odoo/odoo/blob/10.0/odoo/addons/base/ir/ir_fields.py#L135
Converter methods for standard field types exist : _str_to_boolean, _str_to_integer, _str_to_many2one, etc.

After a very quick look, I think simply adding _str_to_fax and _str_to_phone methods on ir.fields in the base_phone module, which could directly return self._str_to_char(model, field, values) would work.

alexis-via added a commit to akretion/connector-telephony that referenced this issue Dec 6, 2016
@alexis-via
Copy link
Contributor Author

@sylvain-garancher I implemented your suggestion in my PR, it works well, thanks !

@Garamotte
Copy link

@alexis-via You can close this issue as it is fixed.

mamcode pushed a commit to druidoo-dev/connector-telephony that referenced this issue Apr 16, 2020
mimusica pushed a commit to mimusica/connector-telephony that referenced this issue Aug 2, 2020
mimusica pushed a commit to mimusica/connector-telephony that referenced this issue Aug 5, 2020
PierrickBrun pushed a commit to akretion/connector-telephony that referenced this issue Dec 7, 2020
cvinh pushed a commit to invitu/connector-telephony that referenced this issue Mar 27, 2021
PierrickBrun pushed a commit to akretion/connector-telephony that referenced this issue May 3, 2021
PierrickBrun pushed a commit to akretion/connector-telephony that referenced this issue May 4, 2021
Aldeigja pushed a commit to cetmix/oca-connector-telephony that referenced this issue Dec 21, 2022
mmequignon pushed a commit to mmequignon/connector-telephony that referenced this issue Jan 17, 2023
hunghn pushed a commit to hunghn/connector-telephony that referenced this issue Feb 22, 2023
nguyenminhchien pushed a commit to nguyenminhchien/connector-telephony that referenced this issue Mar 16, 2023
aiendry-aktivsoftware pushed a commit to aiendry-aktivsoftware/connector-telephony that referenced this issue May 1, 2023
Aldeigja pushed a commit to cetmix/oca-connector-telephony that referenced this issue May 18, 2023
Nikul-OSI pushed a commit to ursais/connector-telephony that referenced this issue Feb 12, 2024
OCA-git-bot pushed a commit to hailangvn2023/connector-telephony that referenced this issue Feb 13, 2024
luisDIXMIT pushed a commit to dixmit/connector-telephony that referenced this issue Apr 3, 2024
luisDIXMIT pushed a commit to dixmit/connector-telephony that referenced this issue Apr 4, 2024
luisDIXMIT pushed a commit to dixmit/connector-telephony that referenced this issue Apr 11, 2024
HeliconiaSolutions pushed a commit to HeliconiaIO/connector-telephony that referenced this issue Nov 28, 2024
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