-
Notifications
You must be signed in to change notification settings - Fork 2.8k
leker - Technical training #1063
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: master
Are you sure you want to change the base?
Changes from all commits
742f050
5938937
158ef20
397096b
cb5ea91
82eacb1
2eca71d
293c5e9
1eefdb9
48c70af
ee69762
5f0c7b7
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,13 @@ | ||
| { | ||
| 'name': 'Real 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'], | ||
| 'application': True, | ||
| 'author': 'leker', | ||
| 'license': 'LGPL-3', | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| from . import ( | ||
| estate_property, | ||
| estate_property_offer, | ||
| estate_property_tag, | ||
| estate_property_type, | ||
| ) | ||
|
Comment on lines
+1
to
+6
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. I know that Ruff is happy with that but we actually prefer to have each import on its own line like from . import estate_property
from . import estate_property_offer
... |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class Property(models.Model): | ||
| _name = "estate.property" | ||
| _description = "Real Estate property" | ||
|
|
||
| name = fields.Char('Title', required=True, default='Unknown') | ||
| active = fields.Boolean('Active', default=True) | ||
| state = fields.Selection([ | ||
| ('new', 'New'), | ||
| ('received offer', 'Received offer'), | ||
| ('offer accepted', 'Offer Accepted'), | ||
| ('sold', 'Sold'), | ||
| ('cancelled', 'Cancelled'), | ||
| ], string='State', required=True, copy=False, default='new') | ||
| description = fields.Text('Description') | ||
| last_seen = fields.Datetime("Last Seen", default=lambda self: fields.Datetime.now()) | ||
| postcode = fields.Char('Postcode') | ||
| date_availability = fields.Date('Available from', copy=False, default=lambda self: fields.Date.add(fields.Date.today(), months=3)) | ||
| expected_price = fields.Float('Expected price', required=True) | ||
| selling_price = fields.Float('Selling price', readonly=True, copy=False) | ||
| bedrooms = fields.Integer('Bedrooms', default=2) | ||
| living_area = fields.Integer('Living area (sqm)') | ||
| facades = fields.Integer('Facades') | ||
| garage = fields.Boolean('Garage') | ||
| garden = fields.Boolean('Garden') | ||
| garden_area = fields.Integer('Garden area (sqm)') | ||
| garden_orientation = fields.Selection([ | ||
| ('north', 'North'), | ||
| ('south', 'South'), | ||
| ('east', 'East'), | ||
| ('west', 'West'), | ||
| ], string='Garden Orientation') | ||
| property_type_id = fields.Many2one('estate.property.type', string="Property Type") | ||
| salesperson_id = fields.Many2one('res.users', string="Salesperson", default=lambda self: self.env.user) | ||
| buyer_id = fields.Many2one('res.partner', string="Buyer", copy=False) | ||
| tag_ids = fields.Many2many('estate.property.tag', string="Tags") | ||
| offer_ids = fields.One2many('estate.property.offer', 'property_id', string="Offers") |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class PropertyOffer(models.Model): | ||
| _name = "estate.property.offer" | ||
| _description = "Real Estate Property Offer" | ||
|
|
||
| price = fields.Float(name="Price") | ||
| status = fields.Selection([ | ||
| ('accepted', 'Accepted'), | ||
| ('refused', 'Refused'), | ||
| ], string='Status', copy=False) | ||
| partner_id = fields.Many2one('res.partner', string="Partner", required=True) | ||
| property_id = fields.Many2one('estate.property', string="Property", required=True) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class PropertyTag(models.Model): | ||
| _name = "estate.property.tag" | ||
| _description = "Real Estate Property Tag" | ||
|
|
||
| name = fields.Char(name="Name", required=True) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| from odoo import fields, models | ||
|
|
||
|
|
||
| class PropertyType(models.Model): | ||
| _name = "estate.property.type" | ||
| _description = "Real Estate Property Type" | ||
|
|
||
| name = fields.Char(name="Name", required=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 | ||
| estate.access_estate_property,access_estate_property,estate.model_estate_property,base.group_user,1,1,1,1 | ||
| estate.access_estate_property_type,access_estate_property_type,estate.model_estate_property_type,base.group_user,1,1,1,1 | ||
| estate.access_estate_property_tag,access_estate_property_tag,estate.model_estate_property_tag,base.group_user,1,1,1,1 | ||
| estate.access_estate_property_offer,access_estate_property_offer,estate.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="real_estate_menu_root" name="Real Estate"> | ||
| <menuitem id="advertisements_first_level_menu" name="Advertisements"> | ||
| <menuitem id="properties_model_menu_action" action="estate_new_record_action"/> | ||
| </menuitem> | ||
| <menuitem id="settings_first_level_menu" name="Settings"> | ||
| <menuitem id="property_types_model_menu_action" action="estate_property_type_action"/> | ||
| <menuitem id="property_tags_model_menu_action" action="estate_property_tag_action"/> | ||
| </menuitem> | ||
| </menuitem> | ||
| </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. end of file new line |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <record id="estate_property_offer_view_list" 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="Offer"> | ||
| <field name="price"/> | ||
| <field name="partner_id"/> | ||
| <field name="status"/> | ||
| </list> | ||
| </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. end of file new line |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <record id="estate_property_tag_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Tags</field> | ||
| <field name="res_model">estate.property.tag</field> | ||
| <field name="view_mode">list,form</field> | ||
| </record> | ||
| </odoo> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <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> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
| <record id="estate_property_view_search" model="ir.ui.view"> | ||
| <field name="name">estate.property.search</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <search string="Property"> | ||
| <field name="name"/> | ||
| <field name="postcode"/> | ||
| <field name="expected_price"/> | ||
| <field name="bedrooms"/> | ||
| <field name="living_area"/> | ||
| <field name="facades"/> | ||
| <field name="property_type_id"/> | ||
| <separator/> | ||
| <filter string="Available" name="available" domain="['|', ('state', '=', 'new'), ('state', '=', 'offer received')]"/> | ||
| <group> | ||
| <filter string="Postcode" name="postcode" context="{'group_by':'postcode'}"/> | ||
| </group> | ||
| </search> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="estate_new_record_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> | ||
|
|
||
| <record id="estate_property_view_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="Property"> | ||
| <field name="name"/> | ||
| <field name="property_type_id"/> | ||
| <field name="tag_ids" widget="many2many_tags"/> | ||
| <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> | ||
|
|
||
| <record id="estate_property_view_form" model="ir.ui.view"> | ||
| <field name="name">estate.property.form</field> | ||
| <field name="model">estate.property</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Property"> | ||
| <sheet> | ||
| <group> | ||
| <h1> | ||
| <field name="name"/> | ||
| </h1> | ||
| </group> | ||
| <group> | ||
| <group> | ||
| <field name="tag_ids" widget="many2many_tags"/> | ||
| <field name="property_type_id"/> | ||
| <field name="postcode"/> | ||
| <field name="date_availability"/> | ||
| </group> | ||
| <group> | ||
| <field name="expected_price"/> | ||
| <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"/> | ||
| </group> | ||
| </page> | ||
| <page string="Offers"> | ||
| <field name="offer_ids"/> | ||
| </page> | ||
| <page string="Other Info"> | ||
| <group> | ||
| <field name="salesperson_id"/> | ||
| <field name="buyer_id"/> | ||
| </group> | ||
| </page> | ||
| </notebook> | ||
| </sheet> | ||
| </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. Do not forget to add the end of file empty line |
||
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.
The author is always
'Odoo S.A.'for the RD because to develop for odoo it is not out own apps 🤔