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

Why can't I uninstall a simple custom module adding a single field to the purchase.order Model and User Interface?

By
Robert Price
on 10/20/16, 1:59 PM 261 views

What am I doing wrong (using V10.0)?

Module adds one field to the purchase order form. When uninstalls it breaks the database.


model and view as follows:

-------------------------------------------------------------------------

# -*- coding: utf-8 -*-

from odoo import models

from odoo import fields

from odoo import api


class SMS(models.Model):
    _inherit = 'purchase.order'

    sms_project_code = fields.Integer('Project Code PRJ:', help="Enter SMS Project Code")


-----------------------------------------------------------------------------------------------------------------------------------


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

<odoo>

<data>  
 
    <record id="smspurchase_order_form" model="ir.ui.view">

        <field name="name">purchase.order.form.inherit</field>

        <field name="model">purchase.order</field>

        <field name="inherit_id" ref="purchase.purchase_order_form"/>

        <field name="arch" type="xml">

            <!-- extended elements-->

            <field name="date_order" position="after">

                <field name="sms_project_code" />

            </field>

        </field>

    </record>

</data>

</odoo>


Traceback as follows
Traceback (most recent call last):
  File "/home/odoo/odoo-20161019/odoo/http.py", line 638, in _handle_exception    return super(JsonRequest, self)._handle_exception(exception)  File "/home/odoo/odoo-20161019/odoo/http.py", line 675, in dispatch    result = self._call_function(**self.params)  File "/home/odoo/odoo-20161019/odoo/http.py", line 331, in _call_function    return checked_call(self.db, *args, **kwargs)  File "/home/odoo/odoo-20161019/odoo/service/model.py", line 119, in wrapper    return f(dbname, *args, **kwargs)  File "/home/odoo/odoo-20161019/odoo/http.py", line 324, in checked_call    result = self.endpoint(*a, **kw)  File "/home/odoo/odoo-20161019/odoo/http.py", line 933, in __call__    return self.method(*args, **kw)  File "/home/odoo/odoo-20161019/odoo/http.py", line 504, in response_wrap    response = f(*args, **kw)  File "/home/odoo/odoo-20161019/odoo/addons/web/controllers/main.py", line 866, in call_button    action = self._call_kw(model, method, args, {})  File "/home/odoo/odoo-20161019/odoo/addons/web/controllers/main.py", line 854, in _call_kw    return call_kw(request.env[model], method, args, kwargs)  File "/home/odoo/odoo-20161019/odoo/api.py", line 681, in call_kw    return call_kw_multi(method, model, args, kwargs)  File "/home/odoo/odoo-20161019/odoo/api.py", line 672, in call_kw_multi    result = method(recs, *args, **kwargs)  File "/home/odoo/odoo-20161019/odoo/addons/base/module/wizard/base_module_upgrade.py", line 76, in upgrade_module    odoo.modules.registry.Registry.new(self._cr.dbname, update_module=True)  File "/home/odoo/odoo-20161019/odoo/modules/registry.py", line 78, in new    odoo.modules.load_modules(registry._db, force_demo, status, update_module)  File "/home/odoo/odoo-20161019/odoo/modules/loading.py", line 333, in load_modules    force, status, report, loaded_modules, update_module)  File "/home/odoo/odoo-20161019/odoo/modules/loading.py", line 235, in load_marked_modules    loaded, processed = load_module_graph(cr, graph, progressdict, report=report, skip_modules=loaded_modules, perform_checks=perform_checks)  File "/home/odoo/odoo-20161019/odoo/modules/loading.py", line 131, in load_module_graph    model_names = registry.load(cr, package)  File "/home/odoo/odoo-20161019/odoo/modules/registry.py", line 261, in load    model = cls._build_model(self, cr)  File "/home/odoo/odoo-20161019/odoo/models.py", line 521, in _build_model    raise TypeError("Model %r does not exist in registry." % name)TypeError: Model 'purchase.order' does not exist in registry.

0
Robert Price
On 10/21/16, 7:34 AM


All working now, needed to add 'purchase' to the depends in __manifest__.py

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

1 follower(s)

Stats

Asked: 10/20/16, 1:59 PM
Seen: 261 times
Last updated: 10/21/16, 8:07 AM