Skip to content

Commit 17a1bb4

Browse files
committed
[IMP]estate: Added inline and widget.
1 parent 7fafa5a commit 17a1bb4

10 files changed

+65
-47
lines changed

estate/models/estate_property.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
class EstateProperty(models.Model):
1111
_name = "estate.property"
1212
_description = "Real Estate Property"
13+
_order = 'id desc'
1314
name = fields.Char(required=True)
1415
description = fields.Text(string="Description")
1516
postcode = fields.Char(string="Postcode")
@@ -31,12 +32,14 @@ class EstateProperty(models.Model):
3132
('east', "East"),
3233
('west', "West")
3334
]
34-
)
35-
state = fields.Selection([
35+
)
36+
state = fields.Selection(selection=[
3637
('new', 'New'),
38+
('received', 'Offer Received'),
39+
('accepted', 'Offer Accepted'),
3740
('sold', 'Sold'),
38-
('refused', 'Refused')
39-
], string="Status",required=True, default='new')
41+
('cancelled', 'Cancelled'),
42+
], default='new', string="Status", copy=False)
4043
property_type_id = fields.Many2one('estate.property.type', string="Property Type")
4144
buyer_id = fields.Many2one('res.partner', string="Buyer")
4245
seller_id = fields.Many2one('res.users', string="Salesperson", default=lambda self: self.env.user)

estate/models/estate_property_offer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
class EstatePropertyOffer(models.Model):
88
_name = 'estate.property.offer'
99
_description = 'Real Estate Property Offer'
10-
11-
price = fields.Float(string="Offer Price", required=True)
10+
_order = 'price desc'
11+
price = fields.Float()
1212
status = fields.Selection([('accepted', 'Accepted'), ('refused', 'Refused')], string="Status")
1313
partner_id = fields.Many2one('res.partner', string="Partner", required=True)
1414
property_id = fields.Many2one('estate.property', string="Property", required=True)

estate/models/estate_property_tags.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
class EstatePropertyTag(models.Model):
33
_name = 'estate.property.tag'
44
_description = 'Real Estate Property Tag'
5+
_order = "name"
56

