Conversation
|
Your module library_extensions is inside the library module. Move your module library_extensions outside of of library so that Odoo can read it. |
| required = True | ||
| ) | ||
|
|
||
| class LibraryBookCategory(models.Model): |
There was a problem hiding this comment.
Move this to another python file called library_book_catgory.py
| _name = "library.book.category" | ||
| _description = "Book Category" | ||
|
|
||
| name = fields.Char(string="Category Name", required=True, unique=True) |
There was a problem hiding this comment.
unique=True doesnt work, use python or database constraints to make sure name values is unique
| class LibraryBook(models.Model): | ||
| _inherit = "library.book" | ||
|
|
||
| category_id = fields.Many2many( | ||
| comodel_name = "library.book.category", | ||
| string = "Categories" | ||
| ) No newline at end of file |
There was a problem hiding this comment.
No need to create another model declaration for a new field, just put it under on the original model delaration.
| <record id="view_library_book_form_inherit" model="ir.ui.view"> | ||
| <field name="name">library.book.form.inherit</field> | ||
| <field name="model">library.book</field> | ||
| <field name="inherit_id" ref="library.view_library_book_form"/> |
There was a problem hiding this comment.
Wrong inherit ID
| <record id="view_library_book_tree_inherit" model="ir.ui.view"> | ||
| <field name="name">library.book.tree.inherit</field> | ||
| <field name="model">library.book</field> | ||
| <field name="inherit_id" ref="library.view_library_book_tree"/> |
There was a problem hiding this comment.
Wrong inherit ID
| <record id="view_library_book_category_tree" model="ir.ui.view"> | ||
| <field name="name">library.book.category.tree</field> | ||
| <field name="model">library.book.category</field> | ||
| <field name="arch" type="xml"> | ||
| <tree> | ||
| <field name="name"/> | ||
| </tree> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!-- Book Category Form View --> | ||
| <record id="view_library_book_category_form" model="ir.ui.view"> | ||
| <field name="name">library.book.category.form</field> | ||
| <field name="model">library.book.category</field> | ||
| <field name="arch" type="xml"> | ||
| <form> | ||
| <sheet> | ||
| <group> | ||
| <field name="name"/> | ||
| </group> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> |
There was a problem hiding this comment.
Move this views to a new file library_book_category_views.xml
| </record> | ||
|
|
||
| <!-- Menu Item for Book Categories --> | ||
| <menuitem id="menu_library_book_category" name="Book Category" parent="library.menu_library_root"/> |
There was a problem hiding this comment.
Create a view action for this menuitem, wrong parent is used for this menu item. Move this views to a new file library_book_category_views.xml
| "name": "Library Extensions", | ||
| "version": "1.0" | ||
| "depends": ["library"], | ||
| "author": " Your Name", |
There was a problem hiding this comment.
Put your name as the Author
|
There is no |
No description provided.