Skip to Content
Menu
This question has been flagged
2 Replies
7381 Views

Im getting this error while refreshing my custom made wizard model

The code

from odoo import fields, models, api

class CreateExam(models.TransientModel):
_name = 'exam.wizards'
_description = 'Create exams'

std_wiz = fields.Many2one(
comodel_name='std.record',
string='Student',
required=False)
std_subject = fields.Many2one('std.subject',string="Subject")
std_marks=fields.Float(string="Marks")

def save_btn(self):
print("saved")
return True



Avatar
Discard
Author

my xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="examwiz_view_form" model="ir.ui.view">
<field name="name">exam_view_form</field>
<field name="model">exam.wizards</field>
<field name="arch" type="xml">
<form string="exam form">
<sheet>
<group>
<field name="std_wiz"/>
<field name="std_subject"/>
<field name="std_marks"/>

</group>
</sheet>
<footer>
<button name="save_btn" string="save" type="object" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="examwiz_action" model="ir.actions.act_window">
<field name="name"></field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">exam.wizards</field>
<field name="view_mode">form</field>
<field name="view_id" ref="examwiz_view_form"/>
<field name="target">new</field>
</record>
<!-- This Menu Item must have a parent and an action -->
<menuitem id="examwiz_categ" name="Create Exam" parent="school_root_menu" action="examwiz_action" sequence="5"/>

</data>
</odoo>

Best Answer

this error is mostly caused by changing previous type field with perhaps is the same name, i suggest to uninstall the module that related to it or just make a new field with different name and different type

Avatar
Discard
Best Answer

You don't have any issue in your code as I can see. Check the log file to see more details about the error and which line cause this issue.

Avatar
Discard
Author

