odoo / odoo/documentation

(v13) `Datetime` in `Model.write` seems to be able to take a `datetime`, but docs say only `str` is accepted

Open
#1,442 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
reStructuredText
Stars
1.3k
Forks
12.1k
PR merge metrics
No merged PRs in 30d

Description

https://www.odoo.com/documentation/13.0/developer/reference/addons/orm.html#odoo.models.Model.write

Under "Other non-relational fields use a string for value" you can see a "Danger" box with the following text:

"for historical and compatibility reasons, Date and Datetime fields use strings as values (written and read) rather than date or datetime."

In my testing this seems to be wrong. I can pass a datetime as the value for a Datetime field and it seems to work just fine. Can someone else verify this?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked Odoo ORM documentation section, “Other non-relational fields use a string for value,” and reproduce the reported Model.write behavior using a Datetime field and a datetime value. Compare the result with the documented warning; the work is done when the behavior is verified and the documentation accurately reflects it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.