Skip to content

[ADD] estate: New module to manage estates #814

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 42 commits into
base: 18.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
5e4d31e
[ADD] estate: Creating apps and models
baje-odoo Jun 17, 2025
23ad338
[IMP] estate: Add Security rules
baje-odoo Jun 17, 2025
902379a
[IMP] estate: Add fields and parameters to models estate_property
baje-odoo Jun 18, 2025
9420b3a
[IMP] estate: Add list view
baje-odoo Jun 18, 2025
ef18c3f
[FIX] estate: pipeline fix
baje-odoo Jun 18, 2025
1be0e7a
[IMP] estate: Add form view
baje-odoo Jun 18, 2025
8ec4cb4
[IMP] estate: Add Searchbar view
baje-odoo Jun 18, 2025
9182210
[IMP] estate: Add many2one relations
baje-odoo Jun 18, 2025
c316dd2
[IMP] estate: Add many2many relations
baje-odoo Jun 18, 2025
b398197
[IMP] estate: Add one2many relations
baje-odoo Jun 18, 2025
5786a59
[IMP] estate: Add compute and inverse
baje-odoo Jun 18, 2025
0422878
[IMP] estate: Add onchange method
baje-odoo Jun 18, 2025
2949458
[IMP] estate: Add buttons
baje-odoo Jun 18, 2025
9d776f7
[IMP] estate: Add constraints
baje-odoo Jun 19, 2025
1d69faf
[IMP] estate: Add Inline views - widgets - list order - attributes
baje-odoo Jun 19, 2025
716c663
[IMP] estate: Add stat button
baje-odoo Jun 19, 2025
2a00cff
[IMP] estate: Add create and delete conditions - user inheritance
baje-odoo Jun 19, 2025
bfdb4ba
[ADD] estate_account: Add link between estate and account
baje-odoo Jun 20, 2025
9a0df1a
[IMP] estate: Add kanban view
baje-odoo Jun 20, 2025
199b3c2
[IMP] estate: Add more informations on cards
baje-odoo Jun 20, 2025
d5a3567
[REF] estate: Refactoring to the coding guidelines
baje-odoo Jun 20, 2025
2c139ac
[ADD] awesome_owl: implement counter and card
baje-odoo Jun 23, 2025
290ffe1
[IMP] awesome_owl: Add Markup use to card
baje-odoo Jun 23, 2025
2ad352d
[IMP] awesome_owl: Add validation - callbacks - foreach
baje-odoo Jun 23, 2025
58f4c23
[IMP] awesome_owl: Add dynamic attributes and event handler
baje-odoo Jun 23, 2025
9644d50
[IMP] awesome_owl: Add autofocus on todo list
baje-odoo Jun 23, 2025
3355116
[IMP] awesome_owl: Add deleting button on todo items
baje-odoo Jun 23, 2025
4a021e2
[IMP] awesome_owl: Add slots
baje-odoo Jun 23, 2025
374b700
[IMP] awesome_owl: Add t-if
baje-odoo Jun 23, 2025
e7ab77e
[ADD] awesome_dashboard: Add base layout
baje-odoo Jun 24, 2025
82592bd
[IMP] awesome_dashboard: Add navigation and dashboard item
baje-odoo Jun 24, 2025
fa0e393
[IMP] awesome_dashboard: Call the server to show statistics
baje-odoo Jun 24, 2025
d704def
[IMP] awesome_dashboard: Add statistics service
baje-odoo Jun 24, 2025
e0c0418
[IMP] awesome_dashboard: Add pie chart
baje-odoo Jun 24, 2025
d2cdb2a
[IMP] awesome_dashboard: reactive use
baje-odoo Jun 25, 2025
a0dabb8
[MOV] awesome_dashboard: made bundle folder for dashboard
baje-odoo Jun 25, 2025
1207f8c
[MOV] awesome_dashboard: made a pie chart folder
baje-odoo Jun 25, 2025
a5d023c
[IMP] awesome_dashboard: Generic Dashboard
baje-odoo Jun 25, 2025
8f2fe66
[IMP] awesome_dashboard: Extensible Dashboard
baje-odoo Jun 25, 2025
35aa75a
[IMP] awesome_dashboard: Add a dialog to configure the items
baje-odoo Jun 25, 2025
cf8ca37
[IMP] estate: Add master and demo data
baje-odoo Jun 26, 2025
1595efc
[IMP] estate: Add demo offers
baje-odoo Jun 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ venv.bak/
dmypy.json

# Pyre type checker
.pyre/
.pyre/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.languageServer": "None"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course, on real PRs, such files wouldn't be included.

}
5 changes: 5 additions & 0 deletions awesome_dashboard/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
'assets': {
'web.assets_backend': [
'awesome_dashboard/static/src/**/*',
('remove', 'awesome_dashboard/static/src/dashboard/**/*'),
],
'awesome_dashboard.dashboard': [
'awesome_dashboard/static/src/dashboard/**/*',
],

},
'license': 'AGPL-3'
}
10 changes: 0 additions & 10 deletions awesome_dashboard/static/src/dashboard.js