This is my log file. kindly check this out
ERROR: couldn't create the logfile directory. Logging to the standard output.
2022-02-20 16:22:48,158 5752 INFO ? odoo: Odoo version 14.0-20211201
2022-02-20 16:22:48,158 5752 INFO ? odoo: Using configuration file at C:\Users\alfik\PycharmProjects\pythonProject\odoo11\odoo.conf
2022-02-20 16:22:48,158 5752 INFO ? odoo: addons paths: ['C:\\Users\\alfik\\PycharmProjects\\pythonProject\\odoo11\\odoo\\addons', 'c:\\users\\alfik\\appdata\\local\\openerp s.a\\odoo\\addons\\14.0', 'c:\\users\\alfik\\pycharmprojects\\pythonproject\\odoo11\\odoo\\addons', 'c:\\users\\alfik\\pycharmprojects\\pythonproject\\custom_addons']
2022-02-20 16:22:48,158 5752 INFO ? odoo: database: admin@localhost:5432
2022-02-20 16:22:48,784 5752 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopdf binary at C:\Program Files\odoo14\thirdparty\wkhtmltopdf.exe
2022-02-20 16:22:49,104 5752 INFO ? odoo.service.server: HTTP service (werkzeug) running on DESKTOP-6UI91MB.bbrouter:8069
2022-02-20 16:22:49,163 5752 INFO alfikodoo odoo.modules.loading: loading 1 modules...
2022-02-20 16:22:49,179 5752 INFO alfikodoo odoo.modules.loading: 1 modules loaded in 0.02s, 0 queries (+0 extra)
2022-02-20 16:22:49,285 5752 INFO alfikodoo odoo.modules.loading: updating modules list
2022-02-20 16:22:49,304 5752 INFO alfikodoo odoo.addons.base.models.ir_module: ALLOW access to module.update_list on [] to user __system__ #1 via n/a
2022-02-20 16:22:50,790 5752 INFO alfikodoo odoo.addons.base.models.ir_module: ALLOW access to module.button_upgrade on ['student'] to user __system__ #1 via n/a
2022-02-20 16:22:50,790 5752 INFO alfikodoo odoo.addons.base.models.ir_module: ALLOW access to module.update_list on ['student'] to user __system__ #1 via n/a
2022-02-20 16:22:51,894 5752 INFO alfikodoo odoo.addons.base.models.ir_module: ALLOW access to module.button_install on [] to user __system__ #1 via n/a
2022-02-20 16:22:52,002 5752 INFO alfikodoo odoo.modules.loading: loading 79 modules...
2022-02-20 16:22:52,049 5752 WARNING alfikodoo odoo.addons.attachment_indexation.models.ir_attachment: Attachment indexation of PDF documents is unavailable because the 'pdfminer' Python library cannot be found on the system. You may install it from https://pypi.org/project/pdfminer.six/ (e.g. `pip3 install pdfminer.six`)
2022-02-20 16:22:52,782 5752 INFO alfikodoo odoo.modules.loading: Loading module student (42/79)
2022-02-20 16:22:53,164 5752 INFO alfikodoo odoo.modules.registry: module student: creating or updating database tables
2022-02-20 16:22:53,482 5752 INFO alfikodoo odoo.modules.loading: loading student/views/studentrecord.xml
2022-02-20 16:22:53,607 5752 INFO alfikodoo odoo.modules.loading: loading student/security/ir.model.access.csv
2022-02-20 16:22:53,663 5752 INFO alfikodoo odoo.modules.loading: loading student/views/studentclass.xml
2022-02-20 16:22:53,704 5752 INFO alfikodoo odoo.modules.loading: loading student/security/security.xml
2022-02-20 16:22:53,724 5752 INFO alfikodoo odoo.modules.loading: loading student/views/teacher.xml
2022-02-20 16:22:53,775 5752 INFO alfikodoo odoo.modules.loading: loading student/views/teacherdetails.xml
2022-02-20 16:22:53,789 5752 INFO alfikodoo odoo.modules.loading: loading student/wizard/exam_wizard.xml
2022-02-20 16:22:53,835 5752 INFO alfikodoo odoo.modules.loading: Module student loaded in 1.05s, 424 queries
2022-02-20 16:22:54,764 5752 INFO alfikodoo odoo.modules.loading: 79 modules loaded in 2.76s, 424 queries (+0 extra)
2022-02-20 16:22:55,518 5752 INFO alfikodoo odoo.addons.base.models.ir_model: Deleting 1427@ir.model.fields.selection (student.selection__exam_wizards__std_subject__english)
2022-02-20 16:22:55,521 5752 WARNING alfikodoo odoo.modules.loading: Transient module states were reset
2022-02-20 16:22:55,533 5752 ERROR alfikodoo odoo.modules.registry: Failed to load registry
2022-02-20 16:22:55,533 5752 CRITICAL alfikodoo odoo.service.server: Failed to initialize database `alfikodoo`.
Traceback (most recent call last):
File "C:\Users\alfik\PycharmProjects\pythonProject\odoo11\odoo\service\server.py", line 1199, in preload_registries
registry = Registry.new(dbname, update_module=update_module)
File "C:\Users\alfik\PycharmProjects\pythonProject\odoo11\odoo\modules\registry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "C:\Users\alfik\PycharmProjects\pythonProject\odoo11\odoo\modules\loading.py", line 503, in load_modules
env['ir.model.data']._process_end(processed_modules)
File "C:\Users\alfik\PycharmProjects\pythonProject\odoo11\odoo\addons\base\models\ir_model.py", line 2296, in _process_end
record.unlink()
File "C:\Users\alfik\PycharmProjects\pythonProject\odoo11\odoo\addons\base\models\ir_model.py", line 1370, in unlink
self._process_ondelete()
File "C:\Users\alfik\PycharmProjects\pythonProject\odoo11\odoo\addons\base\models\ir_model.py", line 1418, in _process_ondelete
ondelete = (field.ondelete or {}).get(selection.value)
AttributeError: 'str' object has no attribute 'get'

Related Posts Replies Views Activity
2
May 23
7050
0
Mar 22
101
2
Feb 22
3471
1
Jun 23
4979
1
Mar 23
2176