Skip to content

Commit 363b4bf

Browse files
committed
[IMP] estate: complete ch-5 and start ch-6
complete field, attribute , view in ch-5 and list and form in ch-6
1 parent a2afb92 commit 363b4bf

File tree

4 files changed

+80
-13
lines changed

4 files changed

+80
-13
lines changed

estate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from . import models
1+
from . import models

estate/__manifest__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
{
32
'name': "estate",
43

estate/models/estate_property.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from odoo import fields , models
1+
from odoo import fields, models
22

33
class EstateProperty(models.Model):
44
_name = "estate.property"
@@ -7,15 +7,22 @@ class EstateProperty(models.Model):
77
name = fields.Char(required=True)
88
description = fields.Text()
99
postcode = fields.Char()
10-
date_availability = fields.Date()
10+
date_availability = fields.Date(copy=False, default=fields.Date.add(fields.Date.today(), months=3))
1111
expected_price = fields.Float(required=True)
12-
selling_price = fields.Float()
13-
bedrooms = fields.Integer()
12+
selling_price = fields.Float(readonly=True, copy=False)
13+
bedrooms = fields.Integer(default=2)
1414
living_area = fields.Integer()
1515
facades = fields.Integer()
1616
garage = fields.Boolean()
1717
garden = fields.Boolean()
1818
garden_area = fields.Integer()
19-
garden_orientation = fields.Selection(
19+
active = fields.Boolean(default=True)
20+
state = fields.Selection(
21+
required=True,
22+
default='New',
23+
copy=False,
24+
selection=[('New', 'new'), ('Offer Received', 'offer received'), ('Offer Accepted', 'offer accepted'), ('Sold', 'sold'), ('Cancelled', 'cancelled')])
25+
garden_orientation = fields.Selection(
2026
string='Type',
21-
selection=[('North','north'),('South','south'),('East','east'),('West','west')])
27+
selection=[('North', 'north'), ('South', 'south'), ('East', 'east'), ('West', 'west')])
28+
Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,72 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<odoo>
33

4-
<record id="estate_property_model_action" model="ir.actions.act_window">
5-
<field name="name">Test action</field>
6-
<field name="res_model">estate.property</field>
7-
<field name="view_mode">list,form</field>
8-
</record>
4+
<record id="estate_property_view_tree" model="ir.ui.view">
5+
<field name="name">estate.property.list</field>
6+
<field name="model">estate.property</field>
7+
<field name="arch" type="xml">
8+
<list string="Channel">
9+
<field name="name"/>
10+
<field name="postcode"/>
11+
<field name="bedrooms"/>
12+
<field name="living_area"/>
13+
<field name="expected_price"/>
14+
<field name="selling_price"/>
15+
<field name="date_availability"/>
16+
</list>
17+
</field>
18+
</record>
19+
20+
21+
<record id="estate_property_view_form" model="ir.ui.view">
22+
<field name="name">estate.property.form</field>
23+
<field name="model">estate.property</field>
24+
<field name="arch" type="xml">
25+
<form string="properties">
26+
<sheet>
27+
<group>
28+
<h1>
29+
<field name="name" placeholder="eg.My Home"></field>
30+
</h1>
31+
</group>
32+
33+
<group>
34+
<group>
35+
<field name="postcode"/>
36+
<field name="date_availability"/>
37+
</group>
38+
<group>
39+
<field name="expected_price"/>
40+
<field name="selling_price"/>
41+
</group>
42+
</group>
43+
<notebook>
44+
<page string="Description">
45+
<group>
46+
<field name="description"/>
47+
<field name="bedrooms"/>
48+
<field name="living_area"/>
49+
<field name="facades"/>
50+
<field name="garage"/>
51+
<field name="garden"/>
52+
<field name="garden_area" invisible="not garden"/>
53+
<field name="garden_orientation"/>
54+
</group>
55+
</page>
56+
</notebook>
57+
</sheet>
58+
59+
60+
</form>
61+
</field>
62+
</record>
63+
64+
<record id="estate_property_model_action" model="ir.actions.act_window">
65+
<field name="name">Test action</field>
66+
<field name="res_model">estate.property</field>
67+
<field name="view_mode">list,form</field>
68+
</record>
69+
970

1071

1172
</odoo>

0 commit comments

Comments
 (0)