bugGNU Health - Bugs: bug #43048, Assertion Error with datetime, it...


You are not allowed to post comments on this tracker with your current authentication level.

bug #43048: Assertion Error with datetime, it does not possible install health module

Submitted by:  oscar alvarez <oscar_alv>
Submitted on:  Fri Aug 22 04:08:11 2014  
Category: InstallationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Luis Falcon <meanmicio>
Open/Closed: ClosedRelease: 2.7.0
Module: health

Sun Aug 24 18:12:26 2014, comment #5:

Just to double check. This is a newly created party, with the default activation date on the current GNU Health.

health26=# select name, activation_date from party_party;
name | activation_date
Rejon | 2014-08-24

No issues found when creating a new party and assigning it a default activation date.

But you are right, the type should be datetime.date, so no need for type casting . I just commit the changes to the default branch

Thanks Oscar !

Luis Falcon <meanmicio>
Project AdministratorIn charge of this item.
Sun Aug 24 16:47:04 2014, comment #4:

I know is a fields.Date, and we'll use datetime.date.today() in 2.8.

What I'm saying is that is type casting it correctly, from datetime to date. Otherwise nobody would be able to use GNU Health today :)


Luis Falcon <meanmicio>
Project AdministratorIn charge of this item.
Sun Aug 24 15:26:22 2014, comment #3:

The field activation_date, require date type in this model:

activation_date = fields.Date(
'Activation date', help='Date of activation of the party')

But with this simple test, you can see that fail, default method.

line 24 health.py file:

>>> from datetime import datetime, timedelta

line 300 health.py file:

>>> datetime.today()

datetime.datetime(2014, 8, 24, 10, 18, 28, 424916)

def default_activation_date():
return datetime.today()

The problem is that datetime.today() return datetime not date as the field expect.

oscar alvarez <oscar_alv>
Project Member
Sun Aug 24 10:39:54 2014, comment #2:

Is type casting correctly to date - datetime.date.today() - .

Please check on the community server health.gnusolidario.org:8000 and let me know if you can reproduce the error.

For 2.8, we will your dateime.date.today anyways.

Thanks !

Luis Falcon <meanmicio>
Project AdministratorIn charge of this item.
Fri Aug 22 21:49:35 2014, comment #1:

I attached a patch that fix the value returned my default method, the right value type is Date, not Datetime.

oscar alvarez <oscar_alv>
Project Member
Fri Aug 22 04:08:11 2014, original submission:

I installed tryton 3.2 and several basic official modules, so next I try install only the health module, with

$trytond -d DATABASENAME -u health

I get this:

[Fri Aug 22 03:34:59 2014] INFO:modules:health
[Fri Aug 22 03:34:59 2014] INFO:modules:health:register gnuhealth.operational_area
[Fri Aug 22 03:35:01 2014] INFO:modules:health:register gnuhealth.operational_sector
[Fri Aug 22 03:35:01 2014] INFO:modules:health:register gnuhealth.du
[Fri Aug 22 03:35:02 2014] INFO:modules:health:register gnuhealth.occupation
[Fri Aug 22 03:35:02 2014] INFO:modules:health:register gnuhealth.ethnicity
[Fri Aug 22 03:35:02 2014] INFO:modules:health:register party.party
Traceback (most recent call last):
File "/home/oscar/.virtualenvs/gnu_tryton32/bin/trytond", line 113, in <module>
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/server.py", line 123, in run
Pool(db_name).init(update=update, lang=lang)
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/pool.py", line 151, in init
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 429, in load_modules
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 397, in _load_modules
load_module_graph(graph, pool, lang)
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/modules/__init__.py", line 237, in load_module_graph
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/modules/health/health.py", line 386, in _register_
super(PartyPatient, cls).__register__(module_name)
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/model/modelsql.py", line 112, in _register_
default_fun, field_size, string=field.string)
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/backend/postgresql/table.py", line 270, in add_raw_column
File "/home/oscar/.virtualenvs/gnu_tryton32/local/lib/python2.7/site-packages/trytond/model/fields/date.py", line 31, in sql_format
or value.time() == datetime.time())

So trying from ui I get the same message.

So all modules was installed with pip, including trytond_health

oscar alvarez <oscar_alv>
Project Member


Attached Files
file #31936:  patch_43048.diff added by oscar_alv (400B - text/x-patch - Attached tested patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by meanmicio (Posted a comment)
  • -unavailable- added by oscar_alv (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun Aug 24 18:14:37 2014meanmicioReleaseNone=>2.7.0
    Sun Aug 24 18:12:26 2014meanmicioStatusNeed Info=>Fixed
    Sun Aug 24 10:39:54 2014meanmicioStatusNone=>Need Info
      Assigned toNone=>meanmicio
    Fri Aug 22 21:27:58 2014oscar_alvAttached File-=>Added patch_43048.diff, #31936

    Back to the top

    Powered by Savane 3.1-cleanup1