hr_expense: invoice ignores employee company

Bug #796363 reported by Stéphane Bidoul (Acsone)
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Addons (MOVED TO GITHUB)
Fix Released
Low
OpenERP R&D Addons Team 3

Bug Description

Hi,

When creating an invoice from an expense (the last step in hr_expense workflow), the employee company is ignored.

How to reproduce:
- create 2 companies A and B
- create an expense for an employee of company B
- approve and invoice the expense with the user where company preference is set to A
- result: the invoice is created for company A
- expected result: the invoice should be created for company B which is the company of the employee submitting the expense, not the default company of the user creating the invoice

I attach a patch.

Best regards,

-sbi

Related branches

Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hi again,

I attach a slightly improved patch: the company_id used to create the invoice is taken from the expense instead of the expense employee. In turn, the company_id on the expense is defaulted to the employee company. This creates a sensible default, while allowing the user to create an expense for another company than its own.

Best regards,

-sbi

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

Hello,

In trunk just add also "import netsvc" which is missing in hr_expense.py

Thanks.

summary: - [6.0] hr_expense: invoice ignores employee company
+ hr_expense: invoice ignores employee company
Changed in openobject-addons:
assignee: nobody → OpenERP R&D Addons Team 3 (openerp-dev-addons3)
importance: Undecided → Low
status: New → Confirmed
Changed in openobject-addons:
status: Confirmed → In Progress
Revision history for this message
Ujjvala Collins (uco-openerp) wrote :

Hello Stéphane,

Thanks for the patch. I have made some small corrections and committed your patch in the following branch:
lp:~openerp-dev/openobject-addons/trunk-bug-796363-uco with revision 4780 <email address hidden>.

Thanks for reporting the problem. This will be merged into main addons soon.

Thanks,
Ujjvala

Changed in openobject-addons:
status: In Progress → Fix Committed
Revision history for this message
Stéphane Bidoul (Acsone) (sbi) wrote :

Hi Ujjvala,

In the meantime, I've had a stack trace with my patch: I noticed it's better to use browse instead of read in _company_get.

Best regards,

-sbi

Changed in openobject-addons:
milestone: none → 6.1
Revision history for this message
Ujjvala Collins (uco-openerp) wrote :

Hello Stéphane,

Thanks for the suggestion. I have improved the code accordingly.

Regards,
Ujjvala

Revision history for this message
Ujjvala Collins (uco-openerp) wrote :

Hello Stéphane,

We have removed the function _company_get, adding the default value to the company_id field, from your code, as it is achieved by the onchange_employee_id method. Rest of the changes are working fine. We'll apply them in trunk-addons soon.

Thank you very much for your contribution.

Regards,
Ujjvala

Changed in openobject-addons:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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