Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
ee6df7f
[Fix task list pagination limit and search refresh errors]
parvathyabnair Aug 18, 2026
909617a
fix: resolve timer stop reference errors, duration parsing, and draft…
suraj-yadav0 Aug 19, 2026
a5b94cf
feat: enhance timesheet creation and live timer sync UX
suraj-yadav0 Aug 19, 2026
08ee2f7
style: redesign GlobalTimerWidget with two-line layout and dark theme
suraj-yadav0 Aug 19, 2026
d42bad5
fix: make GlobalTimerWidget reactive and restore crisp action button …
suraj-yadav0 Aug 19, 2026
8289919
fix: resolve duplicate bottom layer from ModelDownloadTimerWidget
suraj-yadav0 Aug 19, 2026
4b4ab09
asset: upgrade play, pause, and stop icons to crisp vector and high-D…
suraj-yadav0 Aug 19, 2026
1ad6891
style: apply Ubuntu Touch native warm dark palette to GlobalTimerWidget
suraj-yadav0 Aug 19, 2026
4999887
fix(qml): restore missing closing brace in GlobalTimerWidget
suraj-yadav0 Aug 19, 2026
db10955
feat(ui): enhance Sync UI with rotating sync icon, live percentage ba…
suraj-yadav0 Aug 19, 2026
8282de9
Color fixes for Sync-GlobalTimerWidget
suraj-yadav0 Aug 19, 2026
aba70e6
feat(scripts): add linting and import validation scripts with pre-com…
suraj-yadav0 Aug 19, 2026
28e4144
fix(.gitignore): remove unnecessary website build artifacts from igno…
suraj-yadav0 Aug 19, 2026
f1a0428
refactor(utils): enhance truncateText function and improve text clean…
suraj-yadav0 Aug 19, 2026
cb98116
update status logic to reflect timer activity and workflow state
suraj-yadav0 Aug 19, 2026
f01d812
mark previous timesheet as draft when starting a new timer
suraj-yadav0 Aug 19, 2026
c56924c
Merge pull request #294 from CITOpenRep/linting-scripts
suraj-yadav0 Aug 19, 2026
54132e0
chore: update version to 1.3.2 across manifest, constants, release no…
suraj-yadav0 Aug 20, 2026
07940e7
Merge pull request #295 from CITOpenRep/linting-scripts
suraj-yadav0 Aug 20, 2026
fe3dc6c
fix: support local account activity types
srush0 Aug 20, 2026
6c762cb
fix: resolve the project name error
awadamit41 Aug 20, 2026
0585c37
Merge pull request #297 from awadamit41/fix/project-name-banner-v1.3.2
suraj-yadav0 Aug 21, 2026
d5f23e0
feat: add lint and import validation workflow
suraj-yadav0 Aug 21, 2026
1ead7f8
fixes for lint yaml
suraj-yadav0 Aug 21, 2026
6bd137e
Merge branch 'release/v1.3.2' into fix/local-account-activity-type-v3
suraj-yadav0 Aug 21, 2026
3e0973b
fix: pass account id when resolving activity types
srush0 Aug 21, 2026
d7bd312
fix: improve date field color contrast
srush0 Aug 22, 2026
6f8522d
Merge pull request #296 from srush0/fix/local-account-activity-type-v3
suraj-yadav0 Aug 24, 2026
bf0e21f
Merge pull request #301 from srush0/fix/date-field-color-279
suraj-yadav0 Aug 24, 2026
0a2e67f
Add Japanese translation
aniketp1304 Aug 17, 2026
2681d62
Merge pull request #302 from aniketp1304/translation/add-ja-v1.3.3
suraj-yadav0 Aug 25, 2026
c8e71fa
fix: prevent data leakage on account deletion and cleanup orphan atta…
suraj-yadav0 Aug 27, 2026
62134f2
fix: enhance attachment handling for local accounts and improve query…
suraj-yadav0 Aug 27, 2026
9f0c0fe
perf: optimize task pagination with SQL search, direct all-filter que…
suraj-yadav0 Aug 27, 2026
8beb44d
Merge branch 'release/v1.3.2' into task-list-search
suraj-yadav0 Aug 27, 2026
2e8cfd6
Merge pull request #293 from parvathyabnair/task-list-search
suraj-yadav0 Aug 27, 2026
55199f2
Merge branch 'release/v1.3.3' of https://github.com/CITOpenRep/timema…
suraj-yadav0 Aug 27, 2026
6332033
Merge branch 'release/v1.3.2' into release/v1.3.3
suraj-yadav0 Aug 27, 2026
458af64
Merge branch 'release/v1.3.3' into fix/DataLeakageonDeletion
suraj-yadav0 Aug 29, 2026
6522a9f
fix: prevent data leakage on account deletion and cleanup orphan atta…
suraj-yadav0 Aug 29, 2026
a4f628f
Merge branch 'release/v1.3.3' into fix#280/localattachments
suraj-yadav0 Aug 29, 2026
2a75e4a
Merge pull request #308 from CITOpenRep/fix#280/localattachments
suraj-yadav0 Aug 29, 2026
b4caf0b
Fix voice model installation and display (#303)
Omkarbahirat Aug 31, 2026
ba04638
Patches for local project stages
suraj-yadav0 Sep 1, 2026
ced44f7
Fix local project hierarchy mapping and navigation
suraj-yadav0 Sep 1, 2026
68c121d
Fix task page back navigation and local project lookup
suraj-yadav0 Sep 1, 2026
cd8746a
Fix project task filtering for local and child projects
suraj-yadav0 Sep 1, 2026
1fb7367
Fix local account edge cases across tasks, activities, selectors, and…
suraj-yadav0 Sep 1, 2026
56481ce
Add global local account toggle switch to menu and drawer headers
suraj-yadav0 Sep 2, 2026
b3b1cbb
Keep local toggle switch synchronized with account selector dialog
suraj-yadav0 Sep 2, 2026
0e436b7
Fix project updates navigation back button and creation workflow
suraj-yadav0 Sep 2, 2026
de4e361
Fix activity page back button and local user assignee filtering
suraj-yadav0 Sep 2, 2026
5f3f719
Fix local account timesheet creation and user resolution
suraj-yadav0 Sep 2, 2026
4afa140
Remove task plan file global-local-account-toggle.md
suraj-yadav0 Sep 2, 2026
dbe242a
Change local account switch accent color to orange
suraj-yadav0 Sep 2, 2026
615297c
Use lighter orange accent for local account switch
suraj-yadav0 Sep 2, 2026
a5c974a
Match switch checked background to menu item highlight color
suraj-yadav0 Sep 2, 2026
e114ead
Darken switch checked background to warm peach accent
suraj-yadav0 Sep 2, 2026
f0932ee
Fix dashboard charts data aggregation and account sync for local account
suraj-yadav0 Sep 2, 2026
a364fb6
Reduce size of Local Account toggle switch in drawer and menu
suraj-yadav0 Sep 2, 2026
2033c4a
Adjust toggle switch size to 4.2x2.1 and display Local instead of Loc…
suraj-yadav0 Sep 2, 2026
5ae3e75
Apply consistent SwitchStyle accent color to all switches throughout …
suraj-yadav0 Sep 2, 2026
abfc579
Import Lomiri.Components.Themes.Ambiance for SwitchStyle in settings …
suraj-yadav0 Sep 2, 2026
0c4c67e
Align switch active colors with brand orange and contextual header co…
suraj-yadav0 Sep 2, 2026
b66292f
Update working days selection buttons to use brand orange accent
suraj-yadav0 Sep 2, 2026
856b5bf
Replace sky blue button colors with brand orange and modernize header…
suraj-yadav0 Sep 2, 2026
2a82b7f
Add getProjectTaskCountMap helper to calculate project and subproject…
suraj-yadav0 Sep 3, 2026
3029984
Implement breadcrumb navigation bar and bind project task counts in P…
suraj-yadav0 Sep 3, 2026
b19f7e3
Redesign ProjectDetailsCard with clean typography, left-aligned star,…
suraj-yadav0 Sep 3, 2026
a547c6b
Support local account automated timesheet lifecycle in timesheet model
suraj-yadav0 Sep 3, 2026
a9e8fe9
Enable automated timer actions on Project and Task cards for local ac…
suraj-yadav0 Sep 3, 2026
a666688
Decouple local account timesheets from sync in UI components
suraj-yadav0 Sep 3, 2026
008a792
Fix saving, drafting, and finalizing running timesheets for local acc…
suraj-yadav0 Sep 3, 2026
54e1d57
Modernize navigation hamburger menu, floating action menu UI, and acc…
suraj-yadav0 Sep 3, 2026
1bde475
Fix QML NumberAnimation easing property in DialerMenu
suraj-yadav0 Sep 3, 2026
4e7330e
Configure default Project Stages and Global Task Stages for Local Acc…
suraj-yadav0 Sep 4, 2026
a380743
Fix stage display and reactivity in task and project list views
suraj-yadav0 Sep 4, 2026
6d0172d
Add left padding to dialer menu action items for label text
suraj-yadav0 Sep 4, 2026
5dc84d3
Bump version to 1.3.3 in manifest, constants, release notes, and daemon
suraj-yadav0 Sep 4, 2026
64968d6
Merge pull request #326 from CITOpenRep/local-patches
suraj-yadav0 Sep 6, 2026
d2e66b3
Replace desktop theme icon with standard symbolic color icon
suraj-yadav0 Sep 7, 2026
e32efbf
Remove redundant header finalize button and auto-finalize timesheet o…
suraj-yadav0 Sep 7, 2026
adb5477
Filter empty and inactive records in user and activity type database …
suraj-yadav0 Sep 7, 2026
db5d823
Prevent blank rows in option selectors and validate activity type loa…
suraj-yadav0 Sep 7, 2026
ad52e2c
Add left padding to Priority label and align stars in TaskPrioritySel…
suraj-yadav0 Sep 8, 2026
e1b3362
Enable initial stage selection and persistence for Local Account tasks
suraj-yadav0 Sep 8, 2026
c2a0e28
Unify project save handling and expose project list alias
suraj-yadav0 Sep 9, 2026
614e5a0
Maintain active account filter and stage matching in project list on …
suraj-yadav0 Sep 9, 2026
8a315d7
Fix overlapping clear icon and polish project search UI
suraj-yadav0 Sep 9, 2026
4c6c045
Add common TSSearchBar component and use in ListHeader and ProjectList
suraj-yadav0 Sep 9, 2026
acc828c
Preserve active search query across filter tab switches
suraj-yadav0 Sep 9, 2026
0607a67
Allow Tomorrow option in DaySelector for activities while preserving …
suraj-yadav0 Sep 10, 2026
fc27875
Refresh personal task list on taskDataChanged signal
suraj-yadav0 Sep 10, 2026
37d9477
Implement collapsible navigation sidebar with desktop and mobile support
suraj-yadav0 Sep 10, 2026
2065204
Merge pull request #340 from CITOpenRep/feature/collapsible-sidebar
suraj-yadav0 Sep 10, 2026
867e5a1
Display account, local toggle, and theme actions in collapsed navigat…
suraj-yadav0 Sep 10, 2026
6e22b93
Fix collapsed hamburger centering and ensure theme toggle visibility
suraj-yadav0 Sep 10, 2026
ba082f1
Add ColorOverlay to collapsed theme toggle icon for light mode contrast
suraj-yadav0 Sep 10, 2026
a4f87e1
Sanitize account connection inputs and expand Odoo server URL validation
suraj-yadav0 Sep 10, 2026
53207b0
Harden account name validation and null safety in account settings
suraj-yadav0 Sep 10, 2026
4080d15
Add dividers between action icons in collapsed navigation sidebar
suraj-yadav0 Sep 10, 2026
277748b
Decouple sync and download snackbars with dynamic stacking and static…
AnmollGarg Sep 10, 2026
a9b3c0d
Fix toggle switch state reset when changing app theme
suraj-yadav0 Sep 10, 2026
47e2a67
swipe actions have been hidden for the Local Account
parvathyabnair Sep 10, 2026
3286e00
Merge pull request #344 from parvathyabnair/localaccount/hide
suraj-yadav0 Sep 10, 2026
755e7d4
Fix duplicate attachment uploads and data loss on reopen (#336)
suraj-yadav0 Sep 11, 2026
e4dc01e
Decouple base widget from derived flags and add white download icon
AnmollGarg Sep 11, 2026
e8574ff
Fix task activities displaying in project activity views (#345)
suraj-yadav0 Sep 11, 2026
1c740b1
Merge pull request #343 from AnmollGarg/fix/download-sync-snackbars
suraj-yadav0 Sep 11, 2026
7b08d53
Fix duplicate selectedAccountId property declaration in WorkItemSelector
suraj-yadav0 Sep 11, 2026
32f68ad
Fix date input field color contrast in light and dark modes (#279)
suraj-yadav0 Sep 11, 2026
13b5204
Warn user and prevent switching when no remote account is logged in (…
AnmollGarg Sep 14, 2026
b17cba9
Fix TextField namespace conflict in DateRangeSelector
suraj-yadav0 Sep 14, 2026
bf2e488
Scope task child queries and subtasks retrieval by account ID
suraj-yadav0 Sep 14, 2026
e5506c8
Implement task hierarchy navigation and subtask drilldown in TaskList
suraj-yadav0 Sep 14, 2026
63ed0e7
Fix subtask styling and prevent filter refresh corruption in TaskList
suraj-yadav0 Sep 14, 2026
33c26f4
Clean up orphan project updates and sync account changes on instance …
suraj-yadav0 Sep 14, 2026
c4aa4da
Replace Controls.TextField with styled Rectangle and Label in DateRan…
suraj-yadav0 Sep 14, 2026
b1e23e0
Fix QML layout anchor conflicts in TaskList, TimeRecorderWidget, and …
suraj-yadav0 Sep 14, 2026
f027f32
Optimize startup performance with deferred DB maintenance and lazy qu…
suraj-yadav0 Sep 14, 2026
dc55d30
Fix device build launch, daemon path handling, and QML view initializ…
suraj-yadav0 Sep 14, 2026
1d5d459
Fix subtask drilldown navigation, child count calculation, and revert…
suraj-yadav0 Sep 14, 2026
443deed
Scope subtask timesheet calculation and parent resolution by account ID
suraj-yadav0 Sep 14, 2026
494a48b
Task list hierarchy (#350)
suraj-yadav0 Sep 14, 2026
b53b6be
Reconcile release/v1.3.3 history with main after v1.3.2 squash
suraj-yadav0 Sep 14, 2026
bacd944
fixed for responsive MEnu
suraj-yadav0 Sep 14, 2026
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 manifest.json.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"push-helper": "ubtms-push-helper.json"
}
},
"version": "1.3.2",
"version": "1.3.3",
"maintainer": "CIT Services <info@cit-services.eu>",
"framework" : "@CLICK_FRAMEWORK@"
}
48 changes: 32 additions & 16 deletions models/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,27 @@ function get_projects_spent_hours(account, startDate, endDate) {

db.transaction(function (tx) {
var params = [];
var conditions = [];
var conditions = [
"(a.status IS NULL OR a.status != 'deleted')",
"a.unit_amount > 0",
"(a.project_id IS NOT NULL OR a.sub_project_id IS NOT NULL)"
];
var query =
"SELECT p.name AS entity_name, SUM(a.unit_amount) AS total, s.name AS stage_name " +
"SELECT p.name AS entity_name, parent.name AS parent_name, SUM(a.unit_amount) AS total, s.name AS stage_name " +
"FROM account_analytic_line_app a " +
"LEFT JOIN project_project_app p ON p.odoo_record_id = a.project_id AND p.account_id = a.account_id " +
"LEFT JOIN project_project_stage_app s ON s.odoo_record_id = p.stage AND s.account_id = p.account_id ";
"JOIN project_project_app p ON (" +
" (p.odoo_record_id = COALESCE(NULLIF(a.sub_project_id, 0), a.project_id) OR " +
" (a.account_id = 0 AND p.id = COALESCE(NULLIF(a.sub_project_id, 0), a.project_id))) " +
" AND p.account_id = a.account_id " +
") " +
"LEFT JOIN project_project_app parent ON (" +
" (parent.odoo_record_id = p.parent_id OR (a.account_id = 0 AND parent.id = p.parent_id)) " +
" AND parent.account_id = p.account_id " +
") " +
"LEFT JOIN project_project_stage_app s ON (" +
" (s.odoo_record_id = p.stage OR (a.account_id = 0 AND s.id = p.stage)) " +
" AND s.account_id = p.account_id " +
") ";

if (account !== -1 && account !== undefined && account !== null) {
conditions.push("a.account_id = ?");
Expand All @@ -107,16 +122,13 @@ function get_projects_spent_hours(account, startDate, endDate) {
params.push(endDate);
}

if (conditions.length > 0) {
query += "WHERE " + conditions.join(" AND ") + " ";
}

query += "GROUP BY a.project_id, a.account_id, p.name, s.name ORDER BY total DESC";
query += "WHERE " + conditions.join(" AND ") + " ";
query += "GROUP BY p.account_id, p.id, p.name, parent.name, s.name ORDER BY total DESC";

var result = tx.executeSql(query, params);
for (var i = 0; i < result.rows.length; i++) {
var row = result.rows.item(i);
var name = row.entity_name || "Unknown Project";
var name = row.parent_name ? (row.parent_name + " / " + row.entity_name) : (row.entity_name || "Unknown Project");
project_details.push({
name: name,
total: row.total,
Expand Down Expand Up @@ -149,11 +161,18 @@ function get_tasks_spent_hours(account, startDate, endDate) {

db.transaction(function (tx) {
var params = [];
var conditions = [];
var conditions = [
"(a.status IS NULL OR a.status != 'deleted')",
"a.unit_amount > 0",
"a.task_id IS NOT NULL"
];
var query =
"SELECT t.name AS entity_name, SUM(a.unit_amount) AS total " +
"FROM account_analytic_line_app a " +
"LEFT JOIN project_task_app t ON t.id = a.task_id ";
"JOIN project_task_app t ON (" +
" (t.odoo_record_id = a.task_id OR (a.account_id = 0 AND t.id = a.task_id)) " +
" AND t.account_id = a.account_id " +
") ";

if (account !== -1 && account !== undefined && account !== null) {
conditions.push("a.account_id = ?");
Expand All @@ -168,10 +187,7 @@ function get_tasks_spent_hours(account, startDate, endDate) {
params.push(endDate);
}

if (conditions.length > 0) {
query += "WHERE " + conditions.join(" AND ") + " ";
}

query += "WHERE " + conditions.join(" AND ") + " ";
query += "GROUP BY a.task_id, t.name ORDER BY total DESC";

var result = tx.executeSql(query, params);
Expand Down
112 changes: 100 additions & 12 deletions models/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ function getAccountsList() {

for (var i = 0; i < accounts.rows.length; i++) {
var row = accounts.rows.item(i);
accountsList.push(DBCommon.rowToObject(row));
var obj = DBCommon.rowToObject(row);
if (obj.id === 0 || obj.name === "Local Account") {
obj.name = "Local";
}
accountsList.push(obj);
}
});

Expand Down Expand Up @@ -123,6 +127,11 @@ function getDefaultAccountId() {
var res = tx.executeSql("SELECT id FROM users WHERE is_default = 1 LIMIT 1");
if (res.rows.length > 0) {
defaultId = res.rows.item(0).id;
} else {
var fallback = tx.executeSql("SELECT id FROM users ORDER BY id ASC LIMIT 1");
if (fallback.rows.length > 0) {
defaultId = fallback.rows.item(0).id;
}
}
});

Expand All @@ -134,6 +143,37 @@ function getDefaultAccountId() {
}


/**
* Retrieves the ID of the default remote account (id > 0), or the first remote account.
*
* @returns {number} The remote account ID, or -1 if no remote account exists.
*/
function getDefaultRemoteAccountId() {
var remoteId = -1;

try {
var db = Sql.LocalStorage.openDatabaseSync(DBCommon.NAME, DBCommon.VERSION, DBCommon.DISPLAY_NAME, DBCommon.SIZE);

db.transaction(function (tx) {
var res = tx.executeSql("SELECT id FROM users WHERE is_default = 1 AND id > 0 LIMIT 1");
if (res.rows.length > 0) {
remoteId = res.rows.item(0).id;
} else {
var fallback = tx.executeSql("SELECT id FROM users WHERE id > 0 ORDER BY id ASC LIMIT 1");
if (fallback.rows.length > 0) {
remoteId = fallback.rows.item(0).id;
}
}
});

} catch (e) {
DBCommon.logException(e);
}

return remoteId;
}


/**
* Retrieves a list of Odoo users associated with the given account ID.
*
Expand All @@ -159,7 +199,10 @@ function getUsers(accountId) {

db.transaction(function (tx) {
var result = tx.executeSql(
"SELECT u.id, u.name, COALESCE(NULLIF(u.login, ''), NULLIF(u.email, ''), NULLIF(u.work_email, ''), '') as email, u.odoo_record_id, u.account_id, a.name as account_name FROM res_users_app u LEFT JOIN users a ON u.account_id = a.id WHERE u.account_id = ?",
"SELECT u.id, u.name, COALESCE(NULLIF(u.login, ''), NULLIF(u.email, ''), NULLIF(u.work_email, ''), '') as email, u.odoo_record_id, u.account_id, a.name as account_name " +
"FROM res_users_app u LEFT JOIN users a ON u.account_id = a.id " +
"WHERE u.account_id = ? AND (u.active IS NULL OR u.active = 1) AND u.name IS NOT NULL AND TRIM(u.name) != '' " +
"ORDER BY u.name COLLATE NOCASE ASC",
[accountId]
);

Expand Down Expand Up @@ -373,6 +416,10 @@ function updateAccount(accountId, name, link, database, username, selectedConnec
* @param {number} userId - The `id` of the user to delete.
*/
function deleteAccountAndRelatedData(userId) {
if (userId === 0 || userId === "0") {
console.warn("Cannot delete Local Account");
return;
}

try {
const db = Sql.LocalStorage.openDatabaseSync(DBCommon.NAME, DBCommon.VERSION, DBCommon.DISPLAY_NAME, DBCommon.SIZE);
Expand All @@ -385,23 +432,55 @@ function deleteAccountAndRelatedData(userId) {
"account_analytic_line_app",
"res_users_app",
"mail_activity_type_app",
"mail_activity_app"
"ir_model_app",
"mail_activity_app",
"ir_attachment_app",
"project_task_assignee_app",
"project_update_app",
"project_task_type_app",
"project_project_stage_app",
"attachment_download_app",
"form_drafts",
"notification"
];

var numericUserId = parseInt(userId, 10);
for (let i = 0; i < tables.length; i++) {
const table = tables[i];
DBCommon.log("Deleting data from account " + userId)
tx.executeSql(`DELETE FROM ${table} WHERE account_id = ?`, [userId]);
DBCommon.log("Deleting data from account " + numericUserId);
try {
tx.executeSql(`DELETE FROM ${table} WHERE account_id = ?`, [numericUserId]);
} catch (tableErr) {
DBCommon.log("Could not delete from table " + table + ": " + tableErr);
}
}

DBCommon.log(`Deleting user from users table where id = ${userId}`);
tx.executeSql("DELETE FROM users WHERE id = ?", [userId]);
DBCommon.log(`Deleting user from users table where id = ${numericUserId}`);
tx.executeSql("DELETE FROM users WHERE id = ?", [numericUserId]);

DBCommon.log(`Account and related data deleted for account_id: ${userId}`);
// Ensure a valid default account exists
var defaultCheck = tx.executeSql("SELECT id FROM users WHERE is_default = 1 LIMIT 1");
if (defaultCheck.rows.length === 0) {
var firstAccount = tx.executeSql("SELECT id FROM users ORDER BY id ASC LIMIT 1");
if (firstAccount.rows.length > 0) {
tx.executeSql("UPDATE users SET is_default = 1 WHERE id = ?", [firstAccount.rows.item(0).id]);
}
}

// Post-deletion sweep across all tables to purge any unlinked records
for (let j = 0; j < tables.length; j++) {
try {
tx.executeSql(`DELETE FROM ${tables[j]} WHERE account_id NOT IN (SELECT id FROM users)`);
} catch (sweepErr) {
// Ignore sweep errors for optional tables
}
}

DBCommon.log(`Account and related data deleted for account_id: ${numericUserId}`);
});

} catch (e) {
DBCommon.logException(e);
DBCommon.logException("Accounts", e);
}
}

Expand All @@ -414,7 +493,8 @@ function deleteAccountAndRelatedData(userId) {
* @returns {number|null} The `odoo_record_id` of the matched user, or `null` if not found.
*/
function getCurrentUserOdooId(accountId) {
if (accountId === 0) {
var parsedAccountId = (accountId !== undefined && accountId !== null) ? parseInt(accountId) : -1;
if (parsedAccountId === 0) {
return 1; // Local account
}
let odooId = null;
Expand Down Expand Up @@ -536,6 +616,10 @@ function getAccountName(accountId) {
return "";
}

if (Number(accountId) === 0) {
return "Local";
}

try {
var db = Sql.LocalStorage.openDatabaseSync(DBCommon.NAME, DBCommon.VERSION, DBCommon.DISPLAY_NAME, DBCommon.SIZE);
var name = "";
Expand All @@ -547,6 +631,10 @@ function getAccountName(accountId) {
}
});

if (name === "Local Account") {
return "Local";
}

return name;
} catch (e) {
Logger.error("Accounts", "getAccountName failed:", e)
Expand Down Expand Up @@ -575,8 +663,8 @@ function getUserNameByOdooId(odoo_record_id) {
var db = Sql.LocalStorage.openDatabaseSync(DBCommon.NAME, DBCommon.VERSION, DBCommon.DISPLAY_NAME, DBCommon.SIZE);

db.transaction(function (tx) {
var query = "SELECT name FROM res_users_app WHERE odoo_record_id = ? LIMIT 1";
var result = tx.executeSql(query, [odoo_record_id]);
var query = "SELECT name FROM res_users_app WHERE (odoo_record_id = ? OR id = ?) LIMIT 1";
var result = tx.executeSql(query, [odoo_record_id, odoo_record_id]);

if (result.rows.length > 0) {
userName = result.rows.item(0).name;
Expand Down
Loading
Loading