Skip to Content
Menu
This question has been flagged
1 Reply
1841 Views

I created a simple module, that add custom field in partner module. But then I deleting this module in app manager, I can't access to partner module anymore. What I'm doing wrong?

So, this is my code: 

models.py

from odoo import models, fields, api
class ResPartnerInherited(models.Model):
    _inherit = 'res.partner'
    card_number = fields.Char(string="Card Number", required=False, )

views.xml

<odoo>
  <data>
    <!-- Inherit Form View to Modify it -->
    <record id="" model="ir.ui.view">
        <field name="name">res.partner.cardnumber.field</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form"/>
        <field name="arch" type="xml">
            <xpath expr="//field[@name='category_id']" position="after">
                <!-- Add your fields or attributes here -->
              <field name="card_number"/>
            </xpath>
        </field>
    </record>
  </data>
</odoo>

Error:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 640, in _handle_exception
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 677, in dispatch
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 333, in _call_function
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\service\model.py", line 101, in wrapper
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 326, in checked_call
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 935, in __call__
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\http.py", line 506, in response_wrap
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\web\controllers\main.py", line 885, in call_kw
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\web\controllers\main.py", line 877, in _call_kw
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\api.py", line 679, in call_kw
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\api.py", line 664, in call_kw_model
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\models.py", line 1338, in load_views
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\models.py", line 1338, in <dictcomp>
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\base\res\res_partner.py", line 312, in fields_view_get
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\mail\models\mail_thread.py", line 362, in fields_view_get
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\models.py", line 1417, in fields_view_get
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\base\ir\ir_ui_view.py", line 906, in postprocess_and_fields
  File "C:\Program Files (x86)\Odoo 10.0\server\odoo\addons\base\ir\ir_ui_view.py", line 464, in raise_view_error ValueError: \u041f\u043e\u043b\u0435 `card_number` \u043d\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442
\u041e\u0448\u0438\u0431\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430:
\u041f\u0440\u043e\u0441\u043c\u043e\u0442\u0440 `res.partner.form`
[view_id: 124, xml_id: base.view_partner_form, model: res.partner, parent_id: n/a]

Avatar
Discard
Best Answer

you have ruined views in db. restore the db or fix that error manually.

here is your starting point: 

[view_id: 124, xml_id: base.view_partner_form, model: res.partner, parent_id: n/a]

Avatar
Discard