This file was deleted.

8 changes: 0 additions & 8 deletions awesome_dashboard/static/src/dashboard.xml

This file was deleted.

86 changes: 86 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/** @odoo-module **/

import { Component, useState } from "@odoo/owl";
import { registry } from "@web/core/registry";
import { Layout } from "@web/search/layout";
import { useService } from "@web/core/utils/hooks";
import { DashboardItem } from "./dashboard_item";
import { Dialog } from "@web/core/dialog/dialog";
import { CheckBox } from "@web/core/checkbox/checkbox";
import { browser } from "@web/core/browser/browser";

class AwesomeDashboard extends Component {
static template = "awesome_dashboard.AwesomeDashboard";
static components = { Layout, DashboardItem };

setup(){
this.action = useService("action");
this.statistics = useState(useService("awesome_dashboard.statistics"));
this.items = registry.category("item").getAll();
this.dialog = useService("dialog");
this.display = {
controlPanel: {},
};
this.state = useState({
disabledItems: browser.localStorage.getItem("disabledDashboardItems")?.split(",") || [],
});
}

openConfiguration(newDisabledItems) {
this.dialog.add(ConfigurationDialog, {
items: this.items,
disabledItems: this.state.disabledItems,
onUpdateConfiguration: this.updateConfiguration.bind(this),
})
}

updateConfiguration(newDisabledItems) {
this.state.disabledItems = newDisabledItems;
}
openCustomerView() {
this.action.doAction("base.action_partner_form");
}

openLeadView(){
this.action.doAction({
type: "ir.actions.act_window",
name: "All leads",
res_model: "crm.lead",
views: [
[false, "list"],
[false, "form"]
],
});
}
}

class ConfigurationDialog extends Component {
static template = "awesome_dashboard.ConfigurationDialog";
static components = { Dialog, CheckBox };
static props = ["close", "items", "disabledItems", "onUpdateConfiguration"];

setup(){
this.items = useState(this.props.items.map((item) => {
return {
...item,
enabled: !this.props.disabledItems.includes(item.id),
};
}));
}

done(){
this.props.close();
}

onChange(checked, changedItem){
changedItem.enabled = checked;
const newDisabledItems = Object.values(this.items).filter(
(item) => !item.enabled).map((item) => item.id);

browser.localStorage.setItem("disabledDashboardItems", newDisabledItems);

this.props.onUpdateConfiguration(newDisabledItems);
}
}

registry.category("lazy_components").add("AwesomeDashboard", AwesomeDashboard);
3 changes: 3 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.o_dashboard{
background-color: gray;
}
41 changes: 41 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">

<t t-name="awesome_dashboard.AwesomeDashboard">
<Layout display="display" className="'o_dashboard h-100'">
<t t-set-slot="layout-buttons">
<button class="btn btn-primary" t-on-click="openCustomerView">Customers</button>
<button class="btn btn-primary" t-on-click="openLeadView">Leads</button>
</t>
<t t-set-slot="control-panel-additional-actions">
<button t-on-click="openConfiguration" class="btn p-0 ms-1 border-0">
<i class="fa fa-cog"></i>
</button>
</t>
<div class="d-flex flex-wrap" t-if="statistics.isReady">
<t t-foreach="items" t-as="item" t-key="item.id">
<DashboardItem t-if="!state.disabledItems.includes(item.id)" size="item.size || 1">
<t t-set="itemProp" t-value="item.props ? item.props(statistics) : {'data': statistics}"/>
<t t-component="item.Component" t-props="itemProp" />
</DashboardItem>
</t>
</div>
</Layout>
</t>
<t t-name="awesome_dashboard.ConfigurationDialog">
<Dialog title="'Dashboard items configuration'">
Which cards do you whish to see ?
<t t-foreach="items" t-as="item" t-key="item.id">
<CheckBox value="item.enabled" onChange="(ev) => this.onChange(ev, item)">
<t t-esc="item.description"/>
</CheckBox>
</t>
<t t-set-slot="footer">
<button class="btn btn-primary" t-on-click="done">
Done
</button>
</t>
</Dialog>
</t>

</templates>
19 changes: 19 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard_item.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Component } from "@odoo/owl";

export class DashboardItem extends Component {
static template = "awesome_dashboard.DashboardItem";
static props = {
slots: {
type: Object,
shape: {
default: Object
},
},
size: {
type: Number,
default: 1,
optional: true,

},
}
}
12 changes: 12 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">

<t t-name="awesome_dashboard.DashboardItem">
<div class="card m-2 border-dark" t-attf-style="width: {{18*props.size}}rem;">
<div class="card-body">
<t t-slot="default"/>
</div>
</div>
</t>

</templates>
65 changes: 65 additions & 0 deletions awesome_dashboard/static/src/dashboard/dashboard_items.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { StatCard } from "../stat_card/stat_card";
import { PieChartCard } from "../pie_chart_card/pie_chart_card";
import { registry } from "@web/core/registry";

