Skip to content

Commit 127ad83

Browse files
committed
[IMP] estate, estate_account: implement and extend PDF property reports
Added a PDF report for estate properties showing all property offers using QWeb templates and report actions as outlined in the PDF report tutorial. Also inherited and extended this report in estate_account to display invoice information for sold properties. This involved organizing new templates and report actions under each module and updating manifest files accordingly. This improves reporting capabilities for property offers and ensures that sales-related financial info is integrated into property documents. Enables business users to generate comprehensive property and accounting reports directly from the UI.
1 parent f420bbb commit 127ad83

File tree

3 files changed

+147
-0
lines changed

3 files changed

+147
-0
lines changed

estate/__manifest__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
"views/res_users_views.xml",
1818
"views/estate_menus.xml",
1919
"data/estate.property.type.csv",
20+
"report/estate_property_report_templates.xml",
21+
"report/estate_property_reports.xml",
2022
],
2123
"demo": [
2224
"demo/estate_property_demo.xml",
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
<odoo>
2+
<template id="report_property_offers">
3+
<t t-foreach="docs" t-as="property">
4+
<t t-call="web.html_container">
5+
<t t-call="web.external_layout">
6+
<div class="page">
7+
<h1>
8+
<span t-field="property.name"/>
9+
</h1 >
10+
<div>
11+
<strong>Salesman: </strong>
12+
<span t-field="property.user_id"/>
13+
</div>
14+
<div>
15+
<strong>Expected Price: </strong>
16+
<span t-field="property.expected_price"/>
17+
</div>
18+
<div>
19+
<strong>Status: </strong>
20+
<span t-field="property.state"/>
21+
</div>
22+
<t t-set="object" t-value="property"/>
23+
<t t-call="estate.report_property_offers_table"/>
24+
</div>
25+
</t>
26+
</t>
27+
</t>
28+
</template>
29+
30+
<template id="report_property_offers_table">
31+
<t t-if="object.mapped('offer_id')">
32+
<table class="table">
33+
<thead>
34+
<tr>
35+
<th>Price</th>
36+
<th>Partner</th>
37+
<th>Validity(days)</th>
38+
<th>Deadline</th>
39+
<th>Status</th>
40+
</tr>
41+
</thead>
42+
<tbody>
43+
<tr t-foreach="object.mapped('offer_id')" t-as="offer">
44+
<td>
45+
<span t-field="offer.price"/>
46+
</td>
47+
<td>
48+
<span t-field="offer.partner_id"/>
49+
</td>
50+
<td>
51+
<span t-field="offer.validity"/>
52+
</td>
53+
<td>
54+
<span t-field="offer.date_deadline"/>
55+
</td>
56+
<td>
57+
<span t-field="offer.status"/>
58+
</td>
59+
</tr>
60+
</tbody>
61+
</table>
62+
</t>
63+
<t t-else="">
64+
<p>No offers yet for this property.</p>
65+
</t>
66+
</template>
67+
68+
<template id="report_user_properties">
69+
<t t-foreach="docs" t-as="user">
70+
<t t-call="web.html_container">
71+
<t t-call="web.external_layout">
72+
<div class="page">
73+
<h2>
74+
Salesman <span t-field="user.name"/>
75+
</h2>
76+
<t t-if="user.property_ids">
77+
<t t-foreach="user.property_ids" t-as="property">
78+
<div class="mt-3">
79+
<h2>
80+
<span t-field="property.name"/>
81+
</h2>
82+
<div>
83+
<strong>Expected Price:</strong>
84+
<span t-field="property.expected_price"/>
85+
</div>
86+
<div>
87+
<strong>Status:</strong>
88+
<span t-field="property.state"/>
89+
</div>
90+
91+
<t t-set="object" t-value="property"/>
92+
<t t-call="estate.report_property_offers_table"/>
93+
</div>
94+
<hr/>
95+
</t>
96+
</t>
97+
<t t-else="">
98+
<p><i>This user has no properties assigned as Salesman.</i></p>
99+
</t>
100+
</div>
101+
</t>
102+
</t>
103+
</t>
104+
</template>
105+
106+
<template id="report_property_offers_inherit_invoice" inherit_id="estate.report_property_offers" priority="20">
107+
<xpath expr="//div[hasclass('page')]" position="inside">
108+
<t t-if="property.state == 'sold'">
109+
<div class="mt-4">
110+
<h4>Invoice Information</h4>
111+
<p>The invoice has already been creted!!!</p>
112+
</div>
113+
</t>
114+
</xpath>
115+
</template>
116+
117+
118+
119+
120+
121+
</odoo>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<odoo>
2+
<record id="action_report_property_offers" model="ir.actions.report">
3+
<field name="name">Property Offers Report</field>
4+
<field name="model">estate.property</field>
5+
<field name="report_type">qweb-pdf</field>
6+
<field name="report_name">estate.report_property_offers</field>
7+
<field name="report_file">estate.report_property_offers</field>
8+
<field name="print_report_name">'Property Offers - %s' % (object.name)</field>
9+
<field name="binding_model_id" ref="estate.model_estate_property"/>
10+
<field name="binding_type">report</field>
11+
</record>
12+
13+
<record id="action_report_user_properties" model="ir.actions.report">
14+
<field name="name">User Properties</field>
15+
<field name="model">res.users</field>
16+
<field name="report_type">qweb-pdf</field>
17+
<field name="report_name">estate.report_user_properties</field>
18+
<field name="report_file">estate.report_user_properties</field>
19+
<field name="binding_model_id" ref="base.model_res_users"/>
20+
<field name="binding_type">report</field>
21+
<field name="print_report_name">'User Properties - %s' % (object.name)</field>
22+
</record>
23+
24+
</odoo>

0 commit comments

Comments
 (0)