Skip to content

Commit 875ac83

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 ffd562c commit 875ac83

7 files changed

+140
-2
lines changed

estate/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
'author': "Dhruvrajsinh Zala (zadh)",
77
'installable': True,
88
'application': True,
9-
'data': ['security/security.xml', 'security/ir.model.access.csv', 'views/estate_property_views.xml', 'views/estate_property_offers.xml', 'views/estate_property_type_views.xml', 'views/estate_property_tags.xml', 'views/res_users_views.xml', 'views/estate_menus.xml', 'data/estate.property.types.csv'],
9+
'data': ['security/security.xml', 'security/ir.model.access.csv', 'report/estate_property_templates.xml', 'report/estate_user_properties_templates.xml', 'report/estate_user_properties_report.xml', 'report/estate_property_reports.xml', 'views/estate_property_views.xml', 'views/estate_property_offers.xml', 'views/estate_property_type_views.xml', 'views/estate_property_tags.xml', 'views/res_users_views.xml', 'views/estate_menus.xml', 'data/estate.property.types.csv'],
1010
'demo': ['demo/demo_data.xml'],
1111
'license': 'AGPL-3'
1212
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
</odoo>
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<odoo>
2+
<template id="offers_table">
3+
<t t-if="offers">
4+
<table class="table">
5+
<thead>
6+
<tr>
7+
<th>Price</th>
8+
<th>Partner</th>
9+
<th>Validity(days)</th>
10+
<th>Deadline</th>
11+
<th>State</th>
12+
</tr>
13+
</thead>
14+
<tbody>
15+
<tr t-foreach="offers" t-as="offer">
16+
<td>
17+
<span t-field="offer.price"/>
18+
</td>
19+
<td>
20+
<span t-field="offer.partner_id"/>
21+
</td>
22+
<td>
23+
<span t-field="offer.date_deadline"/>
24+
</td>
25+
<td>
26+
<span t-field="offer.status"/>
27+
</td>
28+
</tr>
29+
</tbody>
30+
</table>
31+
</t>
32+
</template>
33+
34+
<template id="report_property_offers">
35+
<t t-foreach="docs" t-as="property">
36+
<t t-call="web.html_container">
37+
<t t-call="web.external_layout">
38+
<div class="page">
39+
<h2>
40+
<span t-field="property.name"/>
41+
</h2>
42+
<div>
43+
<strong>Salesman: </strong>
44+
<span t-field="property.salesperson_id"/>
45+
</div>
46+
<div>
47+
<strong>Expected Price: </strong>
48+
<span t-field="property.expected_price"/>
49+
</div>
50+
<div>
51+
<strong>Status: </strong>
52+
<span t-field="property.state"/>
53+
</div>
54+
<t t-set="offers" t-value="property.mapped('offer_ids')"/>
55+
<t t-if="offers">
56+
<t t-call="estate.offers_table"/>
57+
</t>
58+
<t t-else="">
59+
<p>No offers yet for this property.</p>
60+
</t>
61+
</div>
62+
</t>
63+
</t>
64+
</t>
65+
</template>
66+
</odoo>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<odoo>
2+
<record id="action_report_user_properties" model="ir.actions.report">
3+
<field name="name">User Properties Report</field>
4+
<field name="model">res.users</field>
5+
<field name="report_type">qweb-pdf</field>
6+
<field name="report_name">estate.report_user_properties</field>
7+
<field name="report_file">estate.report_user_properties</field>
8+
<field name="print_report_name">'User Properties - %s' % (object.name)</field>
9+
<field name="binding_model_id" ref="base.model_res_users"/>
10+
<field name="binding_type">report</field>
11+
</record>
12+
</odoo>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<odoo>
2+
<template id="report_user_properties">
3+
<t t-foreach="docs" t-as="user">
4+
<t t-call="web.html_container">
5+
<t t-call="web.external_layout">
6+
<div class="page">
7+
<h2>Salesperson: <span t-field="user.name"/></h2>
8+
<t t-set="properties" t-value="user.property_ids"/>
9+
<t t-if="properties">
10+
<t t-foreach="properties" t-as="property">
11+
<h4>
12+
<span t-field="property.name"/> (<span t-field="property.state"/>)
13+
</h4>
14+
<div>
15+
<strong>Type: </strong>
16+
<span t-field="property.property_type_id.name"/>
17+
<br/>
18+
<strong>Expected Price: </strong>
19+
<span t-field="property.expected_price"/>
20+
</div>
21+
<t t-set="offers" t-value="property.mapped('offer_ids')"/>
22+
<t t-call="estate.offers_table">
23+
<t t-set="offers" t-value="offers"/>
24+
</t>
25+
</t>
26+
</t>
27+
<t t-else="">
28+
<p><em>This salesperson has no assigned properties.</em></p>
29+
</t>
30+
</div>
31+
</t>
32+
</t>
33+
</t>
34+
</template>
35+
</odoo>

estate_account/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"depends": ["estate", "account"],
44
'category': "Tutorials",
55
"installable": True,
6-
"license": "AGPL-3"
6+
"license": "AGPL-3",
7+
'data': ['report/estate_property_report_inherit.xml']
78
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<odoo>
2+
<template id="report_property_offers_inherit" inherit_id="estate.report_property_offers">
3+
<xpath expr="//div[hasclass('page')]" position="inside">
4+
<t t-if="property.state == 'sold'">
5+
<div>
6+
<strong>Invoice Status:</strong>
7+
<span>Invoice has been created for this sold property.</span>
8+
</div>
9+
</t>
10+
</xpath>
11+
</template>
12+
</odoo>

0 commit comments

Comments
 (0)