Skip to content

Commit 2f19925

Browse files
committed
[ADD] real_estate: Property, offer and seller reports with dynamic content
- Added offers report to property Print menu with dynamic table display. - Used conditional logic to handle cases with or without offers. - Moved offer table to a separate sub-template for reuse. - Created seller report listing visible properties and related offers. - Extended property report to show invoice details when property is Done.
1 parent 354427d commit 2f19925

File tree

4 files changed

+154
-0
lines changed

4 files changed

+154
-0
lines changed

real_estate/__manifest__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"views/estate_property_menus.xml",
1616
"views/res_users_views.xml",
1717
"data/estate.property.types.csv",
18+
"report/estate_property_reports.xml",
19+
"report/estate_property_templates.xml",
1820
],
1921
"demo": [
2022
"demo/estate_property_demo.xml",

real_estate/demo/estate_property_demo.xml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,33 @@
3434
<field name="estate_property_type_id" ref="real_estate.property_type_1" />
3535
</record>
3636

37+
<record id="space_ship" model="estate.property">
38+
<field name="name">International Space Station</field>
39+
<field name="state">new</field>
40+
<field name="description">Aliens sometimes come visit</field>
41+
<field name="postcode">----</field>
42+
<field name="date_availability">2030-12-31</field>
43+
<field name="expected_price">45890000</field>
44+
<field name="estate_property_type_id" ref="property_type_3" />
45+
<field name="seller_id" ref="base.user_admin" />
46+
</record>
47+
48+
<record id="cabin" model="estate.property">
49+
<field name="name">Cozy Cabin</field>
50+
<field name="state">sold</field>
51+
<field name="description">Small cabin by lake</field>
52+
<field name="postcode">10000</field>
53+
<field name="date_availability">2020-01-01</field>
54+
<field name="expected_price">80000</field>
55+
<field name="bedrooms">1</field>
56+
<field name="living_area">10</field>
57+
<field name="facades">4</field>
58+
<field name="garage">False</field>
59+
<field name="garden">True</field>
60+
<field name="estate_property_type_id" ref="property_type_4" />
61+
<field name="seller_id" ref="base.user_admin" />
62+
</record>
63+
3764
<record id="offer_1" model="estate.property.offers">
3865
<field name="partner_id" ref="base.res_partner_12" />
3966
<field name="property_id" ref="real_estate.estate_property_big_villa" />
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
<record id="report_estate_property_offer" model="ir.actions.report">
4+
<field name="name">Print Offers</field>
5+
<field name="model">estate.property</field>
6+
<field name="report_type">qweb-pdf</field>
7+
<field name="report_name">real_estate.report_property_offers</field>
8+
<field name="report_file">real_estate.report_property_offers</field>
9+
<field name="print_report_name">'Property Offers - %s' % (object.name).replace('/','')</field>
10+
<field name="binding_model_id" ref="model_estate_property" />
11+
</record>
12+
13+
<record id="report_res_users_properties" model="ir.actions.report">
14+
<field name="name">Print Properties</field>
15+
<field name="model">res.users</field>
16+
<field name="report_type">qweb-pdf</field>
17+
<field name="report_name">real_estate.report_salesman_properties</field>
18+
<field name="report_file">real_estate.report_salesman_properties</field>
19+
<field name="print_report_name">'Properties - %s' % (object.name).replace('/','')</field>
20+
<field name="binding_model_id" ref="real_estate.model_estate_property" />
21+
</record>
22+
</odoo>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<odoo>
3+
<template id="report_property_offers_table">
4+
<t t-set="offers" t-value="property.estate_property_offer_ids" />
5+
<t t-if="not offers">No offers on this property :(</t>
6+
7+
<table t-else="" class="table table-borderless">
8+
<thead>
9+
<tr>
10+
<th>Price</th>
11+
<th>Partner</th>
12+
<th>Validity (days)</th>
13+
<th>Deadline</th>
14+
<th>State</th>
15+
</tr>
16+
</thead>
17+
<tbody>
18+
<tr t-foreach="offers" t-as="offer">
19+
<td>
20+
<span t-field="offer.price" />
21+
</td>
22+
<td>
23+
<span t-field="offer.partner_id.name" />
24+
</td>
25+
<td>
26+
<span t-field="offer.validity" />
27+
</td>
28+
<td>
29+
<span t-field="offer.offer_deadline" />
30+
</td>
31+
<td>
32+
<span t-field="offer.status" />
33+
</td>
34+
</tr>
35+
</tbody>
36+
</table>
37+
38+
<div>
39+
<strong>Expected Price: </strong>
40+
<span t-field="property.expected_price" />
41+
</div>
42+
<t t-set="status_block">
43+
<div>
44+
<strong>Status: </strong>
45+
<span t-field="property.state" />
46+
</div>
47+
</t>
48+
</template>
49+
50+
<template id="report_property_offers">
51+
<t t-foreach="docs" t-as="property">
52+
<t t-call="web.html_container">
53+
<t t-call="web.external_layout">
54+
<div class="page">
55+
<h2>
56+
<span t-field="property.name" />
57+
</h2>
58+
<div>
59+
<strong>Salesman: </strong>
60+
<span t-field="property.seller_id" />
61+
</div>
62+
<t t-call="real_estate.report_property_offers_table" />
63+
</div>
64+
</t>
65+
</t>
66+
</t>
67+
</template>
68+
69+
<template id="report_salesman_properties">
70+
<t t-foreach="docs" t-as="salesman">
71+
<t t-call="web.html_container">
72+
<t t-call="web.external_layout">
73+
<div class="page">
74+
<h2>
75+
<strong>Salesman: </strong>
76+
<span t-field="salesman.name" />
77+
</h2>
78+
<t t-if="salesman.property_ids">
79+
<t t-set="properties" t-value="salesman.property_ids" />
80+
<t t-foreach="properties" t-as="property">
81+
<h3>
82+
<span t-field="property.name" />
83+
</h3>
84+
<t t-call="real_estate.report_property_offers_table" />
85+
</t>
86+
</t>
87+
<strong t-else="">No properties found :(</strong>
88+
</div>
89+
</t>
90+
</t>
91+
</t>
92+
</template>
93+
94+
<template id="report_property_offers_inherit_invoice_note"
95+
inherit_id="real_estate.report_property_offers">
96+
<xpath expr="//div[@class='page']" position="inside">
97+
<t t-if="property.state == 'sold'">
98+
<div class="mt-3">
99+
<strong>Note:</strong> !!!! Invoice ha been created !!!!! </div>
100+
</t>
101+
</xpath>
102+
</template>
103+
</odoo>

0 commit comments

Comments
 (0)