Skip to content

Commit 4cbc244

Browse files
committed
[FIX] warnings and style issues
fixed issue in the property type action button in the form view, the manifist data order was incorrect fixed the warning of batch create in th property offer, fixed some code style issues in the code
1 parent ef8099a commit 4cbc244

File tree

8 files changed

+23
-18
lines changed

8 files changed

+23
-18
lines changed

awesome_owl/static/src/card/card.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
</div>
1212

1313
</t>
14-
14+
1515
</templates>

awesome_owl/static/src/counter/counter.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
<templates xml:space="preserve">
33

44
<t t-name="awesome_owl.counter">
5-
<div style="border: 1px solid #ccc; padding: 15px; margin: 10px; width: fit-content; height:fit-content; display: inline">
5+
<div style="border: 1px solid #ccc; padding: 15px; margin: 10px; width: fit-content; display: inline">
66
<label style="margin:10px">Counter: <t t-esc="count.value"/></label>
7-
<button class="btn" t-on-click="increment" style="background-color: purple; color: white">Increment</button>
7+
<button class="btn" t-on-click="increment" style="background-color: purple; color: white">
8+
Increment
9+
</button>
810
</div>
911
</t>
10-
12+
1113
</templates>

awesome_owl/static/src/playground.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/** @odoo-module **/
22

33
import { Component, useState } from "@odoo/owl";
4-
import { Counter } from "./counter/counter";
54
import { Card } from "./card/card";
5+
import { Counter } from "./counter/counter";
66
import { TodoList } from "./todo_list/todo_list";
77

88
export class Playground extends Component {
@@ -14,7 +14,7 @@ export class Playground extends Component {
1414
setup() {
1515
this.content1 = "<u>Card Content 1</u>";
1616
this.content2 = "<u>Card Content 2</u>";
17-
this.state = useState({
17+
this.state = useState({
1818
sum: 0,
1919
});
2020
}

awesome_owl/static/src/playground.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
</div>
2727

2828
</t>
29-
29+
3030
</templates>

awesome_owl/static/src/todo_list/todo_item/todo_item.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
<templates xml:space="preserve">
33

44
<t t-name="awesome_owl.todo_item">
5-
<p class="card-text" t-att-class="props.todo.isCompleted ? 'text-decoration-line-through text-muted' : '' ">
6-
<t t-esc="props.todo.id"/>. <t t-esc="props.todo.description"/>
5+
<p
6+
class="card-text"
7+
t-att-class="props.todo.isCompleted ? 'text-decoration-line-through text-muted' : '' ">
8+
<t t-esc="props.todo.id"/>. <t t-esc="props.todo.description"/>
79
</p>
810
</t>
9-
11+
1012
</templates>

awesome_owl/static/src/todo_list/todo_list.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class TodoList extends Component {
2222
},
2323
};
2424

25-
addTodo(ev){
25+
addTodo(ev) {
2626
let input_val = ev.target.value;
2727
if (ev.keyCode === 13 && input_val != "") {
2828
this.todos.push({

estate/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
'data': [
1111
'security/ir.model.access.csv',
1212
'views/estate_property_views.xml',
13-
'views/estate_property_type_views.xml',
1413
'views/estate_property_tag_views.xml',
1514
'views/estate_property_type_offer.xml',
15+
'views/estate_property_type_views.xml',
1616
'views/estate_user_views.xml',
1717
'views/estate_menus.xml',
1818
],

estate/models/estate_property_offer.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,12 @@ def action_refuse_offer(self):
5656
record.status = 'refused'
5757
return True
5858

59-
@api.model
59+
@api.model_create_multi
6060
def create(self, vals):
61-
if vals['price'] <= self.env['estate.property'].browse(vals['property_id']).best_price:
62-
raise UserError(self.env._('The offer price must be greater than the best offer.'))
61+
for val in vals:
62+
if val['price'] <= self.env['estate.property'].browse(val['property_id']).best_price:
63+
raise UserError(self.env._('The offer price must be greater than the best offer.'))
6364

64-
if self.env['estate.property'].browse(vals['property_id']).state == 'new':
65-
self.env['estate.property'].browse(vals['property_id']).state = 'offer_received'
66-
return super(TestModel, self).create(vals)
65+
if self.env['estate.property'].browse(val['property_id']).state == 'new':
66+
self.env['estate.property'].browse(val['property_id']).state = 'offer_received'
67+
return super().create(vals)

0 commit comments

Comments
 (0)