openlabs / magento_integration

Magento OpenERP Integration
https://openerp-magento-connector.readthedocs.org/en/develop/
80 stars 77 forks source link

Invalid XML for View Architecture #135

Closed capitaine closed 10 years ago

capitaine commented 10 years ago

Not sure this is a magento_integration issue or if it is not due to my weakness on python modules and git updates.

First I tried to delete a product and as it was impossible to do it, I wanted to see what would happen if I deactivate the module, so I installed it via openerp configuration/installed modules. I could now delete the imported products. Then I reinstalled the module but got a lot of errors (Traceback available if you're interested). Impossible to reinstall, so I created a new database and reinstalled everything.

Then I wanted to try the latest version of magento_integration with the tax changes, so I renamed the ancient module directory to magento_integration_bak and installed the downloaded module in magento_integration directory (python setup.py install). It seemed to work but somewhere I had a doubt that it was always the old module that worked. Then I uninstalled the module via openerp configuration/installed modules, and reinstalled it the same way. Then I got "An error occurred while validating the field arch: Invalid XML for View Architecture". Looking in module's directory I noticed that there were no .pyc files. So, I deleted all files related to magento_integration from /usr/local/lib/python2.6/dist-packages and run again the "python setup.py install". Installation seems to go on right, but still no .pyc files and while installing the module inside openerp, I get again "An error occurred while validating the field arch: Invalid XML for View Architecture". I then renamed the directory to magento_integration_bak2 and moved the initial module from magento_integration_bak to magento_integration, then I installed it via openerp. This time the installation was made correctly, but under "installed modules" I have three instances "magento_integration", "magento_integration back" and magento_integration_bak2" although there are only two directories "magento_integration" and "magento_integration_bak2". Why openerp keeps in memory a module/folder "magento_integration_bak" that no more exists ? Login out/login in/updating modules' list didn't change anything.

Anyway, what is the right way for updating magento_integration from git or zip file ?

Thanks for showing some direction.

shalabhaggarwal commented 10 years ago

Details about all the modules are stored in the the table ir.module.module and i think they are not deleted if the module is removed from the addons path.

Both ways are ok for updating the modules but I would advice using git as it allows easy version control and easy updation of code. With zip you will have to completely delete the existing module folder and put in the new one.

Also after updating the module with new code, you should do a upgrade of the module else the schema related changes will not take effect.

I hope this answers your questions.

capitaine commented 10 years ago

Thank you for your help shalabhaggarwal. Indeed there were records of deleted directories in ir_modulel_module table.

But what do you mean when saying "after updating the module with new code, you should +++ do a upgrade +++ of the module" ?

I still can't get the .pyc files when I run "python setup.py install" and of course I get an "Invalid XML for View Architecture" when I attempt to install the module inside openErp. So I reverted to the ancient version and I can not test the latest changes. Is something else that I should clean before running the "setup.py install" ?

shalabhaggarwal commented 10 years ago

@capitaine There is nothing that you have to do after python setup.py install.

Usually upgrading the module from the frontend in openerp should work.

You can also do the same from command line which is usually more effective.

This is done by running openerp server with following parameters:

python openerp-server -c <config file path> -u magento_integration -d <db name>

PS: I am not sure why this issue happens on your end. Our installation in both dev and production environments dont seem to have any of the above.

capitaine commented 10 years ago

The problem remains. I tried everything on every sens : zip download, deleting original directory or overwriting it, git pull, ... unable to register the new version of the module with python setup.py install (no .pyc files created). So I put back the backup copy of the module before the upgrade. Tested it to see if it was still working, it was ! Then I tried the "git pull" inside the module's directory that worked. I then "setup.py install" that seemed to work but it didn't (no .pyc files created) and there was a warning in the output : warning: install_lib: 'build/lib.linux-x86_64-2.6' does not exist -- no Python modules to install Then I tried to update via the openerp frontend (open the module and update) : it didn't work and throw the same "Invalid XML for View Architecture". I logged out openerp and tried to log in again : impossible to login. Here is the traceback: Server Traceback (most recent call last): File "/usr/lib/pymodules/python2.6/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/usr/lib/pymodules/python2.6/openerp/netsvc.py", line 292, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/usr/lib/pymodules/python2.6/openerp/service/web_services.py", line 433, in dispatch return fn(params) File "/usr/lib/pymodules/python2.6/openerp/service/web_services.py", line 444, in exp_authenticate res_users = pooler.get_pool(db).get('res.users') File "/usr/lib/pymodules/python2.6/openerp/pooler.py", line 49, in get_pool return get_db_and_pool(db_name, force_demo, status, update_module)[1] File "/usr/lib/pymodules/python2.6/openerp/pooler.py", line 33, in get_db_and_pool registry = RegistryManager.get(db_name, force_demo, status, update_module) File "/usr/lib/pymodules/python2.6/openerp/modules/registry.py", line 192, in get update_module) File "/usr/lib/pymodules/python2.6/openerp/modules/registry.py", line 218, in new openerp.modules.load_modules(registry.db, force_demo, status, update_module) File "/usr/lib/pymodules/python2.6/openerp/modules/loading.py", line 350, in load_modules force, status, report, loaded_modules, update_module) File "/usr/lib/pymodules/python2.6/openerp/modules/loading.py", line 256, in load_marked_modules loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks) File "/usr/lib/pymodules/python2.6/openerp/modules/loading.py", line 188, in load_module_graph load_data(module_name, idref, mode) File "/usr/lib/pymodules/python2.6/openerp/modules/loading.py", line 76, in load_data = lambda args: _load_data(cr, *args, kind='data') File "/usr/lib/pymodules/python2.6/openerp/modules/loading.py", line 124, in _load_data tools.convert_xml_import(cr, module_name, fp, idref, mode, noupdate, report) File "/usr/lib/pymodules/python2.6/openerp/tools/convert.py", line 954, in convert_xml_import obj.parse(doc.getroot()) File "/usr/lib/pymodules/python2.6/openerp/tools/convert.py", line 847, in parse self._tags[rec.tag](self.cr, rec, n) File "/usr/lib/pymodules/python2.6/openerp/tools/convert.py", line 814, in _tag_record id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context ) File "/usr/lib/pymodules/python2.6/openerp/addons/base/ir/ir_model.py", line 964, in _update res_id = model_obj.create(cr, uid, values, context=context) File "/usr/lib/pymodules/python2.6/openerp/addons/base/ir/ir_ui_view.py", line 103, in create return super(view, self).create(cr, uid, values, context) File "/usr/lib/pymodules/python2.6/openerp/osv/orm.py", line 4472, in create self._validate(cr, user, [id_new], context) File "/usr/lib/pymodules/python2.6/openerp/osv/orm.py", line 1546, in _validate raise except_orm('ValidateError', '\n'.join(error_msgs)) except_orm: ('ValidateError', u'Une erreur est apparue lors de la validation du/des champ(s) arch: Invalid XML for View Architecture!')

I had no problem on removing / reinstalling any other module with the openerp fronted.

capitaine commented 10 years ago

Definitely, I'm unable to register magento_integration. Tried after cleaning all previous installations of the module, then restarted as following under openerp/addons: git clone cd magento_integration python setup.py install

Here is the output:

running install install_dir /usr/local/lib/python2.6/dist-packages/ Checking .pth file support in /usr/local/lib/python2.6/dist-packages/ /usr/bin/python -E -c pass TEST PASSED: /usr/local/lib/python2.6/dist-packages/ appears to support .pth files running bdist_egg running egg_info creating magento_integration.egg-info writing requirements to magento_integration.egg-info/requires.txt writing magento_integration.egg-info/PKG-INFO writing top-level names to magento_integration.egg-info/top_level.txt writing dependency_links to magento_integration.egg-info/dependency_links.txt writing manifest file 'magento_integration.egg-info/SOURCES.txt' reading manifest file 'magento_integration.egg-info/SOURCES.txt' writing manifest file 'magento_integration.egg-info/SOURCES.txt' installing library code to build/bdist.linux-x86_64/egg running install_lib warning: install_lib: 'build/lib.linux-x86_64-2.6' does not exist -- no Python modules to install creating build creating build/bdist.linux-x86_64 creating build/bdist.linux-x86_64/egg creating build/bdist.linux-x86_64/egg/EGG-INFO copying magento_integration.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO copying magento_integration.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying magento_integration.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying magento_integration.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO copying magento_integration.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO copying magento_integration.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO creating dist creating 'dist/magento_integration-0.1-py2.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it removing 'build/bdist.linux-x86_64/egg' (and everything under it) Processing magento_integration-0.1-py2.6.egg removing '/usr/local/lib/python2.6/dist-packages/magento_integration-0.1-py2.6.egg' (and everything under it) creating /usr/local/lib/python2.6/dist-packages/magento_integration-0.1-py2.6.egg Extracting magento_integration-0.1-py2.6.egg to /usr/local/lib/python2.6/dist-packages magento-integration 0.1 is already the active version in easy-install.pth

Installed /usr/local/lib/python2.6/dist-packages/magento_integration-0.1-py2.6.egg Processing dependencies for magento-integration==0.1 Searching for pycountry==0.12.1 Best match: pycountry 0.12.1 pycountry 0.12.1 is already the active version in easy-install.pth

Using /usr/lib/pymodules/python2.6 Searching for magento==0.4 Best match: magento 0.4 Processing magento-0.4-py2.6.egg magento 0.4 is already the active version in easy-install.pth

Using /usr/local/lib/python2.6/dist-packages/magento-0.4-py2.6.egg Searching for itsbroken==0.2 Best match: itsbroken 0.2 Processing itsbroken-0.2-py2.6.egg itsbroken 0.2 is already the active version in easy-install.pth

Using /usr/local/lib/python2.6/dist-packages/itsbroken-0.2-py2.6.egg Searching for lxml==2.2.8 Best match: lxml 2.2.8 Adding lxml 2.2.8 to easy-install.pth file

Using /usr/lib/python2.6/dist-packages Searching for suds==0.3.9 Best match: suds 0.3.9 suds 0.3.9 is already the active version in easy-install.pth

Using /usr/lib/pymodules/python2.6 Finished processing dependencies for magento-integration==0.1

and here are the contents of the magento_integration directory after running the install

ls -l total 224 -rw-r--r-- 1 root root 1599 1 nov. 15:54 account.py -rw-r--r-- 1 root root 859 1 nov. 15:54 account.xml -rw-r--r-- 1 root root 2378 1 nov. 15:54 api.py -rw-r--r-- 1 root root 4785 1 nov. 15:54 bom.py drwxr-xr-x 3 root root 4096 1 nov. 15:55 build -rw-r--r-- 1 root root 4292 1 nov. 15:54 country.py -rw-r--r-- 1 root root 1149 1 nov. 15:54 currency.py drwxr-xr-x 2 root root 4096 1 nov. 15:55 dist drwxr-xr-x 3 root root 4096 1 nov. 15:54 doc -rw-r--r-- 1 root root 1164 1 nov. 15:54 fabfile.py -rw-r--r-- 1 root root 324 1 nov. 15:54 init.py -rwxr-xr-x 1 root root 779 1 nov. 15:54 install_nightly.sh drwxr-xr-x 2 root root 4096 1 nov. 15:55 magentointegration.egg-info -rw-r--r-- 1 root root 29759 1 nov. 15:54 magento.py -rw-r--r-- 1 root root 25713 1 nov. 15:54 magento.xml -rw-r--r-- 1 root root 1180 1 nov. 15:54 openerp.py -rw-r--r-- 1 root root 11171 1 nov. 15:54 partner.py -rw-r--r-- 1 root root 23210 1 nov. 15:54 product.py -rw-r--r-- 1 root root 6136 1 nov. 15:54 product.xml -rw-r--r-- 1 root root 3818 1 nov. 15:54 README.rst -rw-r--r-- 1 root root 26341 1 nov. 15:54 sale.py -rw-r--r-- 1 root root 1078 1 nov. 15:54 sale.xml -rw-r--r-- 1 root root 132 1 nov. 15:54 setup.cfg -rw-r--r-- 1 root root 2160 1 nov. 15:54 setup.py drwxr-xr-x 3 root root 4096 1 nov. 15:54 static drwxr-xr-x 3 root root 4096 1 nov. 15:54 tests drwxr-xr-x 2 root root 4096 1 nov. 15:54 wizard

and still "error on validating field arch: Invalid XML for View Architecture" when I call the module inside openerp.

Even if it is not exactly the same problem, other people https://github.com/openlabs/magento_integration/issues/147#issuecomment-27167554 meet problems with the installation which seems to be not so easy as described.

Seems like something somewhere prevents the module to re-install. This has to do with the linux/debian/python environment rather than with openerp but I can't see what is missing. Am I doomed to stay on the old version ? :(

l-arnold commented 10 years ago

On my side (#147 above) I have done a few installs on magento and magento_integration. I get an error on OpenERP server at start up that the module "magento" is shadowed by another (and it tells me where in my usr/lib folder that lots of packages seem to end up.

I will run a git pull to update and see if that works. My focus has been working on the modules based in the /openerp/addons/(module name) focus, but perhaps I should also do this in the usr/lib folders. The Usr/Lib folder does not respond to a Git Pull but I beleive it was created in one of the various install attemps (setup.py, easy_install and pip) that are all variously recomended for installation proceedures.

Making this somewhat more complicated is the fact that various dependencies need to be installed in different ways (apt-get, manual download, and as part of the module installs themselves (which sometimes fail). I recall the dependencies to be pycountry (which was in fact in our system), grubs (something like that) and itsbroken. I have described these w/ more detail in other issues.

My situation is that although OpenERP is accepting magento_integration, the system itself is far from working properly.