[project_timesheet_contract] should set default cost_based_on, prevents from loading "hr"

Bug #854659 reported by Dimitri John Ledkov (ex-credativ)
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
Vishal Parmar(Open ERP)

Bug Description

When installing both hr and project_timesheet_contract on a fresh database, hr module errors out to install hr_data.

The reason being is that "cost_based_on" is a mandatory field on an employee, which is added in "project_timesheet_contract".

Possible solutions:
1) Extend xml data in project_timesheet_contract to add "cost_based_on" for admin user
2) Add default to "product" price for example.

Tested on 6.0 latest revno, but seems to apply to trunk as well.

[2011-09-20 12:55:45,335][project] ERROR:tools.convert.xml_import:Parse error in /home/user/src/openerp/6.0/project/bin/addons/hr/hr_data.xml:19:
<record id="employee" model="hr.employee">
            <field name="name">Administrator</field>
            <field name="user_id" ref="base.user_root"/>
        </record>
Traceback (most recent call last):
  File "/home/user/src/openerp/6.0/project/bin/tools/convert.py", line 865, in parse
    self._tags[rec.tag](self.cr, rec, n)
  File "/home/user/src/openerp/6.0/project/bin/tools/convert.py", line 832, in _tag_record
    id = self.pool.get('ir.model.data')._update(cr, self.uid, rec_model, self.module, res, rec_id or False, not self.isnoupdate(data_node), noupdate=self.isnoupdate(data_node), mode=self.mode, context=rec_context )
  File "/home/user/src/openerp/6.0/project/bin/addons/base/ir/ir_model.py", line 691, in _update
    res_id = model_obj.create(cr, uid, values, context=context)
  File "/home/user/src/openerp/6.0/project/bin/addons/hr_evaluation/hr_evaluation.py", line 134, in create
    id = super(hr_employee, self).create(cr, uid, vals, context=context)
  File "/home/user/src/openerp/6.0/project/bin/osv/orm.py", line 3651, in create
    cr.execute('insert into "'+self._table+'" (id'+upd0+") values ("+str(id_new)+upd1+')', tuple(upd2))
  File "/home/user/src/openerp/6.0/project/bin/sql_db.py", line 78, in wrapper
    return f(self, *args, **kwargs)
  File "/home/user/src/openerp/6.0/project/bin/sql_db.py", line 131, in execute
    res = self._obj.execute(query, params)
IntegrityError: null value in column "cost_based_on" violates not-null constraint

Related branches

Revision history for this message
Dimitri John Ledkov (ex-credativ) (dle-credativ) wrote :

Further investigating, it seems like the field cost_based_on cannot be mandatory because neither contract nor product are mandatory fields....

Revision history for this message
Dimitri John Ledkov (ex-credativ) (dle-credativ) wrote :

I guess it's best to use "hr_contract_timesheet" with "project_timesheet" both are certified modules and give similar functionality.

Other projects with project_timsheet_contract are:
* missing translate import while using "_"
* doesn't define base product or contract for the default user/employee admin, hence failing install.

Changed in openobject-addons:
assignee: nobody → Vishal Parmar(Open ERP) (vpa-openerp)
importance: Undecided → Low
status: New → Confirmed
status: Confirmed → In Progress
Revision history for this message
Vishal Parmar(Open ERP) (vpa-openerp) wrote :

Hello,

Thanks for reporting,

I have checked this issue, The related problem is only reproducible in stable 6 not in trunk version.

This has been fixed with the following revision :

5532 <email address hidden>

Thanks.

Changed in openobject-addons:
status: In Progress → Fix Released
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.