Skip to content

Commit c221253

Browse files
committed
[IMP] awesome_dashboard: Implemented JS components and fixed schema warnings
- Removed deprecated attrs usage in ListView buttons - Ensured newline at end of XML cron file - Improved Python validation for property states - Corrected controller @route type to jsonrpc
1 parent 6afa556 commit c221253

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1005
-109
lines changed

.eslintignore

Lines changed: 467 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,20 @@ share/python-wheels/
2525
*.egg-info/
2626
.installed.cfg
2727
*.egg
28+
.eslint.json
29+
.eslintrc.json
30+
.vscode/
31+
.idea/
32+
*.vscode/
33+
*.sublime-project
34+
*.sublime-workspace
35+
jsconfig.json
36+
package-lock.json
37+
yarn.lock
38+
pnpm-lock.yaml
39+
package.json
40+
41+
node_modules/
2842
MANIFEST
2943

3044
# PyInstaller

Estate/data/date_cron.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
<field name="interval_number">1</field>
88
<field name="interval_type">days</field>
99
</record>
10-
</odoo>
10+
</odoo>

Estate/models/estate_property.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from datetime import timedelta
22

33
from odoo import models, fields, api
4-
from odoo.exceptions import ValidationError
4+
from odoo.exceptions import ValidationError , UserError
55
from odoo.tools.float_utils import float_compare, float_is_zero
66

77

@@ -56,7 +56,7 @@ class EstateProperty(models.Model):
5656
'CHECK(expected_price > 0 AND selling_price >= 0)',
5757
'The Price of a property must be strictly positive.',
5858
)
59-
59+
6060
@api.depends("living_area", "garden_area")
6161
def _compute_total_area(self):
6262
for record in self:
@@ -89,7 +89,7 @@ def _check_selling_price(self):
8989
if not float_is_zero(record.selling_price, precision_digits=2):
9090
if float_compare(record.selling_price, 0.9 * record.expected_price, precision_digits=2) < 0:
9191
raise ValidationError("The selling price cannot be lower than 90% of the expected price.")
92-
92+
9393
@api.onchange("garden")
9494
def _onchange_garden(self):
9595
if self.garden:
@@ -116,7 +116,10 @@ def write(self, vals):
116116

117117
def action_set_sold(self):
118118
for record in self:
119-
record.state = "sold"
119+
if record.state != 'canceled':
120+
record.state = 'sold'
121+
else:
122+
raise UserError("once sold cannot be canceled")
120123

121124
def action_set_canceled(self):
122125
for record in self:

Estate/security/ir.model.access.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ estate.access_estate_property,access_estate_property,model_estate_property,base.
33
estate.access_estate_property_offer,access_estate_property_offer,model_estate_property_offer,base.group_user,1,1,1,1
44
estate.access_estate_property_type,access_estate_property_type,model_estate_property_type,base.group_user,1,1,1,1
55
estate.access_estate_property_tag,access_estate_property_tag,model_estate_property_tag,base.group_user,1,1,1,1
6-
estate.access_res_users,access_res_users,model_res_users,base.group_user,1,1,1,1
6+
estate.access_res_users,access_res_users,model_res_users,base.group_user,1,1,1,1

Estate/views/estate_property_offer_views.xml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,8 @@
99
<field name="price"/>
1010
<field name="partner_id"/>
1111
<field name="status" column_invisible="True"/>
12-
<button name="action_accept_offer"
13-
string="Accept"
14-
type="object"
15-
icon="fa-check"
16-
title="Accept"
17-
invisible="status"/>
18-
19-
<button name="action_refuse_offer"
20-
string="Refuse"
21-
type="object"
22-
icon="fa-times"
23-
title="Refuse"
24-
invisible="status"/>
12+
<button name="action_accept_offer" string="Accept" type="object" icon="fa-check" title="Accept" invisible="status"/>
13+
<button name="action_refuse_offer" string="Refuse" type="object" icon="fa-times" title="Refuse" invisible="status"/>
2514
</list>
2615
</field>
2716
</record>

Estate/views/estate_property_tags_views.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<field name="res_model">estate.property.tag</field>
55
<field name="view_mode">list,form</field>
66
</record>
7+
78
<record id="view_estate_property_tag_list" model="ir.ui.view">
89
<field name="name">estate.property.tag.list</field>
910
<field name="model">estate.property.tag</field>

Estate/views/estate_property_views.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<button name="action_back_to_new" string="Reset to New" type="object" invisible="state not in ('offer_accepted','sold','canceled')"/>
3636
<button name="action_set_sold" string="Mark as Sold" type="object" invisible="state == 'sold'"/>
3737
<button name="action_set_canceled" string="Cancel" type="object" invisible="state == 'canceled'"/>
38-
<field name="state" widget="statusbar" options="{'clickable': '1'}" statusbar_visible="new,offer_received,offer_accepted,sold,canceled"/>
38+
<field name="state" widget="statusbar" options="{'clickable': '0'}" statusbar_visible="new,offer_received,offer_accepted,sold,canceled"/>
3939
</header>
4040
<sheet>
4141
<div class="oe_title">
@@ -115,7 +115,7 @@
115115
<field name="state"/>
116116
<templates>
117117
<t t-name="card">
118-
<div class="fw-bold fs-5 mb-1">
118+
<div style="fw-bold fs-5 mb-1">
119119
<field name="name"/>
120120
</div>
121121
<div>

Estate/views/res_users_view.xml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<field name="model">res.users</field>
55
<field name="inherit_id" ref="base.view_users_form"/>
66
<field name="arch" type="xml">
7-
<xpath expr="//field[@name='company_id']" position="after">
8-
<field name="estate_property_ids" widget="one2many_list" string="Properties as Salesperson">
9-
<list>
10-
<field name="name"/>
11-
<field name="expected_price"/>
12-
<field name="state"/>
13-
</list>
14-
</field>
15-
</xpath>
7+
<xpath expr="//field[@name='company_id']" position="after">
8+
<field name="estate_property_ids" widget="one2many_list" string="Properties as Salesperson">
9+
<list>
10+
<field name="name"/>
11+
<field name="expected_price"/>
12+
<field name="state"/>
13+
</list>
14+
</field>
15+
</xpath>
1616
</field>
1717
</record>
1818

awesome_dashboard/__manifest__.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,21 @@
2323
],
2424
'assets': {
2525
'web.assets_backend': [
26-
'awesome_dashboard/static/src/**/*',
26+
'awesome_dashboard/static/src/dashboard_action.js',
27+
],
28+
'awesome_dashboard.dashboard': [
29+
'awesome_dashboard/static/src/dashboard_items_service.js',
30+
'awesome_dashboard/static/src/dashboard_items.js',
31+
'awesome_dashboard/static/src/dashboard/**/*.js',
32+
'awesome_dashboard/static/src/dashboard/**/*.xml',
33+
'awesome_dashboard/static/src/piechart/**/*.js',
34+
'awesome_dashboard/static/src/piechart/**/*.xml',
35+
'awesome_dashboard/static/src/dashboard_item/**/*.js',
36+
'awesome_dashboard/static/src/dashboard_item/**/*.xml',
37+
'awesome_dashboard/static/src/dashboard_configuration_dialog.js',
38+
'awesome_dashboard/static/src/dashboard_configuration_dialog.xml',
39+
'awesome_dashboard/static/src/statistics_service.js',
40+
'awesome_dashboard/static/src/dashboard.scss',
2741
],
2842
},
2943
'license': 'AGPL-3'

0 commit comments

Comments
 (0)