OpenERP – Timesheet module – Hours encoding error

When trying to encode new hours in one’s timesheet in OpenERP, the following error might appear:

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())

The error code is not clear, but the problem in this case comes from the fact that you don’t have (or you didn’t select) an “Invoicing” item. An invoicing is the type of invoicing (if you use a special discount for a special type of client for example). If you don’t know or you don’t have any “special” kind of invoicing, just enter something like “normal invoicing”.

I had initially started to look for the interface definition in the timesheet module to try and find a missing field (adding a “Journal” field or something to avoid the “NULL” value), but just filling an invoice type is much faster. Anyway, just in case, I think the following lines are of interest in the interface definition…

./hr_timesheet_invoice/hr_timesheet_invoice.py:73:class account_analytic_line(osv.osv):
./hr_timesheet_invoice/hr_timesheet_invoice.py:82:        return super(account_analytic_line,self).unlink(cursor, user, ids,
./hr_timesheet_invoice/hr_timesheet_invoice.py:87:        return super(account_analytic_line,self).write(cr, uid, ids, vals,
./hr_timesheet_invoice/hr_timesheet_invoice.py:105:        return super(account_analytic_line, self).copy(cursor, user, obj_id,
./hr_timesheet_invoice/hr_timesheet_invoice.py:108:account_analytic_line()

It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on TumblrEmail this to someone

5 Comments

    • Hi Omadegbo, sorry, that was a very long time ago, I didn’t even remember this post. I would have thought that would have been fixed in OpenERP by now…

Leave a Reply

Your email address will not be published. Required fields are marked *