67
name = fields.Char(string="Tag Name", required=True)
78
tag_ids = fields.Many2many(

estate/models/estate_property_type.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22
class EstatePropertyType(models.Model):
33
_name = 'estate.property.type'
44
_description = 'Real Estate Property Type'
5+
_order = "sequence,name"
6+
sequence = fields.Integer(default=10)
57
name = fields.Char(string="Type Name", required=True)
68
property_type_id = fields.Many2one('estate.property.type', string="Property Type")
79
buyer_id = fields.Many2one('res.partner', string="Buyer")
810
seller_id = fields.Many2one('res.users', string="Salesperson", default=lambda self: self.env.user)
911
property_ids = fields.One2many('estate.property', 'property_type_id', string="Properties")
10-
11-
12-
12+
expected_price = fields.Float(string="Expected Price", required=True)
13+
state = fields.Selection(selection=[
14+
('new', 'New'),
15+
('received', 'Offer Received'),
16+
('accepted', 'Offer Accepted'),
17+
('sold', 'Sold'),
18+
('cancelled', 'Cancelled'),
19+
], default='new', string="Status", copy=False)
1320
_sql_constraints = [
1421
('unique_type_name', 'UNIQUE(name)',
1522
'The property type name must be unique.')
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
22
access_estate_property_user,access_estate_property_user,model_estate_property,base.group_user,1,1,1,1
3+
estate.access_estate_property_type,access_estate_property_type,estate.model_estate_property_type,base.group_user,1,0,1,0
4+
estate.access_estate_property_offer,access_estate_property_offer,estate.model_estate_property_offer,base.group_user,1,0,0,0
5+
estate.access_estate_property_tag,access_estate_property_tag,estate.model_estate_property_tag,base.group_user,1,0,1,0

estate/views/estate_menus.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<menuitem id="estate_menu_root" name="Estate"/>
55
<menuitem id="estate_properties_menu" name="Advertisements" parent="estate_menu_root" action="estate_property_action"/>
6-
<menuitem id="estate_properties_menu_two" name="Settings" parent="estate_menu_root" action="estate_property_action"/>
7-
<menuitem id="estate_property_type_menu" name="Property Types" parent="estate_properties_menu_two" action="estate_property_action"/>
8-
<menuitem id="estate_property_tag_menu" name="Property Tags" parent="estate_properties_menu_two" action="estate_property_action"/>
9-
</odoo>
6+
<menuitem id="estate_properties_menu_two" name="Settings" parent="estate_menu_root"/>
7+
<menuitem id="estate_property_type_menu" name="Property Types" parent="estate_properties_menu_two" action="estate_property_type_action"/>
8+
<menuitem id="estate_property_tag_menu" name="Property Tags" parent="estate_properties_menu_two" action="estate_property_tag_action"/>
9+
</odoo>

estate/views/estate_property_offer_views.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<odoo>
2-
<record id="view_estate_property_form" model="ir.ui.view">
3+
<record id="estate_property_offer_view_form" model="ir.ui.view">
34
<field name="name">estate.property.offers</field>
45
<field name="model">estate.property.offer</field>
56
<field name="arch" type="xml">
@@ -26,7 +27,7 @@
2627
</form>
2728
</field>
2829
</record>
29-
<record id="view_estate_property_offer_list" model="ir.ui.view">
30+
<record id="estate_property_offer_view_list" model="ir.ui.view">
3031
<field name="name">estate.property.offer.list</field>
3132
<field name="model">estate.property.offer</field>
3233
<field name="arch" type="xml">

estate/views/estate_property_tags_views.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<odoo>
23
<record id="estate_property_tag_action" model="ir.actions.act_window">
34
<field name="name">Property Tags</field>
@@ -25,7 +26,8 @@
2526
<field name="arch" type="xml">
2627
<list>
2728
<field name="name"/>
28-
<field name="tag_ids"/>
29+
<field name="tag_ids"/>
30+
2931
</list>
3032
</field>
3133
</record>
Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
12
<odoo>
2-
<record id="estate_property_type_action" model="ir.actions.act_window">
3+
<record id="estate_property_type_action" model="ir.actions.act_window">
34
<field name="name">Property Types</field>
45
<field name="res_model">estate.property.type</field>
56
<field name="view_mode">list,form</field>
67
</record>
7-
<record id="view_estate_property_type_form" model="ir.ui.view">
8+
<record id="estate_property_type_view_form" model="ir.ui.view">
89
<field name="name">estate.property.type.form</field>
910
<field name="model">estate.property.type</field>
1011
<field name="arch" type="xml">
11-
<form string="Property Type">
12-
<sheet>
13-
<group>
14-
<field name="name"/>
15-
</group>
16-
<group string="Properties">
17-
<field name="property_ids">
18-
<list editable="bottom">
19-
<field name="name"/>
20-
<field name="expected_price"/>
21-
<field name="selling_price"/>
22-
<field name="state"/>
23-
</list>
24-
</field>
25-
</group>
12+
<form string="Property Types">
13+
<sheet>
14+
<h1><field name="name"/></h1>
15+
<br/>
16+
<notebook>
17+
<page string="Properties">
18+
<field name="property_ids">
19+
<list create="False" edit="False" delete="False">
20+
<field name="name" />
21+
<field name="expected_price" />
22+
<field name="state" />
23+
</list>
24+
</field>
25+
</page>
26+
</notebook>
2627
</sheet>
2728
</form>
2829
</field>
2930
</record>
30-
<record id="view_estate_property_type_list" model="ir.ui.view">
31+
<record id="estate_property_type_view_list" model="ir.ui.view">
3132
<field name="name">estate.property.type.list</field>
3233
<field name="model">estate.property.type</field>
3334
<field name="arch" type="xml">
34-
<list>
35-
<field name="name"/>
35+
<list string= "Property Type">
36+
<field name="sequence" widget='handle'/>
37+
<field name="name"/>
3638
</list>
3739
</field>
3840
</record>
39-
40-
41-
</odoo>
41+
</odoo>

estate/views/estate_property_views.xml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,26 @@
2727
<field name="model">estate.property</field>
2828
<field name="arch" type="xml">
2929
<form string="Property">
30-
<sheet>
31-
<header>
30+
<header>
3231
<button name="action_cancel" type="object" string="Cancel"
3332
class="btn btn-secondary" data-visible="[(state != 'sold')]"/>
3433
<button name="action_sold" type="object" string="Sold"
3534
class="btn btn-primary" data-visible="[(state != 'cancelled')]" />
36-
</header>
35+
<field name="state" widget="statusbar" options="{'clickable': False}" />
36+
</header>
37+
<sheet>
3738
<group>
3839
<group>
39-
<field name="name" string="Title"/>
40+
<field name="name" string="Property Types"/>
4041
<field name="tag_ids" widget="many2many_tags"/>
41-
<field name="name" string="Property Type"/>
4242
<field name ="expected_price"/>
4343
<field name="selling_price"/>
4444
</group>
4545
<group>
4646

4747
<field name="postcode"/>
4848
<field name="date_availability" string="Available From"/>
49-
<field name ="state"/>
50-
<field name="best_offers" string="Best Offers"/>
49+
<field name="best_offers" string="Best Offers"/>
5150

5251

5352
</group>
@@ -72,15 +71,17 @@
7271
<field name ="buyer"/>
7372
</group>
7473
</page>
74+
7575
<page string="Offers">
7676
<group>
7777
<field name="price"/>
7878
<field name ="partners"/>
7979
<field name ="status"/>
8080
<field name= "validity" string="Validity(days)"/>
8181
<field name= "date_deadline" string="Deadline"/>
82-
</group>
82+
</group>
8383
</page>
84+
8485
<page>
8586
<field name="description"/>
8687
</page>

0 commit comments

Comments
 (0)