This question has been flagged
4 Replies
6203 Views

I am writting a new module which includes views customization through XML.

While writting the XML, it seems that I have referenced a non-existing field in XML, but now I can not start odoo again, even when I change the XML file.

Is it possible to fully deinstall the module from command line? Is it possible to stuck the server becuase of a bad module?

Error context:
View `sale.margin.percent.view.form`
[view_id: 797, xml_id: sale_margin_percent.sale_margin_percent_u5, model: sale.order, parent_id: 794]
2015-11-05 17:25:54,320 661 INFO test1 werkzeug: 127.0.0.1 - - [05/Nov/2015 17:25:54] "GET /web?db=test1 HTTP/1.1" 302 -
2015-11-05 17:25:54,628 661 INFO test1 openerp.modules.loading: loading 1 modules...
2015-11-05 17:25:54,644 661 INFO test1 openerp.modules.loading: 1 modules loaded in 0.02s, 0 queries
2015-11-05 17:25:54,725 661 INFO test1 openerp.modules.loading: loading 63 modules...
2015-11-05 17:25:56,598 661 INFO test1 openerp.modules.module: module sale_margin_percent: creating or updating database tables
2015-11-05 17:25:56,683 661 INFO test1 openerp.modules.loading: loading sale_margin_percent/sale_margin_percent.xml
2015-11-05 17:25:57,011 661 ERROR test1 openerp.addons.base.ir.ir_ui_view: Element '<xpath expr="//field[@name='order_line']/tree/field[@name='purchase_price']">' cannot be located in parent view

Error context:
View `sale.margin.percent.view.form`
[view_id: 797, xml_id: sale_margin_percent.sale_margin_percent_u5, model: sale.order, parent_id: 794]
2015-11-05 17:25:57,014 661 INFO test1 werkzeug: 127.0.0.1 - - [05/Nov/2015 17:25:57] "GET /web?db=test1 HTTP/1.1" 302 -
2015-11-05 17:25:57,489 661 INFO test1 openerp.modules.loading: loading 1 modules...
2015-11-05 17:25:57,507 661 INFO test1 openerp.modules.loading: 1 modules loaded in 0.02s, 0 queries
2015-11-05 17:25:57,593 661 INFO test1 openerp.modules.loading: loading 63 modules...
2015-11-05 17:25:59,681 661 INFO test1 openerp.modules.module: module sale_margin_percent: creating or updating database tables
2015-11-05 17:25:59,764 661 INFO test1 openerp.modules.loading: loading sale_margin_percent/sale_margin_percent.xml
2015-11-05 17:26:00,105 661 ERROR test1 openerp.addons.base.ir.ir_ui_view: Element '<xpath expr="//field[@name='order_line']/tree/field[@name='purchase_price']">' cannot be located in parent view

 The XML no longer has that part of code caussing the issue. The problem is that at the end I get "Too many redirects" in Chrome and I can no longer access the application.

Avatar
Discard
Best Answer

After making the change, did you try updating the module via command line:

./openerp-server -u <your_module_name> -d test1

This should probably work.

If not, you can also try querying the module list table:

select state from ir_module_module where name='module_name';

The state will probably be 'installed'

You could try setting it to 'uninstalled':

update ir_module_module set state='uninstalled' where name='module_name';

Then try restarting the server.i

This should only be done on a Dev server - it is more a hack than a solution. Just updating the module through command line should work.

 


Avatar
Discard
Best Answer

If none of the options from Shawn Varghese work, try stopping the server and commenting out in the __openerp__.py file the view causing the problem:

"data": [

"views/name_of_view_raising_errors.xml"

],


Then start the server again, fix the code and upgrade the module when you are done.  


Avatar
Discard

Oh yea, you're right ! I missed this out.... this should probably be the first thing to try

Author Best Answer

Thanks both of you. I finally managed to startup the server by modifying the code but keeping the modification chunks previously defined (instead of removing them up). It seems that once certain code is in place, you can only modify in a way where the previous change is updated. Weird behaviour.

I keep your solutions for future as I guess this will happen from time to time.

Avatar
Discard