Installing hr_timesheet after deleting of Administraton employee fails

Bug #1163766 reported by Alvar Vilu
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Confirmed
Medium
OpenERP R&D Addons Team 3

Bug Description

Installation of hr_timesheet fails because Administration employee is supposed to be updated by a journal_id only.
But if that employee does not exist, ystem attempts to create it but without a "name" field value and it's a constraint error.

hr_timesheet/hr_timesheet_data.xml:
        <record id="hr.employee" model="hr.employee">
            <field name="journal_id" ref="analytic_journal"/>
        </record>

There is no record for matching the id: hr.employee (Administrator employee).

This update should check somehow if that reference id is present and thend proceed or just update all required fields (like name).

A technical explanation:

2013-04-03 07:54:02,646 19255 ERROR aa_db openerp.sql_db: bad query: insert into "resource_resource" (id,"active","time_efficiency","company_id","resource_type",create_uid,create_date,write_uid,write_date) values (7,'True',1.0,1,'user',1,(now() at time zone 'UTC'),1,(now() at time zone 'UTC'))
Traceback (most recent call last):
  File "/erp/41/openerp/sql_db.py", line 226, in execute
    res = self._obj.execute(query, params)
IntegrityError: null value in column "name" violates not-null constraint

2013-04-03 07:54:02,647 19255 ERROR aa_db openerp.tools.convert: Parse error in /erp/41/openerp/addons/hr_timesheet/hr_timesheet_data.xml:11:
<record id="hr.employee" model="hr.employee">
            <field name="journal_id" ref="analytic_journal"/>
        </record>

Tags: hr timesheet
Alvar Vilu (alvar-vilu)
tags: added: v7.0
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
jasimmk (jasimmk-c) wrote :

I am having issue when I install it hr_timesheet in my old database. with Postgresql 9.2. It doesn't affect at all when I create a new database and install hr_timesheet module

Revision history for this message
jasimmk (jasimmk-c) wrote :
Revision history for this message
jasimmk (jasimmk-c) wrote :

To jsut hack it out, just open hr_timesheet_data.xml and comment out like this

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data noupdate="1">
      <!---
        <record id="analytic_journal" model="account.analytic.journal">
            <field name="code">TS</field>
            <field name="name">Timesheet Journal</field>
            <field name="type">general</field>
        </record>

        <record id="hr.employee" model="hr.employee">
            <field name="journal_id" ref="analytic_journal"/>
        </record>
      -->
    </data>
</openerp>

Then installation of module will be done smoothly.

Later, Goto
Accounting >> Analytic Accounting > Analytic Journals
Create a new Analytic Accounting Journal with Journal Name "Timesheet Journal" ,Journal Code "TS", and Type "General"

Later Goto "Human Resources" > "Employees"
Take each employee and goto "HR Settings" and put Analytic Journal to "Timesheet Journal" and make sure the product should be selected which you are timely billing like "Time based Software Development / Service"

Revision history for this message
Alvar Vilu (alvar-vilu) wrote :

I know that i can hack it but let's be reasonable: it's a big problem.
There should be something like that:

        <record id="hr.employee" model="hr.employee" check_existance="1">
            <field name="journal_id" ref="analytic_journal"/>
        </record>

that record will not be modified if that id is not existing (aka after deleting the admin employee)

Revision history for this message
Amit Parik (amit-parik) wrote :

Hello Alvar,

You can also try with this... -u all -d <db name> which will again creates the employee and solve the problem.
I know we have put the nonupdate="1" on data.xml but due to some server problem. This is not working and your data files are also updated even we have set the nonupdate="1".

For OpenERP bug we have to restrict Admin Employee at a time of deletion because it doesn't make sense we can delete the data records because we have passed this data's reference on other data file. i.e hr_appraisal, hr_timesheet.

Thank you!

tags: added: hr timesheet
removed: v7.0
Revision history for this message
Phan Long (longphan) wrote :

I too am having this problem. Deadlock

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.