Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Can you solve this custom module error?

By
John Baldwin
on 5/13/14, 11:02 AM 1,236 views

Keep getting this error while trying to install custom module:

OpenERP Server Error Client Traceback (most recent call last): File "/opt/openerp/server/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, *self.params) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1132, in call_button action = self._call_kw(req, model, method, args, {}) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/opt/openerp/server/openerp/addons/web/session.py", line 42, in proxy result = self.proxy.execute_kw(self.session._db, self.session._uid, self.session._password, self.model, method, args, kw) File "/opt/openerp/server/openerp/addons/web/session.py", line 30, in proxy_method result = self.session.send(self.service_name, method, *args) File "/opt/openerp/server/openerp/addons/web/session.py", line 103, in send raise xmlrpclib.Fault(openerp.tools.ustr(e), formatted_info)

Server Traceback (most recent call last): File "/opt/openerp/server/openerp/addons/web/session.py", line 89, in send return openerp.netsvc.dispatch_rpc(service_name, method, args) File "/opt/openerp/server/openerp/netsvc.py", line 296, in dispatch_rpc result = ExportService.getService(service_name).dispatch(method, params) File "/opt/openerp/server/openerp/service/web_services.py", line 626, in dispatch res = fn(db, uid, params) File "/opt/openerp/server/openerp/osv/osv.py", line 190, in execute_kw return self.execute(db, uid, obj, method, *args, *kw or {}) File "/opt/openerp/server/openerp/osv/osv.py", line 132, in wrapper return f(self, dbname, args, *kwargs) File "/opt/openerp/server/openerp/osv/osv.py", line 199, in execute res = self.execute_cr(cr, uid, obj, method, args, *kw) File "/opt/openerp/server/openerp/addons/audittrail/audittrail.py", line 524, in execute_cr return fct_src(cr, uid, model, method, args, *kw) File "/opt/openerp/server/openerp/osv/osv.py", line 187, in execute_cr return getattr(object, method)(cr, uid, args, *kw) File "/opt/openerp/server/openerp/addons/base/module/module.py", line 424, in button_immediate_install return self._button_immediate_function(cr, uid, ids, self.button_install, context=context) File "/opt/openerp/server/openerp/addons/base/module/module.py", line 475, in _button_immediate_function _, pool = pooler.restart_pool(cr.dbname, update_module=True) File "/opt/openerp/server/openerp/pooler.py", line 39, in restart_pool registry = RegistryManager.new(db_name, force_demo, status, update_module) File "/opt/openerp/server/openerp/modules/registry.py", line 233, in new openerp.modules.load_modules(registry.db, force_demo, status, update_module) File "/opt/openerp/server/openerp/modules/loading.py", line 354, in load_modules loaded_modules, update_module) File "/opt/openerp/server/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 "/opt/openerp/server/openerp/modules/loading.py", line 159, in load_module_graph load_openerp_module(package.name) File "/opt/openerp/server/openerp/modules/module.py", line 405, in load_openerp_module __import__('openerp.addons.' + module_name) File "/opt/openerp/server/openerp/modules/module.py", line 132, in load_module f, path, descr = imp.find_module(module_part, ad_paths) ImportError: No module named my_marketing

My files:

__inti__.py

import mymarketing

__openerp__.py

    {
    'name': 'My Marketing',
    'version': '1.0',
    'description': """
    My Marketing Module
    """,
    'author': 'John',
    'website': 'not allowed to post links',
    'depends': ['base_setup'],
    'data': ['mymarketing_view.xml'],
    'demo': [],
    'installable': True,
    'auto_install': False,
    }

mymarketing.py

from osv import osv, fields

class mymarketing_campaigns(osv.Model):
    _name = "mymarketing.campaigns"

    _columns = {
        'name': fields.char('Campaign Name', size=64, required=True),
        'startdate': fields.date('Start Date'),
        'description':fields.text('Description'),
        'targetarea':fields.text('Target Area'),
        }

mymarketing_campaigns()

mymarketing_view.xml

    <?xml version="1.0" encoding="utf-8"?>

<openerp>
    <data>
        <record id="mymarketing_campaigns_action" model="ir.actions.act_window">
            <field name="name">Campaigns</field>
            <field name="res_model">mymarketing.campaigns</field>
            <field name="view_type">form</field>
            <field name="view_mode">tree,form</field>
            <field name="help" type="html">
                <p class="oe_view_nocontent_create">Click Create to add a new marketing campaign.</p>
            </field>
        </record>
        <record id="mymarketing_campaigns_form_view" model="ir.ui.view">
            <field name="name">mymarketing.campaigns.form.view</field>
            <field name="view_type">form</field>
            <field name="model">mymarketing.campaigns</field>
            <field name="arch" type="xml">
                <form string="Campaign">
                    <field name="name"/>
                    <field name="startdate"/>
                    <notebook colspan="4">
                        <page string="Description">
                            <field name="description" nolabel="1" colspan="4" placeholder="describe the campaign here..."/>
                            <field name="targetarea" colspan="4" placeholder="describe the campaign's target area here..."/>
                        </page>
                    </notebook>
                </form>
            </field>
        </record>
        <record id="mymarketing_campaigns_tree_view" model="ir.ui.view">
            <field name="name">mymarketing.campaigns.tree.view</field>
            <field name="view_type">tree</field>
            <field name="model">mymarketing.campaigns</field>
            <field name="arch" type="xml">
                <tree string="Campaign">
                    <field name="name"/>
                    <field name="startdate"/>
                </tree>
            </field>
        </record>
        <menuitem id="mymarketing" name="Marketing" />
        <menuitem id="mymarketing_menu" name="Marketing" parent="mymarketing" />
        <menuitem id="mymarketing_campaigns_menu"
                        name="Campaigns" 
                        parent="mymarketing_menu" 
                        action="mymarketing_campaigns_action" 
        />
    </data>
</openerp>
0

Jagdish Panchal

--Jagdish Panchal--
2674
| 5 3 6
Gandhinagar, India
--Jagdish Panchal--

OpenERP Developer

Jagdish Panchal
On 5/13/14, 11:08 AM

Hi,

Problem in __inti__.py in this file import your .py file name

__inti__.py

import my_marketing

My folder is named my_marketing... My .py file is named mymarketing.py without an underscore.

John Baldwin
on 5/13/14, 11:12 AM

The underscore is definitely the cause of the error posted.I would suggest being consistent with the underscore. Change mymarketing to my_marketing throughout the code.

Rich Granata
on 5/13/14, 11:31 AM

No, not it. I went through the code twice, changed it both ways (with an underscore and without) and nothing happened. Same fail, same error message, same problem.

John Baldwin
on 5/13/14, 11:54 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/13/14, 11:02 AM
Seen: 1236 times
Last updated: 3/16/15, 8:10 AM