This commit removes the legacy session and adapts the modules where it was used. task 3439226 closes odoo/odoo#133153 Related: odoo/enterprise#46290 Signed-off-by: Jorge Pinna Puissant (jpp) <jpp@odoo.com>
38 lines
1003 B
JavaScript
38 lines
1003 B
JavaScript
/** @odoo-module */
|
|
|
|
import { useService } from '@web/core/utils/hooks';
|
|
import { getCurrency } from '@web/core/currency';
|
|
|
|
const { Component, onWillStart, useState } = owl;
|
|
|
|
export class ExpenseDashboard extends Component {
|
|
|
|
setup() {
|
|
super.setup();
|
|
this.orm = useService('orm');
|
|
|
|
this.state = useState({
|
|
expenses: {}
|
|
});
|
|
|
|
onWillStart(async () => {
|
|
const expense_states = await this.orm.call("hr.expense", 'get_expense_dashboard', []);
|
|
this.state.expenses = expense_states;
|
|
});
|
|
}
|
|
|
|
renderMonetaryField(value, currency_id) {
|
|
value = value.toFixed(2);
|
|
const currency = getCurrency(currency_id);
|
|
if (currency) {
|
|
if (currency.position === "after") {
|
|
value += currency.symbol;
|
|
} else {
|
|
value = currency.symbol + value;
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
}
|
|
ExpenseDashboard.template = 'hr_expense.ExpenseDashboard';
|