const items = [
{
id: "average_quantity",
description: "Average amount of t-shirt",
Component: StatCard,
props: (data) => ({
title: "Average amount of t-shirt by order this month",
value: data.average_quantity,
})
},
{
id: "average_time",
description: "Average time for an order",
Component: StatCard,
props: (data) => ({
title: "Average time for an order to go from 'new' to 'sent' or 'cancelled'",
value: data.average_time,
})
},
{
id: "number_new_orders",
description: "New orders this month",
Component: StatCard,
props: (data) => ({
title: "Number of new orders this month",
value: data.nb_new_orders,
})
},
{
id: "cancelled_orders",
description: "Cancelled orders this month",
Component: StatCard,
props: (data) => ({
title: "Number of cancelled orders this month",
value: data.nb_cancelled_orders,
})
},
{
id: "amount_new_orders",
description: "amount orders this month",
Component: StatCard,
props: (data) => ({
title: "Total amount of new orders this month",
value: data.total_amount,
})
},
{
id: "pie_chart",
description: "Shirt orders by size",
Component: PieChartCard,
size: 2,
props: (data) => ({
title: "Shirt orders by size",
values: data.orders_by_size,
})
}
]

items.forEach((item) => {
registry.category("item").add(item.id, item);
});
21 changes: 21 additions & 0 deletions awesome_dashboard/static/src/dashboard/statistics_service.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { rpc } from "@web/core/network/rpc";
import { registry } from "@web/core/registry";
import { reactive } from "@odoo/owl";

const statisticsService = {
start(){
const statistics = reactive({ isReady: false });

async function getData(){
const updates = await rpc("/awesome_dashboard/statistics");
Object.assign(statistics, updates, { isReady: true });
}

setInterval(getData, 1000*60*10);
getData();

return statistics;
},
};

registry.category("services").add("awesome_dashboard.statistics", statisticsService);
10 changes: 10 additions & 0 deletions awesome_dashboard/static/src/dashboard_loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { registry } from "@web/core/registry";
import { LazyComponent } from "@web/core/assets";
import { Component } from "@odoo/owl";

class AwesomeDashboardLoader extends Component {
static template = "awesome_dashboard.AwesomeDashboardLoader";
static components = { LazyComponent };
static props = {};
}
registry.category("actions").add("awesome_dashboard.dashboard", AwesomeDashboardLoader);
6 changes: 6 additions & 0 deletions awesome_dashboard/static/src/dashboard_loader.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="awesome_dashboard.AwesomeDashboardLoader">
<LazyComponent bundle="'awesome_dashboard.dashboard'" Component="'AwesomeDashboard'" props="props"/>
</t>
</templates>
46 changes: 46 additions & 0 deletions awesome_dashboard/static/src/pie_chart/pie_chart.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { loadJS } from "@web/core/assets";
import { getColor } from "@web/core/colors/colors";
import { Component, onWillStart, onWillUnmount, onMounted, onWillUpdateProps, useRef } from "@odoo/owl";

export class PieChart extends Component {
static template = "awesome_dashboard.PieChart";
static props = {
label: { type: String, optional: true },
data: { type: Object, optional: true },
};

setup(){
this.canvasRef = useRef("canvas");
onWillStart (() => loadJS("/web/static/lib/Chart/Chart.js"));
onMounted(() => {
this.renderChart();
});
onWillUpdateProps((nextProps) => {
this.chart.destroy();
this.renderChart(nextProps);
})
onWillUnmount(() => {
if (this.chart) {
this.chart.destroy();
}
});
};

renderChart(props = this.props) {
const labels = Object.keys(props.data);
const data = Object.values(props.data);
const color = labels.map((_, index) => getColor(index));
this.chart = new Chart(this.canvasRef.el, {
type: "pie",
data: {
labels: labels,
datasets: [
{
data: data,
backgroundColor: color,
},
],
},
});
}
}
10 changes: 10 additions & 0 deletions awesome_dashboard/static/src/pie_chart/pie_chart.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="awesome_dashboard.PieChart">
<div t-att-class="'h-100' + props.class" t-ref="root">
<div class="h-100 posiion-relative" t-ref="container">
<canvas t-ref="canvas"/>
</div>
</div>
</t>
</templates>
11 changes: 11 additions & 0 deletions awesome_dashboard/static/src/pie_chart_card/pie_chart_card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Component } from "@odoo/owl";
import { PieChart } from "../pie_chart/pie_chart";

export class PieChartCard extends Component {
static template = "awesome_dashboard.PieChartCard";
static components = { PieChart };
static props = {
title: {type: String},
values: {type: Object},
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<templates xml:space="preserve">
<t t-name="awesome_dashboard.PieChartCard">
<t t-esc="props.title"/>
<PieChart data="props.values" label="''"/>
</t>
</templates>
Loading