Skip to content

[19.0][IMP] hr_timesheet_time_control_begin_end: handle str default_date_time in default_get#927

Merged
OCA-git-bot merged 1 commit into
OCA:19.0from
c4a8-odoo:19.0-imp-hr_timesheet_time_control_begin_end-str
May 21, 2026
Merged

[19.0][IMP] hr_timesheet_time_control_begin_end: handle str default_date_time in default_get#927
OCA-git-bot merged 1 commit into
OCA:19.0from
c4a8-odoo:19.0-imp-hr_timesheet_time_control_begin_end-str

Conversation

@CRogos

@CRogos CRogos commented May 20, 2026

Copy link
Copy Markdown
Contributor

@pedrobaeza when useing hr_timesheet_calendar and hr_timesheet_time_control_begin_end the default_date_time in the context comming from the calendar is str not datetime.
Therefore the change we recently did https://github.com/OCA/timesheet/pull/899/changes is not working.

This error occurs when creating a new entry in the calendar view. runboat
image

Therefore I would like to re-add the string handling.
Another possible solution would be to make hr_timesheet_calendar dependent of hr_timesheet_time_control_begin_end instead of hr_timesheet_time_control. In this case the execution order is correct and the str can be handled in hr_timesheet_calendar. (but I prefer adding the str handling here).

What do you think?

@OCA-git-bot OCA-git-bot added series:19.0 mod:hr_timesheet_time_control_begin_end Module hr_timesheet_time_control_begin_end labels May 20, 2026
@CRogos CRogos force-pushed the 19.0-imp-hr_timesheet_time_control_begin_end-str branch from deacb26 to 1a76b79 Compare May 20, 2026 14:22
@CRogos CRogos marked this pull request as ready for review May 20, 2026 14:28
@pedrobaeza pedrobaeza added this to the 19.0 milestone May 21, 2026
@pedrobaeza

Copy link
Copy Markdown
Member

And why it can't be a datetime?

@CRogos

CRogos commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

I assume that the cause is in the calendar module and how it builds is buildRawRecord: https://github.com/odoo/odoo/blob/19.0/addons/web/static/src/views/calendar/calendar_model.js#L379

    async createRecord(record) {
        const rawRecord = this.buildRawRecord(record);
        const context = this.makeContextDefaults(rawRecord);
        await this.orm.create(this.meta.resModel, [rawRecord], { context });
        await this.load();
    }

@pedrobaeza pedrobaeza left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK then.

/ocabot merge patch

@OCA-git-bot

Copy link
Copy Markdown
Contributor

On my way to merge this fine PR!
Prepared branch 19.0-ocabot-merge-pr-927-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 7b03fd5 into OCA:19.0 May 21, 2026
6 of 7 checks passed
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 06be484. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants