Skip to content

Commit 590c654

Browse files
committed
[IMP] awesome_owl: added counter ui in playground, added card,counter component.
added counter button and component in playground xml. created counter and card component with it's xml and js files. added property field in sales order form using inheritance.
1 parent d1e1228 commit 590c654

File tree

12 files changed

+108
-7
lines changed

12 files changed

+108
-7
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { Component } from "@odoo/owl";
2+
3+
export class Card extends Component {
4+
static template = "awesome_owl.card";
5+
static props = {
6+
title: String,
7+
content: String
8+
};
9+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates xml:space="preserve">
3+
<t t-name="awesome_owl.card">
4+
<div class="card d-inline-block m-2" style="width: 18rem; border: 2px solid black; border-radius: 12px; margin-top: 10px; text-align:center;">
5+
<div class="card-body">
6+
<h4 class="card-title" style="background-color: blue; margin:0; border-radius:14px;">
7+
<t t-esc="props.title"/>
8+
</h4>
9+
<p class="card-text" style="background-color: green; margin:10px; border-radius:14px;">
10+
<t t-esc="props.content"/>
11+
</p>
12+
</div>
13+
</div>
14+
</t>
15+
</templates>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { Component, useState } from "@odoo/owl";
2+
3+
export class Counter extends Component {
4+
static template = "awesome_owl.counter";
5+
6+
setup() {
7+
this.state = useState({ value: 0 });
8+
}
9+
10+
increment() {
11+
this.state.value++;
12+
}
13+
14+
decrement() {
15+
this.state.value--;
16+
}
17+
18+
reset() {
19+
this.state.value = 0;
20+
}
21+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<templates xml:space="preserve">
3+
<t t-name="awesome_owl.counter">
4+
<div style="border: 2px solid black; border-radius: 12px; width: fit-content; padding: 10px; margin-top:10px;">
5+
<p>Counter: <t t-esc="state.value"/></p>
6+
<button class="btn btn-primary" t-on-click="increment">Increment</button>
7+
<button class="btn btn-primary" t-on-click="decrement">Decrement</button>
8+
<button t-if="state.value != 0" class="btn btn-primary" t-on-click="reset">Reset</button>
9+
</div>
10+
</t>
11+
</templates>
Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1-
import { Component } from "@odoo/owl";
1+
import { Component, useState } from "@odoo/owl";
2+
import { Counter } from "./counter/counter";
3+
import { Card } from "./card/card";
24

35
export class Playground extends Component {
46
static template = "awesome_owl.playground";
7+
static components = {Counter,Card};
8+
9+
setup() {
10+
this.state = useState({ value: 0 });
11+
}
12+
13+
increment() {
14+
this.state.value++;
15+
}
16+
17+
decrement() {
18+
this.state.value--;
19+
}
20+
21+
reset(){
22+
this.state.value = 0;
23+
}
524
}
Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<templates xml:space="preserve">
3-
43
<t t-name="awesome_owl.playground">
5-
<div class="p-3">
6-
hello world
4+
<div style="border: 2px solid black; border-radius: 12px; width: fit-content; padding: 10px; margin-top:5px;">
5+
<p>Counter: <t t-esc="state.value"/></p>
6+
<button class="btn btn-primary" t-on-click="increment">Increment</button>
7+
<button class="btn btn-primary" t-on-click="decrement">Decrement</button>
8+
<button t-if="state.value != 0" class="btn btn-primary" t-on-click="reset">Reset</button>
79
</div>
10+
<Counter/>
11+
<Card title="'Hello'" content="'word'"/>
12+
<Card title="'New'" content="'Card'"/>
813
</t>
9-
1014
</templates>

estate/__manifest__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Real Estate Module to Buy and Sell Your Real Estate with Ease.
66
""",
77
"version": "1.0",
8-
"depends": ["base"],
8+
"depends": ["base","sale"],
99
"author": "danal",
1010
"category": "Category",
1111
"application": True,
@@ -17,6 +17,7 @@
1717
"views/estate_property_tag_views.xml",
1818
"views/estate_property_type_views.xml",
1919
"views/res_users_views.xml",
20+
"views/sale_order_views.xml",
2021
"views/estate_menus.xml",
2122
],
2223
}

estate/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
from . import estate_property_tag
55
from . import estate_property_offer
66
from . import res_users
7+
from . import sale_order

estate/models/estate_property_offer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from odoo import api, models, fields
55

6+
import pdb
67

78
class EstatePropertyOffer(models.Model):
89
_name = "estate.property.offer"
@@ -41,6 +42,7 @@ def _inverse_date(self):
4142

4243
def action_accept(self):
4344
for record in self:
45+
pdb.set_trace()
4446
record.status = "accepted"
4547
record.property_id.selling_price = record.price
4648
record.property_id.customer = record.partner_id

estate/models/sale_order.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from odoo import fields, models
2+
3+
class SaleOrder(models.Model):
4+
_inherit="sale.order"
5+
6+
property_id = fields.Many2one("estate.property")

0 commit comments

Comments
 (0)