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

CSV Import TypeError in http.py #41

Closed
blaggacao opened this issue May 19, 2014 · 4 comments
Closed

CSV Import TypeError in http.py #41

blaggacao opened this issue May 19, 2014 · 4 comments
Assignees

Comments

@blaggacao
Copy link
Contributor

When trying to import the same previously exported csv in Version 8.0dev-20140416-230101
I get this stderr:

  File "/usr/share/pyshared/openerp/addons/base/ir/ir_http.py", line 89, in _han
dle_exception
    return request._handle_exception(exception)
  File "/usr/share/pyshared/openerp/addons/base/ir/ir_http.py", line 116, in _di
spatch
    result = request.dispatch()
  File "/usr/share/pyshared/openerp/http.py", line 537, in dispatch
    r = self._call_function(**self.params)
  File "/usr/share/pyshared/openerp/http.py", line 294, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/share/pyshared/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/share/pyshared/openerp/http.py", line 291, in checked_call
    return self.endpoint(*a, **kw)
  File "/usr/share/pyshared/openerp/http.py", line 638, in __call__
    return self.method(*args, **kw)
  File "/usr/share/pyshared/openerp/http.py", line 337, in response_wrap
    response = f(*args, **kw)
TypeError: set_file() takes at least 4 arguments (4 given)

The same happens with other import attemps (eg. from V7)

@xmo-odoo xmo-odoo self-assigned this May 19, 2014
@xmo-odoo
Copy link
Collaborator

Can't repro, whether locally or on http://runbot.openerp.com

Is base_import installed? Do you have third-party modules installed which could interfere with it?

@blaggacao
Copy link
Contributor Author

Issue Type:

Bug Report (structured)

Ansible Odoo Version:

8.0dev-20140416-230101

Environment:

Ubuntu precise64 build from hashicorp/precise64 - box (https://vagrantcloud.com/hashicorp/precise64/version/2)

Odoo:
Fresh fresh fresh install, with demo data. No modules installed. The first thing of all I wanted to do is to import the company to prevent something is registerd under "Your Company".

  • I cannot say if base_import was installed. I think it is by default?
Summary:

Import of csv did not behave. Even not previously exported ones of the environment itself.
Fails at the following state:

Uploading csv to the import screen -> hangs on every tested csv (including ones exported from the same pristine installation)

  • Hint: Doesn't this mean base_import installed?
Steps To Reproduce:

fire up the box vagrant up in the directory of this vagrant file with vagrant installed.

# -*- mode: ruby -*-
# vi: set ft=ruby :

# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.network "forwarded_port", guest: 8069, host: 8079
  config.vm.network "public_network"

end

install version 8.0dev-20140416-230101 deb package (was latest at that time)
following roughly the steps by http://www.theopensourcerer.com/2012/12/how-to-install-openerp-7-0-on-ubuntu-12-04-lts/

tweaks to make it work: https://www.odoo.com/forum/Help-1/question/Postgres-Psycopg2-Unix-Socket-problemito-52426
Caution! Locale of hashicorp/precise65 is not en_US.UTF-8 which makes postgres behave badly, has to be set prior to install postgres like https://index.docker.io/u/flox/ubuntu-openerp/ seems to be a more common problem. Hint -> include into future provisioning scripts, if planned so.

Expected Results:

Can import csvs like in saas3-online of 18.05.2014

Actual Results:
File "/usr/share/pyshared/openerp/addons/base/ir/ir_http.py", line 89, in _han
dle_exception
    return request._handle_exception(exception)
  File "/usr/share/pyshared/openerp/addons/base/ir/ir_http.py", line 116, in _di
spatch
    result = request.dispatch()
  File "/usr/share/pyshared/openerp/http.py", line 537, in dispatch
    r = self._call_function(**self.params)
  File "/usr/share/pyshared/openerp/http.py", line 294, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/share/pyshared/openerp/service/model.py", line 113, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/share/pyshared/openerp/http.py", line 291, in checked_call
    return self.endpoint(*a, **kw)
  File "/usr/share/pyshared/openerp/http.py", line 638, in __call__
    return self.method(*args, **kw)
  File "/usr/share/pyshared/openerp/http.py", line 337, in response_wrap
    response = f(*args, **kw)
TypeError: set_file() takes at least 4 arguments (4 given)

@paragkumar
Copy link

This issue can be resolved by making changes in addons/base_import/controller.py file and upgrading base_import module.


import simplejson
from openerp.http import Controller, route, request

class ImportController(Controller):
@route('/base_import/set_file')
def set_file(self, file, import_id, jsonp='callback'):
import_id = int(import_id)

     written = request.session.model('base_import.import').write(import_id, {
         'file': file.read(),
         'file_name': file.filename,
         'file_type': file.content_type,
     }, request.context)

     return 'window.top.%s(%s)' % (
         jsonp, simplejson.dumps({'result': written}))

vaab pushed a commit to 0k/odoo that referenced this issue Jul 24, 2014
@blaggacao
Copy link
Contributor Author

could not reproduce it anymore, solved

richard-willdooit pushed a commit to richard-willdooit/odoo that referenced this issue Oct 12, 2016
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

3 participants