Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ADD] created a new module, model definition,added security file,crea… #322

Draft
wants to merge 2 commits into
base: 18.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions estate/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
13 changes: 13 additions & 0 deletions estate/__manifest__.py

Choose a reason for hiding this comment

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

Check the proper sequencing for fields in manifest file.

Copy link
Author

Choose a reason for hiding this comment

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

Checked the proper sequencing and done changes accordingly.

Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
'name':'Real Estate',
'version':'0.0.0',

Choose a reason for hiding this comment

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

Suggested change
'version':'0.0.0',
'version':'1.0',

please add correct version for module.

Copy link
Author

Choose a reason for hiding this comment

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

Suggested changes are done.

'sequence': 1,
'application':True,
'installable': True,
'author':'JODH',
'data':[
'security/ir.model.access.csv',
'views/estate_property_views.xml',
'views/estate_property_basic_views.xml',
],
}
1 change: 1 addition & 0 deletions estate/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import estate_property
30 changes: 30 additions & 0 deletions estate/models/estate_property.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
from datetime import timedelta
from odoo import models, fields

class EstateProperty(models.Model):
_name ="estate.property"
_description="test description"


name=fields.Char(required=True,default="Unknown")

Choose a reason for hiding this comment

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

Suggested change
name=fields.Char(required=True,default="Unknown")
name = fields.Char(required=True, default="Unknown")

General comment to keep in mind from next time:
Please ensure the entire module follows coding guidelines by adding spaces wherever necessary.

Copy link
Author

Choose a reason for hiding this comment

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

ensured the coding guidelines are followed according to your suggestion.

description=fields.Text()
postcode=fields.Char()
date_availability=fields.Date(copy=False,default=fields.Date.today()+timedelta(days=+90))

Choose a reason for hiding this comment

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

Suggested change
date_availability=fields.Date(copy=False,default=fields.Date.today()+timedelta(days=+90))
date_availability = fields.Date(copy=False, default=fields.Date.today() + timedelta(days=90))

Please ensure the entire module follows coding guidelines by adding spaces wherever necessary.
Could you explain the purpose of "copy", "required", "readonly" parameters?

Copy link
Author

Choose a reason for hiding this comment

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

copy is used to make sure that while duplicating a record the field where copy is used does not gets copied,
required is used to make the field not null, and read only parameter prevents the alteration of the field.

expected_price=fields.Float(required=True)
selling_price=fields.Float(readonly=True, copy=False)
bedrooms=fields.Integer(default=2)
living_area=fields.Integer()
facades=fields.Integer()
garage=fields.Boolean()
garden=fields.Boolean()
garden_area=fields.Integer()
garden_orientation=fields.Selection(
string='Garden Orientation',
selection=[('north','North'), ('south','South'), ('east','East'), ('west','West'),],
help="It is used to define the garden orientation"
)
state=fields.Selection(
default="new",
selection=[('new', 'New'), ('offerreceived', 'Offer Received'), ('offeraccepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')]
)
active=fields.Boolean(default=True)

Choose a reason for hiding this comment

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

No new line at EOF
Check other occurences also.

Copy link
Author

Choose a reason for hiding this comment

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

checked all the occurences and add a new line at EOF.

2 changes: 2 additions & 0 deletions estate/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_estate_property,access_estate_property,model_estate_property,base.group_user,1,1,1,1
18 changes: 18 additions & 0 deletions estate/views/estate_property_basic_views.xml

Choose a reason for hiding this comment

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

Why there is need of new file for adding views?
Can't we add the views in its appropriate file (estate_property_views.xml)?

Copy link
Author

Choose a reason for hiding this comment

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

added the views in their appropriate files.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_estate_property_list" model="ir.ui.view">
<field name="name">estate.property.list</field>
<field name="model">estate.property</field>
<field name="arch" type="xml">
<list string="Properties">
<field name="name" />
<field name="postcode" />
<field name="bedrooms" />
<field name="living_area" />
<field name="expected_price" />
<field name="selling_price" />
<field name="date_availability" />
</list>
</field>
</record>
</odoo>
15 changes: 15 additions & 0 deletions estate/views/estate_property_views.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<odoo>
<record id="estate_property_action" model="ir.actions.act_window">
<field name="name">Real Estate</field>
<field name="res_model">estate.property</field>
<field name="view_mode">list,form</field>
</record>

Choose a reason for hiding this comment

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

Why there is extra line here? Please remove the extra line.

Copy link
Author

Choose a reason for hiding this comment

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

Suggested changes are done.


<!-- <menuitem id="estate_property_menu_action" action="estate_property_action"></menuitem> -->
<menuitem id="estate_menu_root" name="Real Estate">
<menuitem id="estate_first_level_menu" name="First Level">
<menuitem id="estate_property_menu_action" action="estate_property_action" />
</menuitem>
</menuitem>
</odoo>