Tryton - Issues

 

Issue6979

Title Not attribute total_seconds() when run sqlite tests and cost is 0 (int)
Priority bug Status closed
Superseder Nosy List pokoli, resteve
Type crash Components project_revenue
Assigned To Keywords
Reviews

Created on 2017-11-30.15:46:36 by resteve, last changed by pokoli.

Messages
msg37291 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-12-14.10:00:24
I'm closing this issue as the scenario is running on our latest trunk: 

https://drone.tryton.org/tryton/modules.project_revenue/11

If you don't agree, please re-open it with the steps to reproduce.
msg37118 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-12-01.09:48:41
I still can not reproduce. See review41701002 for an example scenario which works without problems.
msg37112 (view) Author: [hidden] (resteve) Date: 2017-11-30.21:57:58
The project_revenue has not a scenario rst [1].

To reproduce:

1- Create a scenario rst.
2- Call "cost" field in project. Example:

    >>> Project = Model.get('project.work')
    >>> project = Project()
    >>> project.name = 'Project'
    >>> project.type = 'project'
    >>> project.work = timesheet
    >>> project.product = service
    >>> project.effort_duration = datetime.timedelta(hours=2)
    >>> project.save()
    >>> project.cost
    # crash when cost is 0 (int)

3- Run test in Sqlite

[1] http://hg.tryton.org/modules/project_revenue/file/default/tests
msg37110 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2017-11-30.15:59:33
Can not reproduce on latest trunk. See: 

https://drone.tryton.org/tryton/modules.project_revenue/9/10

Could you post the steps to reproduce it?
msg37109 (view) Author: [hidden] (resteve) Date: 2017-11-30.15:46:35
Running tests with Sqlite and project_revenue installed:

      File "/home/resteve/virtualenv/xxx/trytond/trytond/modules/project_revenue/work.py", line 83, in _get_cost
        cost = cost.total_seconds()
    AttributeError: 'int' object has no attribute 'total_seconds'

because cost value is 0 (int) and only check when is a float [1] to do total_seconds()

[1] https://bitbucket.org/tryton/project_revenue/src/beebbf1b57f450146f0ee602409707c06d358905/work.py?at=default&fileviewer=file-view-default#work.py-82
History
Date User Action Args
2017-12-14 10:00:24pokolisetstatus: need-eg -> closed
messages: + msg37291
2017-12-01 10:26:13pokolisetstatus: chatting -> need-eg
2017-12-01 09:48:41pokolisetmessages: + msg37118
2017-11-30 21:57:59restevesetmessages: + msg37112
2017-11-30 15:59:33pokolisetnosy: + pokoli
messages: + msg37110
2017-11-30 15:46:36restevecreate

Showing 10 items. Show all history (warning: this could be VERY long)