-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[ADD] estate: started the server framework,completed the coding guidelines, setup guide, and chapter 1 #1265
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
base: 19.0
Are you sure you want to change the base?
Changes from all commits
ec88e8d
ff8989b
23b98ba
64a0603
16aa427
a961ff4
cded8b7
29dcb31
f730e20
b3c2063
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| from . import models | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| { | ||
| "name": "real estate", | ||
| "version": "1.0", | ||
| "summary": "Estate management", | ||
| "description": "Estate management", | ||
| "author": "Odoo S.A.", | ||
| "category": "tutorials", | ||
| "depends": ["base"], | ||
| "data": [ | ||
| "security/ir.model.access.csv", | ||
| "views/estate_property_views.xml", | ||
| "views/estate_property_type_views.xml", | ||
| "views/estate_menus.xml" | ||
| ], | ||
| "license": "LGPL-3", | ||
| "application": True, | ||
| "installable": True | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| from . import estate_property | ||
| from . import estate_property_type | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| from dateutil.relativedelta import relativedelta | ||
|
|
||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstateProperty(models.Model): | ||
| _name = "estate.property" | ||
| _description = "Real Estate Property" | ||
|
|
||
| name = fields.Char(required=True) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be one line empty before the field declaration. |
||
| description = fields.Text() | ||
| postcode = fields.Char() | ||
| date_availability = fields.Date( | ||
| default=lambda self: ( | ||
| # Without lambda, date would be fixed permanently | ||
| fields.Date.today() + relativedelta(months=3) | ||
| ) | ||
| ) | ||
| expected_price = fields.Float() | ||
| 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([ | ||
| ('north', 'North'), | ||
| ('south', 'South'), | ||
| ('east', 'East'), | ||
| ('west', 'West'), | ||
| ]) | ||
| active = fields.Boolean(default=True) | ||
| state = fields.Selection( | ||
| [ | ||
| ('new', 'New'), | ||
| ('offer_received', 'Offer Received'), | ||
| ('offer_accepted', 'Offer Accepted'), | ||
| ('sold', 'Sold'), | ||
| ('canceled', 'Canceled') | ||
| ], | ||
| required=True, | ||
| copy=False, | ||
| default='new' | ||
| ) | ||
| buyer_id = fields.Many2one("res.partner",string="buyer",copy=False) | ||
| salesperson_id = fields.Many2one("res.users",string="salesperson",default=lambda self:self.env.user) | ||
| property_id= fields.Many2one("estate.property.type",string="Property Type") | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class EstatePropertyType(models.Model): | ||
| _name = "estate.property.type" | ||
| _description = "Property Types" | ||
|
|
||
| name = fields.Char(required=True) | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| 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 | ||
| access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1 | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <odoo> | ||
| <!-- Main App Menu --> | ||
| <menuitem | ||
| id="estate_menu_root" | ||
| name="Real Estate" | ||
| /> | ||
| <!--First | ||
| Level Menu--> | ||
| <menuitem | ||
| id="estate_property_menu" | ||
| name="Advertisement" | ||
| parent="estate_menu_root" | ||
| /> | ||
| <!--Action | ||
| Menu--> | ||
| <menuitem | ||
| id="estate_property_action_menu" | ||
| name="Property List" | ||
| parent="estate_property_menu" | ||
| action="estate_property_action" | ||
| /> | ||
| <!--Action | ||
| Menu--> | ||
| <menuitem | ||
| id="estate_property_type_menu" | ||
| name="Settings" | ||
| parent="estate_menu_root" | ||
| /> | ||
| <!--Action | ||
| Menu--> | ||
| <menuitem | ||
| id="estate_property_type_list_menu" | ||
| name="Property Type" | ||
| parent="estate_property_type_menu" | ||
| action="estate_property_type_action" | ||
| /> | ||
| </odoo> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be one empty line at the end of the file. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <odoo> | ||
| <!--ACTION--> | ||
| <record id="estate_property_type_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Types</field> | ||
| <field name="res_model">estate.property.type</field> | ||
| <field name="view_mode">list,form</field> | ||
| </record> | ||
| </odoo> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be one empty line at the end of the file. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| <odoo> | ||
| <!--List View--> | ||
| <record id="estate_property_list_view" 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" delete="False"> | ||
| <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" /> | ||
| <field name="property_id" /> | ||
| </list> | ||
| </field> | ||
| </record> | ||
| <!--Form | ||
| View--> | ||
| <record id="estate_property_form_view" model="ir.ui.view"> | ||
| <field name="name">estate.property.form</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Properties"> | ||
| <sheet> | ||
| <div> | ||
| <h1> | ||
| <field name="name" /> | ||
| </h1> | ||
| </div> | ||
|
|
||
| <group> | ||
| <group> | ||
| <field name="property_id" /> | ||
| <field name="postcode" /> | ||
| <field name="expected_price" /> | ||
| </group> | ||
|
|
||
| <group> | ||
| <field name="date_availability" /> | ||
| <field name="selling_price" /> | ||
| </group> | ||
| </group> | ||
|
|
||
| <notebook> | ||
| <page string="Description"> | ||
| <group> | ||
| <field name="description" /> | ||
| <field name="bedrooms" /> | ||
| <field name="living_area" /> | ||
| <field name="facades" /> | ||
| <field name="garage" /> | ||
| <field name="garden" /> | ||
| <field name="garden_area" /> | ||
| <field name="garden_orientation" /> | ||
| <field name="active" /> | ||
| <field name="state" /> | ||
| </group> | ||
| </page> | ||
|
|
||
| <page string="Other Info"> | ||
| <group> | ||
| <field name="buyer_id" /> | ||
| <field name="salesperson_id" /> | ||
| </group> | ||
| </page> | ||
| </notebook> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!--Search | ||
| View--> | ||
| <record id="estate_property_search_view" model="ir.ui.view"> | ||
| <field name="name">estate.property.search</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <search> | ||
| <field name="name" string="xyz" /> | ||
| <field name="postcode" /> | ||
| <field name="expected_price" /> | ||
| <field name="bedrooms" /> | ||
| <field name="living_area" /> | ||
| <field name="facades" /> | ||
| <filter string="Available" name="state" | ||
| domain="['|',('state','=','new'),('state','=','offer_received')]" /> | ||
| <filter string="Postcode" name="postcode" context="{'group_by':'postcode'}" /> | ||
| </search> | ||
| </field> | ||
| </record> | ||
|
|
||
| <!--ACTION--> | ||
| <record id="estate_property_action" model="ir.actions.act_window"> | ||
| <field name="name">Properties</field> | ||
| <field name="res_model">estate.property</field> | ||
| <field name="view_mode">list,form</field> | ||
| </record> | ||
| </odoo> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please follwe the import coding guidelines?
https://www.odoo.com/documentation/19.0/contributing/development/coding_guidelines.html#imports