hr_timesheet - Unexplicit error when not filling "Invoicing" field

Bug #259465 reported by Yannick Warnier
2
Affects Status Importance Assigned to Milestone
OpenERP
Fix Released
Undecided
Fabien (Open ERP)

Bug Description

As documented here: http://beeznest.wordpress.com/2008/08/14/openerp-timesheet-module-hours-encoding-error/

There is an error in the hr_timesheet (or hr_timesheet_invoice) module in OpenERP 4.2 with eTiny (web client) that is showing an SQL error, making it particularly difficult for the user to understand what's wrong.

To reproduce, go to "Human Resources" -> "Hours encoding" -> "New" and encode a timesheet entry, intentionally forgetting the "Invoicing" field (which is marked in a way that lets us think that it is not necessary).

You get something like this (in a popup):
    ERROR: null value in column “journal_id” violates not-null constraint

    insert into “account_analytic_line” (id,perm_id,”user_id”,”account_id”,”general_account_id”,”product_uom_id”,”journal_id”,”name”,”to_invoice”,”amount”,”unit_amount”,”date”,”product_id”,create_uid,create_date) values (4,NULL,’4′,’6′,’634′,’4′,NULL,’Analysis of AIM development project’,NULL,-40.000000,2.000000,’2008-08-14′,’1′,4,now())

This is fixed by indicating an "Invoicing" entry.
A quick-fix to this is to change the "Invoicing" field to "mandatory", so it is marked in red.

The "good" fix to this is to indicate a clear error message stating that the invoicing field is actually mandatory in this case, and where it can be created ("Financial Management" -> "Configuration" -> "Analytic Accounts" -> "Types of invoicing")

Tags: hr-timesheet
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

It's not related to the invoicing field, which is not required. This appears when you try to fill in timesheets for a user that have no employee related to it. Or, the user may have an employee defined for it but no analytic journal is set on the employee form related to the user that fills in the timesheet.

A fixed as been commited in trunk (r1499) to put a clear and better message for the
end-user in case of such a misconfiguration.

This is not a real bug (misconfiguration of your system), so no modification are applied in the stable.

Thanks.

Changed in openerp:
assignee: nobody → fp-tinyerp
status: New → Fix Released
Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

I closed the bug, reopen if it's related to invoicing field, instead of employee configuration. (I doubt, we have several servers using these modules in production without problems).

Revision history for this message
Yannick Warnier (ywarnier) wrote :

I think I will have to insist on the fact it is due to a missing invoicing field :-)

We tried it, it failed, we added an invoicing type and added it to the form and it worked. No other operation in between. It will take some time for me to try it again to have a more complete test set, but I think it shouldn't be closed for now. I suggest the bug be considered as minor and left opened until I can try it again and assert it's not a problem of employee.

This being said, I'm trying it on 4.2, not on a development version. Maybe the development version has something more that prevents the problem from happening without an invoicing type...?

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote : Re: [Bug 259465] Re: hr_timesheet - Unexplicit error when not filling "Invoicing" field

Some questions:
* Do you use the GTK client or the Web client (etiny) ?
* You said form, but normally we encode the hours in list mode ? Did you
used the form view or list view to encode a timesheet line ?
* Did you installed your DB with or without demo data ?

If you retry, please check with sources from the bzr. To get them:
   bzr branch lp:openerp
   cd openerp
   ./bzr_set.py -v4.2

I tested on fresh db, with and without demo data, and I could not
reproduce your problem. (I have this message if no journal is present in
the employee definition related to the user, but nothing related to
invoicing)

Thanks,

--
Fabien

Yannick wrote:
> I think I will have to insist on the fact it is due to a missing
> invoicing field :-)
>
> We tried it, it failed, we added an invoicing type and added it to the
> form and it worked. No other operation in between. It will take some
> time for me to try it again to have a more complete test set, but I
> think it shouldn't be closed for now. I suggest the bug be considered as
> minor and left opened until I can try it again and assert it's not a
> problem of employee.
>
> This being said, I'm trying it on 4.2, not on a development version.
> Maybe the development version has something more that prevents the
> problem from happening without an invoicing type...?
>

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

