mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-21 09:32:08 +02:00
Initial commit: Core packages
This commit is contained in:
commit
12c29a983b
9512 changed files with 8379910 additions and 0 deletions
|
|
@ -0,0 +1,34 @@
|
|||
/** @odoo-module */
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
|
||||
const { Component, onWillStart } = owl;
|
||||
|
||||
export class PurchaseDashBoard extends Component {
|
||||
setup() {
|
||||
this.orm = useService("orm");
|
||||
this.action = useService("action");
|
||||
|
||||
onWillStart(async () => {
|
||||
this.purchaseData = await this.orm.call(
|
||||
"purchase.order",
|
||||
"retrieve_dashboard",
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method clears the current search query and activates
|
||||
* the filters found in `filter_name` attibute from button pressed
|
||||
*/
|
||||
setSearchContext(ev) {
|
||||
let filter_name = ev.currentTarget.getAttribute("filter_name");
|
||||
let filters = filter_name.split(',');
|
||||
let searchItems = this.env.searchModel.getSearchItems((item) => filters.includes(item.name));
|
||||
this.env.searchModel.query = [];
|
||||
for (const item of searchItems){
|
||||
this.env.searchModel.toggleSearchItem(item.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PurchaseDashBoard.template = 'purchase.PurchaseDashboard'
|
||||
|
|
@ -0,0 +1,95 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates>
|
||||
<t t-name="purchase.PurchaseDashboard" owl="1">
|
||||
<div class="o_purchase_dashboard container-fluid py-4 border-bottom bg-white">
|
||||
<div class="row justify-content-between gap-3 gap-lg-0">
|
||||
<div class="col-12 col-lg-5 col-xl-5 col-xxl-4 flex-grow-1 flex-lg-grow-0 flex-shrink-0">
|
||||
<div class="grid gap-4">
|
||||
<div class="g-col-3 g-col-sm-2 d-flex align-items-center py-2 justify-content-end text-end justify-content-lg-start text-lg-start text-break">
|
||||
All RFQs
|
||||
</div>
|
||||
<div class="g-col-9 g-col-sm-10 grid gap-1">
|
||||
<div class="g-col-4 p-0" t-on-click="setSearchContext" title="All Draft RFQs" filter_name="draft_rfqs">
|
||||
<a href="#" class="btn btn-primary w-100 h-100 border-0 rounded-0 text-capitalize text-break fw-normal">
|
||||
<div class="fs-2" t-out="purchaseData['all_to_send']"/>To Send
|
||||
</a>
|
||||
</div>
|
||||
<div class="g-col-4 p-0" t-on-click="setSearchContext" title="All Waiting RFQs" filter_name="waiting_rfqs">
|
||||
<a href="#" class="btn btn-primary w-100 h-100 border-0 rounded-0 text-capitalize text-break fw-normal">
|
||||
<div class="fs-2" t-out="purchaseData['all_waiting']"/>Waiting
|
||||
</a>
|
||||
</div>
|
||||
<div class="g-col-4 p-0" t-on-click="setSearchContext" title="All Late RFQs" filter_name="late_rfqs">
|
||||
<a href="#" class="btn btn-primary w-100 h-100 border-0 rounded-0 text-capitalize text-break fw-normal">
|
||||
<div class="fs-2" t-out="purchaseData['all_late']"/>Late
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid gap-4">
|
||||
<div class="g-col-3 g-col-sm-2 d-flex align-items-center py-2 justify-content-end text-end justify-content-lg-start text-lg-start text-break">
|
||||
My RFQs
|
||||
</div>
|
||||
<div class="g-col-9 g-col-sm-10 grid gap-2">
|
||||
<div class="g-col-4 p-0" t-on-click="setSearchContext" title="My Draft RFQs" filter_name="draft_rfqs,my_purchases">
|
||||
<a href="#" class="btn btn-light d-flex align-items-center w-100 h-100 p-0 border-0 bg-100 fw-normal">
|
||||
<div class="w-100 p-2" t-out="purchaseData['my_to_send']"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="g-col-4 p-0" t-on-click="setSearchContext" title="My Waiting RFQs" filter_name="waiting_rfqs,my_purchases">
|
||||
<a href="#" class="btn btn-light d-flex align-items-center w-100 h-100 p-0 border-0 bg-100 fw-normal">
|
||||
<div class="w-100 p-2" t-out="purchaseData['my_waiting']"/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="g-col-4 p-0" t-on-click="setSearchContext" title="My Late RFQs" filter_name="late_rfqs,my_purchases">
|
||||
<a href="#" class="btn btn-light d-flex align-items-center w-100 h-100 p-0 border-0 bg-100 fw-normal">
|
||||
<div class="w-100 p-2" t-out="purchaseData['my_late']"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-lg-7 col-xl-6 col-xxl-5 flex-shrink-0">
|
||||
<div class="d-flex flex-column justify-content-between gap-2 h-100">
|
||||
<div class="grid gap-2 h-100">
|
||||
<div class="g-col-6 g-col-md-6 grid gap-1 gap-md-4">
|
||||
<div class="g-col-12 g-col-sm-4 g-col-lg-6 d-flex align-items-center justify-content-center text-center justify-content-md-end text-md-end mt-4 mt-sm-0 text-break">
|
||||
Avg Order Value
|
||||
</div>
|
||||
<div class="g-col-12 g-col-sm-8 g-col-lg-5 d-flex align-items-center justify-content-center py-2 bg-light">
|
||||
<span><t t-out="purchaseData['all_avg_order_value']"/></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="g-col-6 g-col-md-6 grid gap-1 gap-md-4">
|
||||
<div class="g-col-12 g-col-sm-4 g-col-lg-6 d-flex align-items-center py-2 justify-content-center text-center justify-content-md-end text-md-end mt-4 mt-sm-0 text-break">
|
||||
Purchased Last 7 Days
|
||||
</div>
|
||||
<div class="g-col-12 g-col-sm-8 g-col-lg-6 d-flex align-items-center justify-content-center py-2 bg-light">
|
||||
<span><t t-out="purchaseData['all_total_last_7_days']"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid gap-2 h-100">
|
||||
<div class="g-col-6 g-col-md-6 grid gap-1 gap-md-4">
|
||||
<div class="g-col-12 g-col-sm-4 g-col-lg-6 d-flex align-items-center justify-content-center text-center justify-content-md-end text-md-end mt-4 mt-sm-0 text-break">
|
||||
Lead Time to Purchase
|
||||
</div>
|
||||
<div class="g-col-12 g-col-sm-8 g-col-lg-5 d-flex align-items-center justify-content-center py-2 bg-light">
|
||||
<span><t t-out="purchaseData['all_avg_days_to_purchase']"/>  Days</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="g-col-6 g-col-md-6 grid gap-1 gap-md-4">
|
||||
<div class="g-col-12 g-col-md-4 g-col-sm-4 g-col-lg-6 d-flex align-items-center justify-content-center text-center justify-content-md-end text-md-end mt-4 mt-sm-0 text-break">
|
||||
RFQs Sent Last 7 Days
|
||||
</div>
|
||||
<div class="g-col-12 g-col-sm-8 g-col-lg-6 d-flex align-items-center justify-content-center py-2 bg-light">
|
||||
<span><t t-out="purchaseData['all_sent_rfqs']"/></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { kanbanView } from '@web/views/kanban/kanban_view';
|
||||
import { KanbanRenderer } from '@web/views/kanban/kanban_renderer';
|
||||
import { PurchaseDashBoard } from '@purchase/views/purchase_dashboard';
|
||||
|
||||
|
||||
export class PurchaseDashBoardKanbanRenderer extends KanbanRenderer {};
|
||||
|
||||
PurchaseDashBoardKanbanRenderer.template = 'purchase.PurchaseKanbanView';
|
||||
PurchaseDashBoardKanbanRenderer.components= Object.assign({}, KanbanRenderer.components, {PurchaseDashBoard})
|
||||
|
||||
export const PurchaseDashBoardKanbanView = {
|
||||
...kanbanView,
|
||||
Renderer: PurchaseDashBoardKanbanRenderer,
|
||||
};
|
||||
|
||||
registry.category("views").add("purchase_dashboard_kanban", PurchaseDashBoardKanbanView);
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<templates>
|
||||
<t t-name="purchase.PurchaseKanbanView" t-inherit="web.KanbanRenderer" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="//div[hasclass('o_kanban_renderer')]" position="before">
|
||||
<PurchaseDashBoard />
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { listView } from "@web/views/list/list_view";
|
||||
import { ListRenderer } from "@web/views/list/list_renderer";
|
||||
import { PurchaseDashBoard } from '@purchase/views/purchase_dashboard';
|
||||
|
||||
export class PurchaseDashBoardRenderer extends ListRenderer {};
|
||||
|
||||
PurchaseDashBoardRenderer.template = 'purchase.PurchaseListView';
|
||||
PurchaseDashBoardRenderer.components= Object.assign({}, ListRenderer.components, {PurchaseDashBoard})
|
||||
|
||||
export const PurchaseDashBoardListView = {
|
||||
...listView,
|
||||
Renderer: PurchaseDashBoardRenderer,
|
||||
};
|
||||
|
||||
registry.category("views").add("purchase_dashboard_list", PurchaseDashBoardListView);
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<templates>
|
||||
<t t-name="purchase.PurchaseListView" t-inherit="web.ListRenderer" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="//div[hasclass('o_list_renderer')]" position="before">
|
||||
<PurchaseDashBoard />
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
Loading…
Add table
Add a link
Reference in a new issue