-
Notifications
You must be signed in to change notification settings - Fork 3.3k
19.0 tutorial delje #1415
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?
19.0 tutorial delje #1415
Changes from all commits
63c3ad3
92218f6
2e76d0b
a2ee7f4
2b37ba8
52aac90
861aa17
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 |
|---|---|---|
|
|
@@ -127,3 +127,4 @@ dmypy.json | |
|
|
||
| # Pyre type checker | ||
| .pyre/ | ||
| .vscode/settings.json | ||
| 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,11 @@ | ||
| { | ||
| 'name': "Estate", | ||
| 'depends': ["base"], | ||
| 'application': True, | ||
| 'installable': True, | ||
| 'data': [ | ||
| 'security/ir.model.access.csv', | ||
| 'views/estate_property_views.xml', | ||
| 'views/estate_menus_views.xml' | ||
| ] | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| from . import estate_property |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| from dateutil.relativedelta import relativedelta | ||
| from odoo import fields, models | ||
|
|
||
|
msho-odoo marked this conversation as resolved.
|
||
|
|
||
| class EstatePropertyModel(models.Model): | ||
| _name = "estate_property" | ||
| _description = "The details of a property" | ||
|
|
||
| name = fields.Char('Estate Name', required=True) | ||
| description = fields.Text() | ||
| postcode = fields.Char() | ||
| date_availability = fields.Date(copy=False, default=fields.Date.today()+relativedelta(months=3)) | ||
|
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. directly valuating the fields.Date at default will work when imported but it will be stuck at this value, you should use |
||
| expected_price = fields.Float(required=True) | ||
| selling_price = fields.Float(readonly=True) | ||
| bedrooms = fields.Integer(default=2) | ||
| living_area = fields.Integer() | ||
| facades = fields.Integer() | ||
| has_garage = fields.Boolean() | ||
| has_garden = fields.Boolean() | ||
| garden_area = fields.Integer() | ||
| garden_orientation = fields.Selection( | ||
| string='Garden Orientation', | ||
| selection=[ | ||
| ('east', 'East'), | ||
| ('west', 'West'), | ||
| ('north', 'North'), | ||
| ('south', 'South'), | ||
| ] | ||
| ) | ||
| state = fields.Selection( | ||
| string='State', | ||
| selection=[ | ||
| ('new', 'New'), | ||
| ('offer_received', 'Offer Received'), | ||
| ('offer_accepted', 'Offer Accepted'), | ||
| ('sold', 'Sold'), | ||
| ('cancelled', 'Cancelled'), | ||
| ], | ||
| default='new' | ||
| ) | ||
| active = fields.Boolean(default=True) | ||
| 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_model,access_estate_model,model_estate_property,base.group_user,1,1,1,1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <odoo> | ||
| <menuitem id="estate_menu_root" name="Real Estate"> | ||
| <menuitem id="estate_fist_level_menu" name="Advertisements"> | ||
| <menuitem | ||
| id="estate_property_menu_action" | ||
| action="estate_property_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. Please Always check your runbot and make sure it's not red :) |
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,98 @@ | ||||||
|
|
||||||
| <odoo> | ||||||
| <!-- Action Handler --> | ||||||
| <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> | ||||||
|
|
||||||
| <!-- List View --> | ||||||
| <record id="estate_property_list" model="ir.ui.view"> | ||||||
|
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 |
||||||
| <field name="name">estate.property.list</field> | ||||||
| <field name="model">estate_property</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <list string="Estates"> | ||||||
| <field string="Estate" name="name"/> | ||||||
| <field name="postcode"/> | ||||||
| <field name="bedrooms"/> | ||||||
| <field string="Living Area (sqm)" name="living_area"/> | ||||||
|
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. nitpick: usually we have |
||||||
| <field name="expected_price"/> | ||||||
| <field name="selling_price"/> | ||||||
| <field string="Available From" name="date_availability"/> | ||||||
| </list> | ||||||
| </field> | ||||||
| </record> | ||||||
|
|
||||||
| <!-- Form View --> | ||||||
| <record id="estate_property_form" model="ir.ui.view"> | ||||||
| <field name="name">estate.property.form</field> | ||||||
| <field name="model">estate_property</field> | ||||||
| <field name="arch" type="xml"> | ||||||
| <form> | ||||||
| <sheet> | ||||||
| <h1><field name="name"></field></h1> | ||||||
| <group> | ||||||
| <group> | ||||||
| <field name="postcode"/> | ||||||
| <field string="Available From" name="date_availability"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="expected_price"/> | ||||||
| <field name="selling_price"/> | ||||||
| </group> | ||||||
| </group> | ||||||
| <notebook> | ||||||
| <page string="Description"> | ||||||
| <group> | ||||||
| <field name="description"/> | ||||||
| </group> | ||||||
| <group> | ||||||
| <field name="bedrooms"/> | ||||||
| <field name="living_area"/> | ||||||
| <field name="facades"/> | ||||||
| <field name="has_garage"/> | ||||||
| <field name="has_garden"/> | ||||||
| <field name="garden_area" string="Garden Area (sqm)" invisible="not has_garden"/> | ||||||
| <field name="garden_orientation" invisible="not has_garden"/> | ||||||
| </group> | ||||||
| </page> | ||||||
| </notebook> | ||||||
| </sheet> | ||||||
| </form> | ||||||
| </field> | ||||||
| </record> | ||||||
|
|
||||||
| <!-- SearchBar --> | ||||||
| <record id="estate_property_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="Search properties"> | ||||||
| <field string="Title" name="name"/> | ||||||
| <field name="postcode"/> | ||||||
| <field name="expected_price"/> | ||||||
| <field name="bedrooms"/> | ||||||
| <field string="Living Area (sqm)" name="living_area"/> | ||||||
| <field name="facades"/> | ||||||
|
|
||||||
| <filter string="Available" name="available" domain="['|',('state', '=', 'New'), ('state', '=', 'offer_received')]"></filter> | ||||||
|
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. The key you check on is
Suggested change
|
||||||
| <group> | ||||||
| <filter string="PostCode" name="postcode" context="{'group_by':'postcode'}"/> | ||||||
| </group> | ||||||
| </search> | ||||||
| </field> | ||||||
| </record> | ||||||
|
|
||||||
| <!-- | ||||||
| <record id="[ID given to this record]" model="[Model being modified]"> | ||||||
| <field name="name">[name for this field]</field> | ||||||
| <field name="model">[Model from which to gather data]</field> | ||||||
| <field name="arch" type="[Type of data architecture]"> | ||||||
| <list string="Estates"> | ||||||
| <field string="[Column String Visible]" name="[Data name from Model]"/> | ||||||
| </list> | ||||||
| </field> | ||||||
| </record> | ||||||
| --> | ||||||
|
Comment on lines
+87
to
+97
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. Delete unneeded comments please :) |
||||||
| </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.
ops, I shouldn't see this file here :)
environmental files like this one (or .vscode) for example shouldn't be pushed with your commit