I am not sure LP correctly manages reply to emails, so I retry from web interface.

Some questions:
* Do you use the GTK client or the Web client (etiny) ?
* You said form, but normally we encode the hours in list mode ? Did you used the form view or list view to encode a timesheet line ?
* Did you installed your DB with or without demo data ?

If you retry, please check with sources from the bzr. To get them:
  bzr branch lp:openerp
  cd openerp
  ./bzr_set.py -v4.2

I tested on fresh db, with and without demo data, and I could not reproduce your problem. (I have this message if no journal is present in the employee definition related to the user, but nothing related to invoicing)

Revision history for this message
Yannick Warnier (ywarnier) wrote :

Seems like reply to emails is handled well by Launchpad: I received both messages.

* I use eTiny (web) as specified in my initial report
* I'm encoding in what looks to me like a list with one line being a form. I'm not entirely sure what's a form or a list view, although I kind of get the idea
* DB installed without demo data, using minimal profile

What is "bzr" and what does the name stand for?

I'm currently installing on a fresh DB. Will report soon.

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Yannick wrote:
> Seems like reply to emails is handled well by Launchpad: I received both
> messages.
>
> * I use eTiny (web) as specified in my initial report
> * I'm encoding in what looks to me like a list with one line being a form. I'm not entirely sure what's a form or a list view, although I kind of get the idea
> * DB installed without demo data, using minimal profile
>
> What is "bzr" and what does the name stand for?

It's bazaar. Our Version Control System and the one used on launchpad to
manage the code sources. It's like a subversion but distributed and much
more better :)

--
Fabien

Revision history for this message
Yannick Warnier (ywarnier) wrote :

After install, I'm adding "hr_timesheet" (which adds "hr" automatically).

I agree that, at this point, there is an error (the one you reported as fixed) that is related to the user/employee/account missing.

Then (because I'm looking for this "Invoicing" field), I'm installing "hr_timesheet_invoice" and trying again but that didn't add the field, then "hr_timesheet_sheet", "report_timesheet", and many others, but it didn't help either.

I'm attaching a screenshot of the problem I had (with the "invoicing" field showing) in the meantime but I might need some time to reproduce it (Arnaud, who helped me setup this database, is currently without internet connection).

Revision history for this message
Fabien (Open ERP) (fp-tinyerp) wrote :

Ok, I think I have an idea. If you installed eTiny in production mode,
it keeps a cache of every view for performance reasons. So modifications
on existing views only appears after a while.

To avoid this, you can either:
* Restart etiny after installing new modules or
* Install etiny in development environment (see default.cfg file) or
* Use the GTK client

--
Fabien

Yannick wrote:
> After install, I'm adding "hr_timesheet" (which adds "hr"
> automatically).
>
> I agree that, at this point, there is an error (the one you reported as
> fixed) that is related to the user/employee/account missing.
>
> Then (because I'm looking for this "Invoicing" field), I'm installing
> "hr_timesheet_invoice" and trying again but that didn't add the field,
> then "hr_timesheet_sheet", "report_timesheet", and many others, but it
> didn't help either.
>
> I'm attaching a screenshot of the problem I had (with the "invoicing"
> field showing) in the meantime but I might need some time to reproduce
> it (Arnaud, who helped me setup this database, is currently without
> internet connection).
>
> ** Attachment added: "Invoicing field in timesheet"
> http://launchpadlibrarian.net/16969328/ht_timesheet-2.png
>

Revision history for this message
Yannick Warnier (ywarnier) wrote :

Yes, the caching problem was the solution indeed. I restarted the server and now I get the "Invoicing" field and the error shows up again (because I have no Invoicing scheme defined).

This means this option should have the right message set as well...

What do we do now? Do you still need something more from me (like the exact module that triggers the appearance of the "Invoicing" field) or are you OK with the information given?

Aside from that, I think a script to clean the cache on a production server without the need to restart the server would be good. Should I submit a feature request for that? I haven't seen a way to define whether a bug report is actually a bug report or a feature request...

Revision history for this message
forstera (arnaud-forster-deactivatedaccount) wrote :

I got this error after creating a new database. When Openerp tries to install the new configuration, it generates this error.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.