-
Notifications
You must be signed in to change notification settings - Fork 3.3k
19.0 technical training manab #1431
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
0565151
67df5c5
088f66d
f5fd650
148bd10
bc63203
d4e9728
5bb973f
ba40f80
9073bdb
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,16 @@ | ||
| { | ||
| 'name': 'estate', | ||
| 'summary': 'Estate Module for the Tutorial', | ||
| 'author': 'manab', | ||
| 'license': 'LGPL-3', | ||
| 'data': [ | ||
| '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_menu_views.xml', | ||
| 'security/ir.model.access.csv', | ||
| ] | ||
| } | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| 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,51 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| from odoo import models, fields | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class Property(models.Model): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _name = "estate_property" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _description = "estate property model" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| name = fields.Char('Nom', required=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description = fields.Text('Description') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| postcode = fields.Char('Post Code') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| date_availability = fields.Date('Date Availability', copy=False, default=fields.Date.add(fields.Date.today(), 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. here default should use a lambda function otherwise the default would be static depending on when the server started not at record creation. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| expected_price = fields.Float('Expected Price', required=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selling_price = fields.Float('Selling Prince', readonly=True, copy=False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| bedrooms = fields.Integer('# Bedrooms', default=2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| living_area = fields.Integer('# Living Areas') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| facades = fields.Integer('# Facades') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| garage = fields.Boolean('Has Garage') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| garden = fields.Boolean('Has Garden') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| garden_area = fields.Integer('# Garden Areas') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| garden_orientation = fields.Selection( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string = 'Garden Orientation', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selection=[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('north', 'North'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('south', 'South'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('east', 'East'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('west', 'West') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| active = fields.Boolean('Active', default=True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| state = fields.Selection( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string='State', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| selection=[ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('new', 'New'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('offer_received', 'Offer Received'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('offer_accepted', 'Offer accepted'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('sold', 'Sold'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ('cancelled', 'Cancelled') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| required=True, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| copy=False, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default='new' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+29
to
+41
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.
Suggested change
Be careful at your indentation as well as the final comma, it is better to always add it so that later if someone wants to add a new line in here, it won't trigger a diff on the final line you added. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| salesperson = fields.Many2one('res.users', string='Salesperson', index=True, tracking=True, default=lambda self: self.env.user) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| buyer = 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='Offer') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| from odoo import models, fields | ||
|
|
||
| class EstatePropertyOffer(models.Model): | ||
| _name = "estate_property.offer" | ||
| _description = "Offer to the Estate" | ||
|
|
||
| name = fields.Char('Nom', required=True) | ||
| price = fields.Float('Price') | ||
| status = fields.Selection( | ||
| string="Status", | ||
| selection=[ | ||
| ('accepted', "Accepted"), | ||
| ('refused', "Refused") | ||
| ] | ||
| ) | ||
| 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,10 @@ | ||
| from odoo import models, fields | ||
|
|
||
| class EstatePropertyTag(models.Model): | ||
| _name = "estate_property.tag" | ||
| _description = "Tag of Estate Property" | ||
|
|
||
| name = fields.Char('Nom', required=True) | ||
|
|
||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| from odoo import models, fields | ||
|
|
||
| class EstatePropertyType(models.Model): | ||
| _name = "estate_property.type" | ||
| _description = "Types of Estate Property" | ||
|
|
||
| name = fields.Char('Nom', required=True) | ||
|
|
||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| 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,17 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
|
|
||
| <menuitem id="estate_menu_root" name="Real Estate"> | ||
| <menuitem id="estate_menu_first_level" name="Advertisements" sequence="1"> | ||
| <menuitem id="estate_property_menu_action" action="estate_property_action"/> | ||
| </menuitem> | ||
| <menuitem id="settings" name="Settings" sequence="2"> | ||
| <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,20 @@ | ||
| <?xml version="1.0"?> | ||
|
|
||
| <odoo> | ||
|
|
||
| <record id="estate_property_offer_list" model="ir.ui.view"> | ||
| <field name="name">estate_properties.offer_list</field> | ||
| <field name="model">estate_property.offer</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="Channel"> | ||
| <field name='name' string="Name"/> | ||
| <field name='price' string="Price"/> | ||
| <field name='status' string="Status"/> | ||
| <field name='partner_id' string="Partner"/> | ||
| <field name='property_id' string="Property"/> | ||
| </list> | ||
| </field> | ||
| </record> | ||
|
|
||
| </odoo> | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
|
|
||
| <record id="estate_property_tag_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Tag</field> | ||
| <field name="res_model">estate_property.tag</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. You should avoid pushing empty files but I guess it is because you are working on it. But just in case 😄 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
|
|
||
| <record id="estate_property_type_action" model="ir.actions.act_window"> | ||
| <field name="name">Property Type</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,111 @@ | ||
| <?xml version="1.0"?> | ||
| <odoo> | ||
|
|
||
| <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> | ||
|
|
||
| <record id="estate_property_list" model="ir.ui.view"> | ||
| <field name="name">estate_properties.list</field> | ||
| <field name="model">estate_property</field> | ||
| <field name="arch" type="xml"> | ||
| <list string="Channel"> | ||
| <field name="name" string="Title"/> | ||
| <field name="postcode" string="Postcode"/> | ||
| <field name="bedrooms" string="Bedrooms"/> | ||
| <field name="living_area" string="Living Area (sqm)"/> | ||
| <field name="expected_price" string="Expected Price"/> | ||
| <field name="selling_price" string="Selling Price"/> | ||
| <field name="date_availability" string="Available From"/> | ||
| </list> | ||
| </field> | ||
| </record> | ||
|
|
||
| <record id="etstate_property_form" model="ir.ui.view"> | ||
| <field name="name">estate_properties.form</field> | ||
| <field name="model">estate_property</field> | ||
| <field name="arch" type="xml"> | ||
| <form string="Properties"> | ||
| <sheet> | ||
| <h1> | ||
| <field name="name"/> | ||
| </h1> | ||
|
|
||
| <div class="row align-items-start"> | ||
| <div class="col"> | ||
| <group> | ||
| <field name="postcode" string="Postcode"/> | ||
| <field name="date_availability" string="Available From"/> | ||
| </group> | ||
| </div> | ||
| <div class="col"> | ||
| <group> | ||
| <field name="expected_price" string="Expected Price"/> | ||
| <field name="selling_price" string="Selling Price"/> | ||
| </group> | ||
| </div> | ||
| <notebook> | ||
| <page string="Description"> | ||
| <group> | ||
| <field name="description" string="Description"/> | ||
| </group> | ||
| <group> | ||
| <field name="bedrooms" string="Bedrooms"/> | ||
| <field name="living_area" string="Living Area (sqm)"/> | ||
| <field name="facades" string="Facades"/> | ||
| <field name="garage" string="Garage"/> | ||
| </group> | ||
| <group> | ||
| <field name="garden" string="Garden"/> | ||
| <field name="garden_area" string="Garden Area (sqm)"/> | ||
| <field name="garden_orientation" string="Garden Orientation"/> | ||
| </group> | ||
| <group> | ||
| <field name="state" string="State"/> | ||
| </group> | ||
|
Comment on lines
+51
to
+67
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. Why doing so many groups ? |
||
| </page> | ||
| <page string="Offers"> | ||
| <list> | ||
| <field name='offer_ids'/> | ||
| </list> | ||
|
|
||
| </page> | ||
| <page string="Other Info"> | ||
| <group> | ||
| <field name="salesperson" string="Salesperson"/> | ||
| <field name="buyer" string="Buyer"/> | ||
| </group> | ||
| </page> | ||
| </notebook> | ||
| </div> | ||
| </sheet> | ||
| </form> | ||
| </field> | ||
| </record> | ||
|
|
||
|
|
||
| <record id="estate_property_view_search" model="ir.ui.view"> | ||
| <field name="name">estate_property.view.search</field> | ||
| <field name="model">estate_property</field> | ||
| <field name="arch" type="xml"> | ||
| <search string="Properties"> | ||
| <field name="name" string="Title"/> | ||
| <field name="postcode" string="Postcode"/> | ||
| <field name="bedrooms" string="Bedrooms"/> | ||
| <field name="living_area" string="Living Area (sqm)"/> | ||
| <field name="expected_price" string="Expected Price"/> | ||
| <field name="selling_price" string="Selling Price"/> | ||
| <separator/> | ||
| <filter name="active" string="Available" domain="[('state', 'in', ('new', 'offer_received'))]"/> | ||
| <separator/> | ||
| <group> | ||
| <filter string="Postcode" name="postcode" context="{'group_by':'postcode'}"/> | ||
| </group> | ||
| </search> | ||
| </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.
Do not forget the make your runbot green, for instance here it should complain because it does not have two lines before the class definition.