-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[ADD] estate: init #1031
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?
[ADD] estate: init #1031
Changes from 12 commits
3458fe5
d929277
6b5c153
d851030
2b74661
f8f582c
9803b98
4bd2716
98dc4fc
b5aaaa7
9b190ce
5d4a3ff
9637ec0
1d3d53e
dd14df9
3f82fdb
b7a29bd
342118b
492a823
1a9494f
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 @@ | ||
| from . import models |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Part of Odoo. See LICENSE file for full copyright and licensing details. | ||
|
|
||
| { | ||
| 'name': 'Estate', | ||
| 'version': '1.0', | ||
| 'category': 'Sales/Estate', | ||
| 'sequence': 15, | ||
| 'description': """ | ||
| This module is here to help you manage your real estate business. | ||
| """, | ||
| 'summary': 'Track all the properties you own', | ||
| 'website': 'https://www.odoo.com/app/estate', | ||
| 'depends': [ | ||
| 'base' | ||
| ], | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
| 'views/estate_property_views.xml', | ||
| 'views/estate_property_type_views.xml', | ||
| 'views/estate_property_tag_views.xml', | ||
| 'views/estate_property_offer_views.xml', | ||
| 'views/estate_menus.xml' | ||
| ], | ||
| 'demo': [ | ||
| ], | ||
| 'installable': True, | ||
| 'application': True, | ||
| 'author': 'Odoo S.A.', | ||
| 'license': 'LGPL-3', | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| from . import estate_property | ||
| from . import estate_property_type | ||
| from . import estate_property_tag | ||
| from . import estate_property_offer |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,71 @@ | ||||||||||||||||||
| from odoo import models, fields, api, exceptions | ||||||||||||||||||
|
|
||||||||||||||||||
|
|
||||||||||||||||||
| class EstateProperty(models.Model): | ||||||||||||||||||
| _name = "estate.property" | ||||||||||||||||||
| _description = "Estate properties" | ||||||||||||||||||
|
|
||||||||||||||||||
| name = fields.Char('Name', required=True, translate=True) | ||||||||||||||||||
| description = fields.Text('Description', required=True) | ||||||||||||||||||
| postcode = fields.Char('Postcode') | ||||||||||||||||||
| date_availability = fields.Date('Available From', copy=False, default=fields.Date.add(fields.Date.today(), months=3)) | ||||||||||||||||||
| expected_price = fields.Float('Expected Price') | ||||||||||||||||||
| selling_price = fields.Float('Selling Price', readonly=True) | ||||||||||||||||||
| bedrooms = fields.Integer(default=2) | ||||||||||||||||||
| active = fields.Boolean(default=True) | ||||||||||||||||||
| living_area = fields.Integer('Living Area (sqm)') | ||||||||||||||||||
| facades = fields.Integer('Facades') | ||||||||||||||||||
| garage = fields.Boolean('Garage') | ||||||||||||||||||
| garden = fields.Boolean('Garden') | ||||||||||||||||||
| garden_area = fields.Float('Garden Area (sqm)') | ||||||||||||||||||
| garden_orientation = fields.Selection( | ||||||||||||||||||
| string='Garden Orientation', | ||||||||||||||||||
| selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')]) | ||||||||||||||||||
|
||||||||||||||||||
| selection=[('north', 'North'), ('south', 'South'), ('east', 'East'), ('west', 'West')]) | |
| selection=[ | |
| ('north', 'North'), | |
| ('south', 'South'), | |
| ('east', 'East'), | |
| ('west',` 'West') | |
| ]) |
Would be better for readability to have them in multiple lines
Outdated
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.
| selection=[('new', 'New'), ('offer_received', 'Offer Received'), ('offer_accepted', 'Offer Accepted'), ('sold', 'Sold'), ('cancelled', 'Cancelled')]) | |
| selection=[ | |
| ('new', 'New'), | |
| ('offer_received', 'Offer Received'), | |
| ('offer_accepted', 'Offer Accepted'), | |
| ('sold', 'Sold'), | |
| ('cancelled', 'Cancelled') | |
| ]) |
Outdated
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.
if the offer_ids recordset is empty it will trigger a ValueError so it is better to either check that offer_ids has something before we call max or we fallback on a default value
| record.best_price = max(record.offer_ids, key=lambda p: p.price).price | |
| record.best_price = max(record.offer_ids.mapped('price'), default=0.0) |
Outdated
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.
missing EOL
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,42 @@ | ||||||
| from odoo import models, fields ,api, exceptions | ||||||
|
|
||||||
|
|
||||||
| class EstatePropertyOffer(models.Model): | ||||||
| _name = "estate.property.offer" | ||||||
| _description = "Estate properties Offers" | ||||||
|
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. Better to have the description here as title case
Suggested change
|
||||||
|
|
||||||
| price = fields.Float('Price') | ||||||
| status = fields.Selection( | ||||||
| string='Status', | ||||||
| default='new', | ||||||
| copy=False, | ||||||
| selection=[('accepted', 'Accepted'), ('refused', 'Refused'), ('new', 'New')]) | ||||||
|
||||||
| partner_id = fields.Many2one('res.partner', string='Buyer', required=True) | ||||||
| property_id = fields.Many2one('estate.property', string='Estate Property', required=True) | ||||||
| validity = fields.Integer('Validity', default=7) | ||||||
| date_deadline = fields.Datetime('Deadline', compute='_compute_date_deadline', inverse='_inverse_date_deadline') | ||||||
|
|
||||||
| @api.depends('validity', 'create_date') | ||||||
| def _compute_date_deadline(self): | ||||||
| for record in self: | ||||||
| record.date_deadline = fields.Date.add(record.create_date, days=record.validity) | ||||||
|
||||||
| record.date_deadline = fields.Date.add(record.create_date, days=record.validity) | |
| record.date_deadline = fields.Date.add(record.create_date or fields.Date.today(), days=record.validity) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from odoo import models, fields | ||
|
|
||
|
|
||
| class EstatePropertyTag(models.Model): | ||
| _name = "estate.property.tag" | ||
| _description = "Estate properties Tags" | ||
|
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. Same about the title-case convention we should use in description |
||
|
|
||
| name = fields.Char('Name', required=True, translate=True) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from odoo import models, fields | ||
|
|
||
|
|
||
| class EstatePropertyType(models.Model): | ||
| _name = "estate.property.type" | ||
| _description = "Estate properties Types" | ||
|
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. Same |
||
|
|
||
| name = fields.Char('Name', required=True, translate=True) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| 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 | ||
| access_estate_property_tag,access_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1 | ||
| access_estate_property_offer,access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <menuitem id="estate_main_menu" name="Real Estate"> | ||
| <menuitem id="estate_advertisement_menu" name="Advertisment"> | ||
| <menuitem id="estate_property_menu_action" action="estate_property_action" /> | ||
| </menuitem> | ||
| <menuitem id="estate_settings_menu" name="Settings"> | ||
| <menuitem id="estate_property_type_menu_action" action="estate_property_type_action" /> | ||
| <menuitem id="estate_property_tag_menu_action" action="estate_property_tag_action" /> | ||
| </menuitem> | ||
| </menuitem> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,34 @@ | ||||||
| <?xml version="1.0"?> | ||||||
| <odoo> | ||||||
| <record id="estate_property_offer_view_form" model="ir.ui.view"> | ||||||
| <field name="name">estate.property.offer.form</field> | ||||||
| <field name="model">estate.property.offer</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <form string="Estate Property Offer"> | ||||||
| <group> | ||||||
| <field name="price" /> | ||||||
| <field name="status" /> | ||||||
| <field name="partner_id" /> | ||||||
| <field name="validity" /> | ||||||
| <field name="date_deadline" /> | ||||||
| </group> | ||||||
| </form> | ||||||
| </field> | ||||||
| </record> | ||||||
|
|
||||||
| <record id="estate_property_offer_view_tree" model="ir.ui.view"> | ||||||
| <field name="name">estate.property.offer.list</field> | ||||||
| <field name="model">estate.property.offer</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <list string="Channel"> | ||||||
|
||||||
| <list string="Channel"> | |
| <list string="Offers"> |
Would be reflecting better what is shown 😄
Outdated
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.
Missing EOL
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <record id="estate_property_tag_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.tag.form</field> | ||
| <field name="model">estate.property.tag</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Estate Property Tag"> | ||
| <sheet> | ||
| <div class="oe_title"> | ||
| <h1 class="mb32"> | ||
| <field name="name" placeholder="Under Option" class="mb16" /> | ||
| </h1> | ||
| </div> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_tag_action" model="ir.actions.act_window"> | ||
| <field name="name">Estate Property Tags</field> | ||
| <field name="res_model">estate.property.tag</field> | ||
| <field name="view_mode">list,form</field> | ||
| <field name="help" type="html"> | ||
| <p class="o_view_nocontent_smiling_face"> | ||
| Property Tags. | ||
| </p> | ||
| </field> | ||
| </record> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <record id="estate_property_type_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.type.form</field> | ||
| <field name="model">estate.property.type</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Estate Property Type"> | ||
| <sheet> | ||
| <div class="oe_title"> | ||
| <h1 class="mb32"> | ||
| <field name="name" placeholder="House" class="mb16" /> | ||
| </h1> | ||
| </div> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_property_type_action" model="ir.actions.act_window"> | ||
| <field name="name">Estate Property Types</field> | ||
| <field name="res_model">estate.property.type</field> | ||
| <field name="view_mode">list,form</field> | ||
| <field name="help" type="html"> | ||
| <p class="o_view_nocontent_smiling_face"> | ||
| A property type is, for example, a house or an apartment. | ||
| </p> | ||
| </field> | ||
| </record> | ||
| </odoo> |
Uh oh!
There was an error while loading. Please reload this page.