mirror of
https://github.com/bringout/oca-ocb-report.git
synced 2026-04-19 04:42:04 +02:00
Initial commit: Report packages
This commit is contained in:
commit
bc5e1e9efa
604 changed files with 474102 additions and 0 deletions
|
|
@ -0,0 +1,63 @@
|
|||
/** @odoo-module */
|
||||
|
||||
import spreadsheet from "@spreadsheet/o_spreadsheet/o_spreadsheet_extended";
|
||||
|
||||
const { toCartesian } = spreadsheet.helpers;
|
||||
|
||||
/**
|
||||
* Get the value of the given cell
|
||||
*/
|
||||
export function getCellValue(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
||||
const { col, row } = toCartesian(xc);
|
||||
const cell = model.getters.getCell(sheetId, col, row);
|
||||
if (!cell) {
|
||||
return undefined;
|
||||
}
|
||||
return cell.evaluated.value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cell of the given xc
|
||||
*/
|
||||
export function getCell(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
||||
const { col, row } = toCartesian(xc);
|
||||
return model.getters.getCell(sheetId, col, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cells of the given sheet (or active sheet if not provided)
|
||||
*/
|
||||
export function getCells(model, sheetId = model.getters.getActiveSheetId()) {
|
||||
return model.getters.getCells(sheetId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formula of the given xc
|
||||
*/
|
||||
export function getCellFormula(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
||||
const cell = getCell(model, xc, sheetId);
|
||||
return cell && cell.isFormula() ? model.getters.getFormulaCellContent(sheetId, cell) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the content of the given xc
|
||||
*/
|
||||
export function getCellContent(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
||||
const cell = getCell(model, xc, sheetId);
|
||||
return cell ? model.getters.getCellText(cell, true) : "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list of the merges (["A1:A2"]) of the sheet
|
||||
*/
|
||||
export function getMerges(model, sheetId = model.getters.getActiveSheetId()) {
|
||||
return model.exportData().sheets.find((sheet) => sheet.id === sheetId).merges;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the formatted value of the given xc
|
||||
*/
|
||||
export function getCellFormattedValue(model, xc, sheetId = model.getters.getActiveSheetId()) {
|
||||
const cell = getCell(model, xc, sheetId);
|
||||
return cell ? model.getters.getCellText(cell, false) : "";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue