Skip to content

Updated#9

Open
mikhail-trunks-silao wants to merge 1 commit intoodevsolutions:mainfrom
jadenrapsing:main
Open

Updated#9
mikhail-trunks-silao wants to merge 1 commit intoodevsolutions:mainfrom
jadenrapsing:main

Conversation

@mikhail-trunks-silao
Copy link
Collaborator

No description provided.

@mikhail-trunks-silao
Copy link
Collaborator Author

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):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unique=True doesnt work, use python or database constraints to make sure name values is unique

Comment on lines +18 to +24
class LibraryBook(models.Model):
_inherit = "library.book"

category_id = fields.Many2many(
comodel_name = "library.book.category",
string = "Categories"
) No newline at end of file
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"/>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"/>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong inherit ID

Comment on lines +29 to +52
<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>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"/>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put your name as the Author

@mikhail-trunks-silao
Copy link
Collaborator Author

There is no ir.model.access.csv in your code, create one to give users access to library.book.category model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants